]> err.no Git - linux-2.6/commitdiff
[PATCH] softmac: return -EAGAIN from getscan while scanning
authorjohannes@sipsolutions.net <johannes@sipsolutions.net>
Tue, 11 Apr 2006 08:58:06 +0000 (10:58 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 19 Apr 2006 21:25:39 +0000 (17:25 -0400)
Below patch was developed after discussion with Daniel Drake who
mentioned to me that wireless tools expect an EAGAIN return from getscan
so that they can wait for the scan to finish before printing out the
results.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/ieee80211/softmac/ieee80211softmac_wx.c

index b559aa9b5507712acea32ca7b6e7c614e5e37773..00f0d4f71897aff525361f4c8ee9b7e76b284dcd 100644 (file)
@@ -41,13 +41,23 @@ ieee80211softmac_wx_trigger_scan(struct net_device *net_dev,
 EXPORT_SYMBOL_GPL(ieee80211softmac_wx_trigger_scan);
 
 
+/* if we're still scanning, return -EAGAIN so that userspace tools
+ * can get the complete scan results, otherwise return 0. */
 int
 ieee80211softmac_wx_get_scan_results(struct net_device *net_dev,
                                     struct iw_request_info *info,
                                     union iwreq_data *data,
                                     char *extra)
 {
+       unsigned long flags;
        struct ieee80211softmac_device *sm = ieee80211_priv(net_dev);
+
+       spin_lock_irqsave(&sm->lock, flags);
+       if (sm->scanning) {
+               spin_unlock_irqrestore(&sm->lock, flags);
+               return -EAGAIN;
+       }
+       spin_unlock_irqrestore(&sm->lock, flags);
        return ieee80211_wx_get_scan(sm->ieee, info, data, extra);
 }
 EXPORT_SYMBOL_GPL(ieee80211softmac_wx_get_scan_results);