OpenCloudOS-Kernel/drivers/net/wireless
Sebastian Andrzej Siewior 920872e083 net: rtlwifi: Replace in_interrupt() for context detection
rtl_lps_enter() and rtl_lps_leave() are using in_interrupt() to detect
whether it is safe to acquire a mutex or if it is required to defer to a
workqueue.

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 seperated or the context be conveyed in an argument passed by the
caller, which usually knows the context.

in_interrupt() also is only partially correct because it fails to chose the
correct code path when just preemption or interrupts are disabled.

Add an argument 'may_block' to both functions and adjust the callers to
pass the context information.

The following call chains were analyzed to be safe to block:

    rtl_watchdog_wq_callback()
      rlf_lps_leave/enter()

    rtl_op_suspend()
      rtl_lps_leave()

    rtl_op_bss_info_changed()
      rtl_lps_leave()

    rtl_op_sw_scan_start()
      rtl_lps_leave()

The following call chains were analyzed to be unsafe to block:

    _rtl_pci_interrupt()
      _rtl_pci_rx_interrupt()
	  rtl_lps_leave()

    _rtl_pci_interrupt()
      _rtl_pci_rx_interrupt()
        rtl_is_special_data()
	  rtl_lps_leave()

    _rtl_pci_interrupt()
      _rtl_pci_rx_interrupt()
        rtl_is_special_data()
	  setup_special_tx()
	    rtl_lps_leave()

    _rtl_pci_interrupt()
      _rtl_pci_tx_isr
        rtl_lps_leave()

      halbtc_leave_lps()
        rtl_lps_leave()

This leaves four callers of rtl_lps_enter/leave() where the analyzis
stopped dead in the maze of several nested pointer based callchains and
lack of rtlwifi hardware to debug this via tracing:

     halbtc_leave_lps(), halbtc_enter_lps(), halbtc_normal_lps(),
     halbtc_pre_normal_lps()

These four have been cautionally marked to be unable to block which is the
safe option, but the rtwifi wizards should be able to clarify that.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-29 14:02:55 -07:00
..
admtek adm8211: switch from 'pci_' to 'dma_' API 2020-08-18 15:51:41 +03:00
ath wireless-drivers-next patches for v5.10 2020-09-25 13:16:29 -07:00
atmel atmel: convert tasklets to use new tasklet_setup() API 2020-08-27 16:22:02 +03:00
broadcom net: brcmfmac: Convey allocation mode as argument 2020-09-29 14:02:55 -07:00
cisco airo: switch from 'pci_' to 'dma_' API 2020-09-16 08:56:43 +03:00
intel net: iwlwifi: Remove in_interrupt() from tracing macro. 2020-09-29 14:02:55 -07:00
intersil net: hostap: Remove in_interrupt() usage 2020-09-29 14:02:55 -07:00
marvell net: libertas: Use netif_rx_any_context() 2020-09-29 14:02:55 -07:00
mediatek wireless-drivers-next patches for v5.10 2020-09-25 13:16:29 -07:00
microchip net: wilc1000: clean up resource in error path of init mon interface 2020-09-21 16:02:13 +03:00
quantenna qtnfmac: Remove unused macro QTNF_DMP_MAX_LEN 2020-09-16 09:09:17 +03:00
ralink rt2x00: convert tasklets to use new tasklet_setup() API 2020-08-27 16:22:13 +03:00
realtek net: rtlwifi: Replace in_interrupt() for context detection 2020-09-29 14:02:55 -07:00
rsi rsi: rsi_91x_sdio_ops: File headers are not good kernel-doc candidates 2020-09-01 16:14:49 +03:00
st cw1200: wsm: Remove 'dummy' variables 2020-09-01 12:02:43 +03:00
ti wireless-drivers-next patches for v5.10 2020-09-25 13:16:29 -07:00
zydas net: zd1211rw: Remove ZD_ASSERT(in_interrupt()) 2020-09-29 14:02:54 -07:00
Kconfig wireless-drivers-next patches for v5.9 2020-07-20 17:52:50 -07:00
Makefile wilc1000: move wilc driver out of staging 2020-06-26 08:46:46 +03:00
mac80211_hwsim.c mac80211: rename csa counters to countdown counters 2020-08-27 14:12:15 +02:00
mac80211_hwsim.h mac80211_hwsim: notify wmediumd of used MAC addresses 2020-04-24 11:45:47 +02:00
ray_cs.c ray_cs: use true,false for bool variable 2020-05-06 11:33:23 +03:00
ray_cs.h
rayctl.h ray_cs: Replace zero-length array with flexible-array member 2020-03-23 19:18:27 +02:00
rndis_wlan.c rndis_wlan: tighten check of rndis_query_oid return 2020-08-18 15:52:45 +03:00
virt_wifi.c virt_wifi: implement ndo_get_iflink 2020-03-20 14:42:20 +01:00
wl3501.h wl3501_cs: Replace zero-length array with flexible-array member 2020-03-23 19:21:21 +02:00
wl3501_cs.c wl3501_cs: Fix a bunch of formatting issues related to function docs 2020-09-01 16:14:47 +03:00