Commit 67fc6052 authored by Mike McCormack's avatar Mike McCormack Committed by John W. Linville

rtlwifi: Run IPS leave work in a tasklet

This removes the need to use IRQ safe spinlocks in many places.
Signed-off-by: default avatarMike McCormack <mikem@ring3k.org>
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 34ddb207
...@@ -622,7 +622,7 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio) ...@@ -622,7 +622,7 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
if (((rtlpriv->link_info.num_rx_inperiod + if (((rtlpriv->link_info.num_rx_inperiod +
rtlpriv->link_info.num_tx_inperiod) > 8) || rtlpriv->link_info.num_tx_inperiod) > 8) ||
(rtlpriv->link_info.num_rx_inperiod > 2)) { (rtlpriv->link_info.num_rx_inperiod > 2)) {
rtl_lps_leave(hw); tasklet_schedule(&rtlpriv->works.ips_leave_tasklet);
} }
} }
...@@ -766,7 +766,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) ...@@ -766,7 +766,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
if (((rtlpriv->link_info.num_rx_inperiod + if (((rtlpriv->link_info.num_rx_inperiod +
rtlpriv->link_info.num_tx_inperiod) > 8) || rtlpriv->link_info.num_tx_inperiod) > 8) ||
(rtlpriv->link_info.num_rx_inperiod > 2)) { (rtlpriv->link_info.num_rx_inperiod > 2)) {
rtl_lps_leave(hw); tasklet_schedule(&rtlpriv->works.ips_leave_tasklet);
} }
skb = new_skb; skb = new_skb;
...@@ -936,6 +936,11 @@ static void _rtl_pci_irq_tasklet(struct ieee80211_hw *hw) ...@@ -936,6 +936,11 @@ static void _rtl_pci_irq_tasklet(struct ieee80211_hw *hw)
_rtl_pci_tx_chk_waitq(hw); _rtl_pci_tx_chk_waitq(hw);
} }
static void _rtl_pci_ips_leave_tasklet(struct ieee80211_hw *hw)
{
rtl_lps_leave(hw);
}
static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
...@@ -1034,6 +1039,9 @@ static void _rtl_pci_init_struct(struct ieee80211_hw *hw, ...@@ -1034,6 +1039,9 @@ static void _rtl_pci_init_struct(struct ieee80211_hw *hw,
tasklet_init(&rtlpriv->works.irq_prepare_bcn_tasklet, tasklet_init(&rtlpriv->works.irq_prepare_bcn_tasklet,
(void (*)(unsigned long))_rtl_pci_prepare_bcn_tasklet, (void (*)(unsigned long))_rtl_pci_prepare_bcn_tasklet,
(unsigned long)hw); (unsigned long)hw);
tasklet_init(&rtlpriv->works.ips_leave_tasklet,
(void (*)(unsigned long))_rtl_pci_ips_leave_tasklet,
(unsigned long)hw);
} }
static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw, static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw,
...@@ -1503,6 +1511,7 @@ static void rtl_pci_deinit(struct ieee80211_hw *hw) ...@@ -1503,6 +1511,7 @@ static void rtl_pci_deinit(struct ieee80211_hw *hw)
synchronize_irq(rtlpci->pdev->irq); synchronize_irq(rtlpci->pdev->irq);
tasklet_kill(&rtlpriv->works.irq_tasklet); tasklet_kill(&rtlpriv->works.irq_tasklet);
tasklet_kill(&rtlpriv->works.ips_leave_tasklet);
flush_workqueue(rtlpriv->works.rtl_wq); flush_workqueue(rtlpriv->works.rtl_wq);
destroy_workqueue(rtlpriv->works.rtl_wq); destroy_workqueue(rtlpriv->works.rtl_wq);
...@@ -1577,6 +1586,7 @@ static void rtl_pci_stop(struct ieee80211_hw *hw) ...@@ -1577,6 +1586,7 @@ static void rtl_pci_stop(struct ieee80211_hw *hw)
set_hal_stop(rtlhal); set_hal_stop(rtlhal);
rtlpriv->cfg->ops->disable_interrupt(hw); rtlpriv->cfg->ops->disable_interrupt(hw);
tasklet_kill(&rtlpriv->works.ips_leave_tasklet);
spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags); spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags);
while (ppsc->rfchange_inprogress) { while (ppsc->rfchange_inprogress) {
......
...@@ -68,6 +68,7 @@ bool rtl_ps_disable_nic(struct ieee80211_hw *hw) ...@@ -68,6 +68,7 @@ bool rtl_ps_disable_nic(struct ieee80211_hw *hw)
/*<2> Disable Interrupt */ /*<2> Disable Interrupt */
rtlpriv->cfg->ops->disable_interrupt(hw); rtlpriv->cfg->ops->disable_interrupt(hw);
tasklet_kill(&rtlpriv->works.irq_tasklet);
/*<3> Disable Adapter */ /*<3> Disable Adapter */
rtlpriv->cfg->ops->hw_disable(hw); rtlpriv->cfg->ops->hw_disable(hw);
......
...@@ -1535,6 +1535,7 @@ struct rtl_works { ...@@ -1535,6 +1535,7 @@ struct rtl_works {
/* For SW LPS */ /* For SW LPS */
struct delayed_work ps_work; struct delayed_work ps_work;
struct delayed_work ps_rfon_wq; struct delayed_work ps_rfon_wq;
struct tasklet_struct ips_leave_tasklet;
}; };
struct rtl_debug { struct rtl_debug {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment