From: Emil Renner Berthing <kernel@esmil.dk>
To: linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Cc: Emil Renner Berthing <kernel@esmil.dk>,
Ping-Ke Shih <pkshih@realtek.com>,
Kalle Valo <kvalo@codeaurora.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Allen Pais <allen.lkml@gmail.com>,
Romain Perier <romain.perier@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] rtlwifi: use tasklet_setup to initialize rx_work_tasklet
Date: Tue, 26 Jan 2021 18:15:50 +0100 [thread overview]
Message-ID: <20210126171550.3066-1-kernel@esmil.dk> (raw)
In commit d3ccc14dfe95 most of the tasklets in this driver was
updated to the new API. However for the rx_work_tasklet only the
type of the callback was changed from
void _rtl_rx_work(unsigned long data)
to
void _rtl_rx_work(struct tasklet_struct *t).
The initialization of rx_work_tasklet was still open-coded and the
function pointer just cast into the old type, and hence nothing sets
rx_work_tasklet.use_callback = true and the callback was still called as
t->func(t->data);
with uninitialized/zero t->data.
Commit 6b8c7574a5f8 changed the casting of _rtl_rx_work a bit and
initialized t->data to a pointer to the tasklet cast to an unsigned
long.
This way calling t->func(t->data) might actually work through all the
casting, but it still doesn't update the code to use the new tasklet
API.
Let's use the new tasklet_setup to initialize rx_work_tasklet properly
and set rx_work_tasklet.use_callback = true so that the callback is
called as
t->callback(t);
without all the casting.
Fixes: 6b8c7574a5f8 ("rtlwifi: fix build warning")
Fixes: d3ccc14dfe95 ("rtlwifi/rtw88: convert tasklets to use new tasklet_setup() API")
Signed-off-by: Emil Renner Berthing <kernel@esmil.dk>
---
drivers/net/wireless/realtek/rtlwifi/usb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c
index d62b87f010c9..6c5e242b1bc5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/usb.c
+++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
@@ -310,8 +310,7 @@ static int _rtl_usb_init_rx(struct ieee80211_hw *hw)
init_usb_anchor(&rtlusb->rx_cleanup_urbs);
skb_queue_head_init(&rtlusb->rx_queue);
- rtlusb->rx_work_tasklet.func = (void(*))_rtl_rx_work;
- rtlusb->rx_work_tasklet.data = (unsigned long)&rtlusb->rx_work_tasklet;
+ tasklet_setup(&rtlusb->rx_work_tasklet, _rtl_rx_work);
return 0;
}
--
2.30.0
next reply other threads:[~2021-01-27 0:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-26 17:15 Emil Renner Berthing [this message]
2021-01-27 14:47 ` [PATCH] rtlwifi: use tasklet_setup to initialize rx_work_tasklet Willem de Bruijn
2021-01-27 15:19 ` Kalle Valo
2021-01-27 15:25 ` Emil Renner Berthing
2021-01-27 15:33 ` Kalle Valo
2021-01-27 16:01 ` Emil Renner Berthing
2021-02-08 10:38 ` Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210126171550.3066-1-kernel@esmil.dk \
--to=kernel@esmil.dk \
--cc=allen.lkml@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pkshih@realtek.com \
--cc=romain.perier@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox