[PATCH wifi-next] wifi: ath10k: sdio: Use pm_sleep_ptr instead of #ifdef CONFIG_PM_SLEEP

Uwe Kleine-König u.kleine-koenig at baylibre.com
Fri Dec 19 09:18:45 PST 2025


On Fri, Dec 19, 2025 at 07:12:30AM -0800, Jeff Johnson wrote:
> On 12/19/2025 2:32 AM, Baochen Qiang wrote:
> > 
> > 
> > On 12/17/2025 7:19 PM, Uwe Kleine-König wrote:
> >> This increases build coverage and removes an ugly #ifdef block.
> >>
> >> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at baylibre.com>
> >> ---
> >> Hello,
> >>
> >> I found the patch opportunity while looking in this driver for a different
> >> reason.
> >>
> >> Best regards
> >> Uwe
> >>
> >>  drivers/net/wireless/ath/ath10k/sdio.c | 12 +-----------
> >>  1 file changed, 1 insertion(+), 11 deletions(-)
> >>
> >> diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c
> >> index c06d50db40b8..3efe744c0c96 100644
> >> --- a/drivers/net/wireless/ath/ath10k/sdio.c
> >> +++ b/drivers/net/wireless/ath/ath10k/sdio.c
> >> @@ -2136,8 +2136,6 @@ static const struct ath10k_hif_ops ath10k_sdio_hif_ops = {
> >>  #endif
> >>  };
> >>  
> >> -#ifdef CONFIG_PM_SLEEP
> >> -
> >>  /* Empty handlers so that mmc subsystem doesn't remove us entirely during
> >>   * suspend. We instead follow cfg80211 suspend/resume handlers.
> >>   */
> >> @@ -2175,14 +2173,6 @@ static int ath10k_sdio_pm_resume(struct device *device)
> >>  static SIMPLE_DEV_PM_OPS(ath10k_sdio_pm_ops, ath10k_sdio_pm_suspend,
> >>  			 ath10k_sdio_pm_resume);
> >>  
> >> -#define ATH10K_SDIO_PM_OPS (&ath10k_sdio_pm_ops)
> >> -
> >> -#else
> >> -
> >> -#define ATH10K_SDIO_PM_OPS NULL
> >> -
> >> -#endif /* CONFIG_PM_SLEEP */
> >> -
> >>  static int ath10k_sdio_napi_poll(struct napi_struct *ctx, int budget)
> >>  {
> >>  	struct ath10k *ar = container_of(ctx, struct ath10k, napi);
> >> @@ -2668,7 +2658,7 @@ static struct sdio_driver ath10k_sdio_driver = {
> >>  	.probe = ath10k_sdio_probe,
> >>  	.remove = ath10k_sdio_remove,
> >>  	.drv = {
> >> -		.pm = ATH10K_SDIO_PM_OPS,
> >> +		.pm = pm_sleep_ptr(&ath10k_sdio_pm_ops),
> >>  	},
> >>  };
> >>  module_sdio_driver(ath10k_sdio_driver);
> >>
> > 
> > won't this cause defined-but-not-used warnings if CONFIG_PM_SLEEP not enabled?
> 
> no because SIMPLE_DEV_PM_OPS() adds __maybe_unused to the dev_pm_ops

I would have claimed no because

	pm_sleep_ptr(&ath10k_sdio_pm_ops)

expands to

	0 ? &ath10k_sdio_pm_ops : NULL

if CONFIG_PM_SLEEP is disabled which the compiler counts as usage and
thus doesn't throw that warning.

Best regards
Uwe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/ath10k/attachments/20251219/6bed1074/attachment-0001.sig>


More information about the ath10k mailing list