|author||Johannes Berg <firstname.lastname@example.org>||2007-04-26 20:51:12 -0700|
|committer||David S. Miller <email@example.com>||2007-04-26 20:51:12 -0700|
[WIRELESS] cfg80211: Clarify locking comment.
This patch clarifies the comment about locking in wiphy_unregister. Signed-off-by: Johannes Berg <firstname.lastname@example.org> Signed-off-by: John W. Linville <email@example.com> Signed-off-by: David S. Miller <firstname.lastname@example.org>
Diffstat (limited to 'net/wireless')
1 files changed, 15 insertions, 4 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 24a21add0ba6..7eabd55417a5 100644
@@ -91,7 +91,6 @@ int wiphy_register(struct wiphy *wiphy)
res = device_add(&drv->wiphy.dev);
@@ -114,14 +113,26 @@ void wiphy_unregister(struct wiphy *wiphy)
struct cfg80211_registered_device *drv = wiphy_to_dev(wiphy);
+ /* protect the device list */
- /* hold registered driver mutex during list removal as well
- * to make sure no commands are in progress at the moment */
+ * Try to grab drv->mtx. If a command is still in progress,
+ * hopefully the driver will refuse it since it's tearing
+ * down the device already. We wait for this command to complete
+ * before unlinking the item from the list.
+ * Note: as codified by the BUG_ON above we cannot get here if
+ * a virtual interface is still associated. Hence, we can only
+ * get to lock contention here if userspace issues a command
+ * that identified the hardware by wiphy index.
+ /* unlock again before freeing */