mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 10:29:37 +00:00
![Sebastian Andrzej Siewior](/assets/img/avatar_default.png)
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>
28 lines
1.1 KiB
C
28 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright(c) 2009-2012 Realtek Corporation.*/
|
|
|
|
#ifndef __REALTEK_RTL_PCI_PS_H__
|
|
#define __REALTEK_RTL_PCI_PS_H__
|
|
|
|
#define MAX_SW_LPS_SLEEP_INTV 5
|
|
|
|
bool rtl_ps_enable_nic(struct ieee80211_hw *hw);
|
|
bool rtl_ps_disable_nic(struct ieee80211_hw *hw);
|
|
void rtl_ips_nic_off(struct ieee80211_hw *hw);
|
|
void rtl_ips_nic_on(struct ieee80211_hw *hw);
|
|
void rtl_ips_nic_off_wq_callback(struct work_struct *work);
|
|
void rtl_lps_enter(struct ieee80211_hw *hw, bool may_block);
|
|
void rtl_lps_leave(struct ieee80211_hw *hw, bool may_block);
|
|
|
|
void rtl_lps_set_psmode(struct ieee80211_hw *hw, u8 rt_psmode);
|
|
|
|
void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len);
|
|
void rtl_swlps_wq_callback(struct work_struct *work);
|
|
void rtl_swlps_rfon_wq_callback(struct work_struct *work);
|
|
void rtl_swlps_rf_awake(struct ieee80211_hw *hw);
|
|
void rtl_swlps_rf_sleep(struct ieee80211_hw *hw);
|
|
void rtl_p2p_ps_cmd(struct ieee80211_hw *hw , u8 p2p_ps_state);
|
|
void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len);
|
|
void rtl_lps_change_work_callback(struct work_struct *work);
|
|
|
|
#endif
|