Re: [PATCH rtw-next v5 2/4] wifi: rtw88: sdio: Track running state and cancel TX worker on stop
From: Luka Gejak
Date: Tue Oct 13 2026 - 03:06:40 EST
On Sun Oct 11, 2026 at 10:07 PM UTC, Alastair D'Silva wrote:
> When rtw_sdio_stop() disables interrupts, in-flight interrupt handlers or
> delayed TX work may still run against a powered-down device.
>
> Track the operational state in rtwsdio->running with an irq_lock mutex
> (similar to PCI), check it at the entry of rtw_sdio_handle_interrupt()
> and rtw_sdio_tx_handler(), serialize state transitions in rtw_sdio_start()
> and rtw_sdio_stop() under sdio_claim_host() and irq_lock, and cancel the
> TX worker synchronously in rtw_sdio_stop().
>
> Fixes: 28eaf7971a20 ("wifi: rtw88: sdio: add TX back-pressure and retry on page starvation")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: LLM
> Signed-off-by: Alastair D'Silva <alastair@xxxxxxxxxxx>
> ---
> drivers/net/wireless/realtek/rtw88/sdio.c | 46 +++++++++++++++++++++--
> drivers/net/wireless/realtek/rtw88/sdio.h | 3 ++
> 2 files changed, 45 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c
> index e39284b71837..7d4f17e96648 100644
> --- a/drivers/net/wireless/realtek/rtw88/sdio.c
> +++ b/drivers/net/wireless/realtek/rtw88/sdio.c
[...]
> +static void rtw_sdio_deinit(struct rtw_dev *rtwdev)
> +{
> + struct rtw_sdio *rtwsdio = (struct rtw_sdio *)rtwdev->priv;
> +
> + mutex_destroy(&rtwsdio->irq_lock);
> +}
> +
[...]
> @@ -1843,7 +1879,8 @@ int rtw_sdio_probe(struct sdio_func *sdio_func,
> rtw_sdio_free_irq(rtwdev, sdio_func);
> err_destroy_txwq:
> rtw_sdio_deinit_tx(rtwdev);
> -err_sdio_declaim:
> +err_deinit:
> + rtw_sdio_deinit(rtwdev);
> rtw_sdio_declaim(rtwdev, sdio_func);
One nit: The rename takes every failure that lands on err_destroy_txwq
(rtw_chip_info_setup(), rtw_sdio_request_irq(), and rtw_register_hw() through
err_free_irq) past the new err_deinit, so rtw_sdio_deinit() runs only when
rtw_sdio_init_tx() itself failed. Nothing to fix while the helper is a
mutex_destroy() alone. If it ever grows, that path would miss it, so I would
either let those failures fall through to err_deinit or drop the helper.
Best regards,
Luka Gejak