Commit 24bf941f authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Kalle Valo

airo: Invoke airo_read_wireless_stats() directly

airo_get_wireless_stats() is the iw_handler_if::get_wireless_stats()
callback of this driver. This callback was not allowed to sleep until
commit a160ee69 ("wext: let get_wireless_stats() sleep") in v2.6.32.

airo still delegates the readout to a thread, which is not longer
necessary.

Invoke airo_read_wireless_stats() directly from the callback and remove
the now unused JOB_WSTATS handling.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201101211536.2966644-3-bigeasy@linutronix.de
parent ce4dd05c
...@@ -1144,7 +1144,6 @@ static int airo_thread(void *data); ...@@ -1144,7 +1144,6 @@ static int airo_thread(void *data);
static void timer_func(struct net_device *dev); static void timer_func(struct net_device *dev);
static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static struct iw_statistics *airo_get_wireless_stats(struct net_device *dev); static struct iw_statistics *airo_get_wireless_stats(struct net_device *dev);
static void airo_read_wireless_stats(struct airo_info *local);
#ifdef CISCO_EXT #ifdef CISCO_EXT
static int readrids(struct net_device *dev, aironet_ioctl *comp); static int readrids(struct net_device *dev, aironet_ioctl *comp);
static int writerids(struct net_device *dev, aironet_ioctl *comp); static int writerids(struct net_device *dev, aironet_ioctl *comp);
...@@ -1200,7 +1199,6 @@ struct airo_info { ...@@ -1200,7 +1199,6 @@ struct airo_info {
#define JOB_MIC 5 #define JOB_MIC 5
#define JOB_EVENT 6 #define JOB_EVENT 6
#define JOB_AUTOWEP 7 #define JOB_AUTOWEP 7
#define JOB_WSTATS 8
#define JOB_SCAN_RESULTS 9 #define JOB_SCAN_RESULTS 9
unsigned long jobs; unsigned long jobs;
int (*bap_read)(struct airo_info*, __le16 *pu16Dst, int bytelen, int (*bap_read)(struct airo_info*, __le16 *pu16Dst, int bytelen,
...@@ -3155,8 +3153,6 @@ static int airo_thread(void *data) ...@@ -3155,8 +3153,6 @@ static int airo_thread(void *data)
airo_end_xmit11(dev); airo_end_xmit11(dev);
else if (test_bit(JOB_STATS, &ai->jobs)) else if (test_bit(JOB_STATS, &ai->jobs))
airo_read_stats(dev); airo_read_stats(dev);
else if (test_bit(JOB_WSTATS, &ai->jobs))
airo_read_wireless_stats(ai);
else if (test_bit(JOB_PROMISC, &ai->jobs)) else if (test_bit(JOB_PROMISC, &ai->jobs))
airo_set_promisc(ai); airo_set_promisc(ai);
else if (test_bit(JOB_MIC, &ai->jobs)) else if (test_bit(JOB_MIC, &ai->jobs))
...@@ -7732,15 +7728,12 @@ static void airo_read_wireless_stats(struct airo_info *local) ...@@ -7732,15 +7728,12 @@ static void airo_read_wireless_stats(struct airo_info *local)
__le32 *vals = stats_rid.vals; __le32 *vals = stats_rid.vals;
/* Get stats out of the card */ /* Get stats out of the card */
clear_bit(JOB_WSTATS, &local->jobs); if (local->power.event)
if (local->power.event) {
up(&local->sem);
return; return;
}
readCapabilityRid(local, &cap_rid, 0); readCapabilityRid(local, &cap_rid, 0);
readStatusRid(local, &status_rid, 0); readStatusRid(local, &status_rid, 0);
readStatsRid(local, &stats_rid, RID_STATS, 0); readStatsRid(local, &stats_rid, RID_STATS, 0);
up(&local->sem);
/* The status */ /* The status */
local->wstats.status = le16_to_cpu(status_rid.mode); local->wstats.status = le16_to_cpu(status_rid.mode);
...@@ -7783,15 +7776,10 @@ static struct iw_statistics *airo_get_wireless_stats(struct net_device *dev) ...@@ -7783,15 +7776,10 @@ static struct iw_statistics *airo_get_wireless_stats(struct net_device *dev)
{ {
struct airo_info *local = dev->ml_priv; struct airo_info *local = dev->ml_priv;
if (!test_bit(JOB_WSTATS, &local->jobs)) { if (!down_interruptible(&local->sem)) {
/* Get stats out of the card if available */ airo_read_wireless_stats(local);
if (down_trylock(&local->sem) != 0) { up(&local->sem);
set_bit(JOB_WSTATS, &local->jobs);
wake_up_interruptible(&local->thr_wait);
} else
airo_read_wireless_stats(local);
} }
return &local->wstats; return &local->wstats;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment