diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2020-11-02 00:15:35 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2020-11-07 18:52:25 +0300 |
commit | 317f688b0a541808104de9a6e8cff88c602e00cf (patch) | |
tree | 4b849fda866ae23b1fe27d54e1d10577471f3269 /drivers/net/wireless/ralink/rt2x00/rt2800lib.c | |
parent | abcda807d8681923fd7b79ea08b78f684e6cb570 (diff) | |
download | linux-317f688b0a541808104de9a6e8cff88c602e00cf.tar.xz |
rtlwifi: Remove in_interrupt() usage in is_any_client_connect_to_ap().
is_any_client_connect_to_ap() is using in_interrupt() to determine whether
it should acquire the lock prior accessing the list.
The usage of in_interrupt() in drivers is phased out and Linus clearly
requested that code which changes behaviour depending on context should
either be separated or the context be conveyed in an argument passed by the
caller, which usually knows the context.
The function is called from:
- halbtc_get()
- halbtc_get()
halbtc_get_wifi_link_status()
- halbtc_display_dbg_msg()
halbtc_display_wifi_status()
halbtc_get_wifi_link_status()
All top level callers are part of the btc_coexist callback inferface and
are never invoked from a context which can hold the lock already.
The contexts which hold the lock are either protecting list add/del
operations or list walks which never call into any of the btc_coexist
interfaces.
In fact the conditional is outright dangerous because if this function
would be invoked from a BH disabled context the check would avoid taking
the lock while on another CPU the list could be manipulated under the lock.
Remove the in_interrupt() check and always acquire the lock.
To simplify the code further use list_empty() instead of walking the list
and counting the entries just to check the count for > 0 at the end.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201101211536.2966644-8-bigeasy@linutronix.de
Diffstat (limited to 'drivers/net/wireless/ralink/rt2x00/rt2800lib.c')
0 files changed, 0 insertions, 0 deletions