Skip to content

Commit 41affd5

Browse files
Stanislaw Gruszkalinvjw
authored andcommitted
rtlwifi: use work for lps
Leaving leisure power save mode can take some time, so it's better to perform that action in process context with interrupts enabled. This patch changes lps_leave tasklet to work. Reported-by: Philipp Dreimann <philipp@dreimann.net> Tested-by: Larry Finger <Larry.Finger@lwfinger.net> Cc: Mike McCormack <mikem@ring3k.org> Cc: Chaoming Li <chaoming_li@realsil.com.cn> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 49d55ce commit 41affd5

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

drivers/net/wireless/rtlwifi/pci.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
610610
if (((rtlpriv->link_info.num_rx_inperiod +
611611
rtlpriv->link_info.num_tx_inperiod) > 8) ||
612612
(rtlpriv->link_info.num_rx_inperiod > 2)) {
613-
tasklet_schedule(&rtlpriv->works.ips_leave_tasklet);
613+
schedule_work(&rtlpriv->works.lps_leave_work);
614614
}
615615
}
616616

@@ -736,7 +736,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
736736
if (((rtlpriv->link_info.num_rx_inperiod +
737737
rtlpriv->link_info.num_tx_inperiod) > 8) ||
738738
(rtlpriv->link_info.num_rx_inperiod > 2)) {
739-
tasklet_schedule(&rtlpriv->works.ips_leave_tasklet);
739+
schedule_work(&rtlpriv->works.lps_leave_work);
740740
}
741741

742742
dev_kfree_skb_any(skb);
@@ -903,11 +903,6 @@ static void _rtl_pci_irq_tasklet(struct ieee80211_hw *hw)
903903
_rtl_pci_tx_chk_waitq(hw);
904904
}
905905

906-
static void _rtl_pci_ips_leave_tasklet(struct ieee80211_hw *hw)
907-
{
908-
rtl_lps_leave(hw);
909-
}
910-
911906
static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw)
912907
{
913908
struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -945,6 +940,15 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw)
945940
return;
946941
}
947942

943+
static void rtl_lps_leave_work_callback(struct work_struct *work)
944+
{
945+
struct rtl_works *rtlworks =
946+
container_of(work, struct rtl_works, lps_leave_work);
947+
struct ieee80211_hw *hw = rtlworks->hw;
948+
949+
rtl_lps_leave(hw);
950+
}
951+
948952
static void _rtl_pci_init_trx_var(struct ieee80211_hw *hw)
949953
{
950954
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
@@ -1006,9 +1010,7 @@ static void _rtl_pci_init_struct(struct ieee80211_hw *hw,
10061010
tasklet_init(&rtlpriv->works.irq_prepare_bcn_tasklet,
10071011
(void (*)(unsigned long))_rtl_pci_prepare_bcn_tasklet,
10081012
(unsigned long)hw);
1009-
tasklet_init(&rtlpriv->works.ips_leave_tasklet,
1010-
(void (*)(unsigned long))_rtl_pci_ips_leave_tasklet,
1011-
(unsigned long)hw);
1013+
INIT_WORK(&rtlpriv->works.lps_leave_work, rtl_lps_leave_work_callback);
10121014
}
10131015

10141016
static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw,
@@ -1478,7 +1480,7 @@ static void rtl_pci_deinit(struct ieee80211_hw *hw)
14781480

14791481
synchronize_irq(rtlpci->pdev->irq);
14801482
tasklet_kill(&rtlpriv->works.irq_tasklet);
1481-
tasklet_kill(&rtlpriv->works.ips_leave_tasklet);
1483+
cancel_work_sync(&rtlpriv->works.lps_leave_work);
14821484

14831485
flush_workqueue(rtlpriv->works.rtl_wq);
14841486
destroy_workqueue(rtlpriv->works.rtl_wq);
@@ -1553,7 +1555,7 @@ static void rtl_pci_stop(struct ieee80211_hw *hw)
15531555
set_hal_stop(rtlhal);
15541556

15551557
rtlpriv->cfg->ops->disable_interrupt(hw);
1556-
tasklet_kill(&rtlpriv->works.ips_leave_tasklet);
1558+
cancel_work_sync(&rtlpriv->works.lps_leave_work);
15571559

15581560
spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags);
15591561
while (ppsc->rfchange_inprogress) {

drivers/net/wireless/rtlwifi/wifi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,8 @@ struct rtl_works {
15761576
/* For SW LPS */
15771577
struct delayed_work ps_work;
15781578
struct delayed_work ps_rfon_wq;
1579-
struct tasklet_struct ips_leave_tasklet;
1579+
1580+
struct work_struct lps_leave_work;
15801581
};
15811582

15821583
struct rtl_debug {

0 commit comments

Comments
 (0)