From 49391bf28d98a48013fd31d8f30cb25b0c4cfdd7 Mon Sep 17 00:00:00 2001 From: Allen Pais Date: Wed, 16 Sep 2020 11:50:54 +0530 Subject: [PATCH] staging: rtl8192e: convert tasklets to use new tasklet_setup() API In preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly. Signed-off-by: Romain Perier Signed-off-by: Allen Pais Link: https://lore.kernel.org/r/20200916062054.58084-1-allen.lkml@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 27 ++++++++++---------- drivers/staging/rtl8192e/rtllib_softmac.c | 6 ++--- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index fac58eebf263..663675efcfe4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -82,8 +82,8 @@ static int _rtl92e_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); static void _rtl92e_tx_cmd(struct net_device *dev, struct sk_buff *skb); static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb); static short _rtl92e_pci_initdescring(struct net_device *dev); -static void _rtl92e_irq_tx_tasklet(unsigned long data); -static void _rtl92e_irq_rx_tasklet(unsigned long data); +static void _rtl92e_irq_tx_tasklet(struct tasklet_struct *t); +static void _rtl92e_irq_rx_tasklet(struct tasklet_struct *t); static void _rtl92e_cancel_deferred_work(struct r8192_priv *priv); static int _rtl92e_up(struct net_device *dev, bool is_silent_reset); static int _rtl92e_try_up(struct net_device *dev); @@ -517,9 +517,10 @@ static int _rtl92e_handle_assoc_response(struct net_device *dev, return 0; } -static void _rtl92e_prepare_beacon(unsigned long data) +static void _rtl92e_prepare_beacon(struct tasklet_struct *t) { - struct r8192_priv *priv = (struct r8192_priv *)data; + struct r8192_priv *priv = from_tasklet(priv, t, + irq_prepare_beacon_tasklet); struct net_device *dev = priv->rtllib->dev; struct sk_buff *pskb = NULL, *pnewskb = NULL; struct cb_desc *tcb_desc = NULL; @@ -1009,12 +1010,10 @@ static void _rtl92e_init_priv_task(struct net_device *dev) (void *)rtl92e_hw_wakeup_wq, dev); INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_sleep_wq, (void *)rtl92e_hw_sleep_wq, dev); - tasklet_init(&priv->irq_rx_tasklet, _rtl92e_irq_rx_tasklet, - (unsigned long)priv); - tasklet_init(&priv->irq_tx_tasklet, _rtl92e_irq_tx_tasklet, - (unsigned long)priv); - tasklet_init(&priv->irq_prepare_beacon_tasklet, _rtl92e_prepare_beacon, - (unsigned long)priv); + tasklet_setup(&priv->irq_rx_tasklet, _rtl92e_irq_rx_tasklet); + tasklet_setup(&priv->irq_tx_tasklet, _rtl92e_irq_tx_tasklet); + tasklet_setup(&priv->irq_prepare_beacon_tasklet, + _rtl92e_prepare_beacon); } static short _rtl92e_get_channel_map(struct net_device *dev) @@ -2109,16 +2108,16 @@ static void _rtl92e_tx_resume(struct net_device *dev) } } -static void _rtl92e_irq_tx_tasklet(unsigned long data) +static void _rtl92e_irq_tx_tasklet(struct tasklet_struct *t) { - struct r8192_priv *priv = (struct r8192_priv *)data; + struct r8192_priv *priv = from_tasklet(priv, t, irq_tx_tasklet); _rtl92e_tx_resume(priv->rtllib->dev); } -static void _rtl92e_irq_rx_tasklet(unsigned long data) +static void _rtl92e_irq_rx_tasklet(struct tasklet_struct *t) { - struct r8192_priv *priv = (struct r8192_priv *)data; + struct r8192_priv *priv = from_tasklet(priv, t, irq_rx_tasklet); _rtl92e_rx_normal(priv->rtllib->dev); diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 6e2f620afd14..2c752ba5a802 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2044,9 +2044,9 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time) } -static inline void rtllib_sta_ps(unsigned long data) +static inline void rtllib_sta_ps(struct tasklet_struct *t) { - struct rtllib_device *ieee = (struct rtllib_device *)data; + struct rtllib_device *ieee = from_tasklet(ieee, t, ps_task); u64 time; short sleep; unsigned long flags, flags2; @@ -3028,7 +3028,7 @@ void rtllib_softmac_init(struct rtllib_device *ieee) spin_lock_init(&ieee->mgmt_tx_lock); spin_lock_init(&ieee->beacon_lock); - tasklet_init(&ieee->ps_task, rtllib_sta_ps, (unsigned long)ieee); + tasklet_setup(&ieee->ps_task, rtllib_sta_ps); }