aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorHelmut Schaa <helmut.schaa@googlemail.com>2010-12-27 09:06:57 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-01-04 14:35:14 -0500
commitbfe6a15d60671993eb3d4ac396b1f442ae08581c (patch)
treefc7dea9103f7e8644ec310e33d92b486a4ee212c /drivers/net
parentf833eea0a77b0910ea202468175bfc80470d44d0 (diff)
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h7
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c15
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c4
3 files changed, 7 insertions, 19 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 755b723400f5..b3f77d4f37ff 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -347,6 +347,10 @@ struct link {
347 struct delayed_work watchdog_work; 347 struct delayed_work watchdog_work;
348}; 348};
349 349
350enum rt2x00_delayed_flags {
351 DELAYED_UPDATE_BEACON,
352};
353
350/* 354/*
351 * Interface structure 355 * Interface structure
352 * Per interface configuration details, this structure 356 * Per interface configuration details, this structure
@@ -374,8 +378,7 @@ struct rt2x00_intf {
374 /* 378 /*
375 * Actions that needed rescheduling. 379 * Actions that needed rescheduling.
376 */ 380 */
377 unsigned int delayed_flags; 381 unsigned long delayed_flags;
378#define DELAYED_UPDATE_BEACON 0x00000001
379 382
380 /* 383 /*
381 * Software sequence counter, this is only required 384 * Software sequence counter, this is only required
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 97a8911571ce..9597a03242cc 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -110,19 +110,6 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
110{ 110{
111 struct rt2x00_dev *rt2x00dev = data; 111 struct rt2x00_dev *rt2x00dev = data;
112 struct rt2x00_intf *intf = vif_to_intf(vif); 112 struct rt2x00_intf *intf = vif_to_intf(vif);
113 int delayed_flags;
114
115 /*
116 * Copy all data we need during this action under the protection
117 * of a spinlock. Otherwise race conditions might occur which results
118 * into an invalid configuration.
119 */
120 spin_lock(&intf->lock);
121
122 delayed_flags = intf->delayed_flags;
123 intf->delayed_flags = 0;
124
125 spin_unlock(&intf->lock);
126 113
127 /* 114 /*
128 * It is possible the radio was disabled while the work had been 115 * 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,
133 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) 120 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
134 return; 121 return;
135 122
136 if (delayed_flags & DELAYED_UPDATE_BEACON) 123 if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags))
137 rt2x00queue_update_beacon(rt2x00dev, vif, true); 124 rt2x00queue_update_beacon(rt2x00dev, vif, true);
138} 125}
139 126
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index a2266c7d86c2..297d972c229b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -444,9 +444,7 @@ static void rt2x00mac_set_tim_iter(void *data, u8 *mac,
444 vif->type != NL80211_IFTYPE_WDS) 444 vif->type != NL80211_IFTYPE_WDS)
445 return; 445 return;
446 446
447 spin_lock(&intf->lock); 447 set_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags);
448 intf->delayed_flags |= DELAYED_UPDATE_BEACON;
449 spin_unlock(&intf->lock);
450} 448}
451 449
452int rt2x00mac_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 450int rt2x00mac_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta,