mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-20 03:04:01 +08:00
rt2x00: Simplify intf->delayed_flags locking
Instead of protecting delayed_flags with a spinlock use atomic bitops to make the code more readable. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
f833eea0a7
commit
bfe6a15d60
@ -347,6 +347,10 @@ struct link {
|
|||||||
struct delayed_work watchdog_work;
|
struct delayed_work watchdog_work;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum rt2x00_delayed_flags {
|
||||||
|
DELAYED_UPDATE_BEACON,
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Interface structure
|
* Interface structure
|
||||||
* Per interface configuration details, this structure
|
* Per interface configuration details, this structure
|
||||||
@ -374,8 +378,7 @@ struct rt2x00_intf {
|
|||||||
/*
|
/*
|
||||||
* Actions that needed rescheduling.
|
* Actions that needed rescheduling.
|
||||||
*/
|
*/
|
||||||
unsigned int delayed_flags;
|
unsigned long delayed_flags;
|
||||||
#define DELAYED_UPDATE_BEACON 0x00000001
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Software sequence counter, this is only required
|
* Software sequence counter, this is only required
|
||||||
|
@ -110,19 +110,6 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
|
|||||||
{
|
{
|
||||||
struct rt2x00_dev *rt2x00dev = data;
|
struct rt2x00_dev *rt2x00dev = data;
|
||||||
struct rt2x00_intf *intf = vif_to_intf(vif);
|
struct rt2x00_intf *intf = vif_to_intf(vif);
|
||||||
int delayed_flags;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copy all data we need during this action under the protection
|
|
||||||
* of a spinlock. Otherwise race conditions might occur which results
|
|
||||||
* into an invalid configuration.
|
|
||||||
*/
|
|
||||||
spin_lock(&intf->lock);
|
|
||||||
|
|
||||||
delayed_flags = intf->delayed_flags;
|
|
||||||
intf->delayed_flags = 0;
|
|
||||||
|
|
||||||
spin_unlock(&intf->lock);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It is possible the radio was disabled while the work had been
|
* It is possible the radio was disabled while the work had been
|
||||||
@ -133,7 +120,7 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
|
|||||||
if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
|
if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (delayed_flags & DELAYED_UPDATE_BEACON)
|
if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags))
|
||||||
rt2x00queue_update_beacon(rt2x00dev, vif, true);
|
rt2x00queue_update_beacon(rt2x00dev, vif, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,9 +444,7 @@ static void rt2x00mac_set_tim_iter(void *data, u8 *mac,
|
|||||||
vif->type != NL80211_IFTYPE_WDS)
|
vif->type != NL80211_IFTYPE_WDS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
spin_lock(&intf->lock);
|
set_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags);
|
||||||
intf->delayed_flags |= DELAYED_UPDATE_BEACON;
|
|
||||||
spin_unlock(&intf->lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int rt2x00mac_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
|
int rt2x00mac_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
|
||||||
|
Loading…
Reference in New Issue
Block a user