Commit 49eb0199 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Kalle Valo

airo: Always use JOB_STATS and JOB_EVENT

issuecommand() is using in_atomic() to decide if it is safe to invoke
schedule() while waiting for the command to be accepted.

Usage of in_atomic() for this is only half correct as it can not detect all
condition where it is not allowed to schedule(). Also Linus clearly
requested that code which changes behaviour depending on context should
either be seperated or the context be conveyed in an argument passed by the
caller, which usually knows the context.

Chasing the call chains leading up to issuecommand() is straight forward,
but airo_link() and airo_get_stats() would require to pass the context
through a quite large amount of functions.

As this is ancient hardware, avoid the churn and enforce the invocation of
those functions through the JOB machinery.
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-4-bigeasy@linutronix.de
parent 24bf941f
...@@ -2286,12 +2286,8 @@ static struct net_device_stats *airo_get_stats(struct net_device *dev) ...@@ -2286,12 +2286,8 @@ static struct net_device_stats *airo_get_stats(struct net_device *dev)
struct airo_info *local = dev->ml_priv; struct airo_info *local = dev->ml_priv;
if (!test_bit(JOB_STATS, &local->jobs)) { if (!test_bit(JOB_STATS, &local->jobs)) {
/* Get stats out of the card if available */
if (down_trylock(&local->sem) != 0) {
set_bit(JOB_STATS, &local->jobs); set_bit(JOB_STATS, &local->jobs);
wake_up_interruptible(&local->thr_wait); wake_up_interruptible(&local->thr_wait);
} else
airo_read_stats(dev);
} }
return &dev->stats; return &dev->stats;
...@@ -3277,11 +3273,9 @@ static void airo_handle_link(struct airo_info *ai) ...@@ -3277,11 +3273,9 @@ static void airo_handle_link(struct airo_info *ai)
set_bit(FLAG_UPDATE_UNI, &ai->flags); set_bit(FLAG_UPDATE_UNI, &ai->flags);
set_bit(FLAG_UPDATE_MULTI, &ai->flags); set_bit(FLAG_UPDATE_MULTI, &ai->flags);
if (down_trylock(&ai->sem) != 0) {
set_bit(JOB_EVENT, &ai->jobs); set_bit(JOB_EVENT, &ai->jobs);
wake_up_interruptible(&ai->thr_wait); wake_up_interruptible(&ai->thr_wait);
} else
airo_send_event(ai->dev);
netif_carrier_on(ai->dev); netif_carrier_on(ai->dev);
} else if (!scan_forceloss) { } else if (!scan_forceloss) {
if (auto_wep && !ai->expires) { if (auto_wep && !ai->expires) {
......
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