[PATCH] mmc: esdhc-imx: convert to modern PM_OPS

Bough Chen haibo.chen at nxp.com
Thu Apr 10 19:45:10 PDT 2025


> -----Original Message-----
> From: Arnd Bergmann <arnd at kernel.org>
> Sent: 2025年4月10日 22:09
> To: Adrian Hunter <adrian.hunter at intel.com>; Bough Chen
> <haibo.chen at nxp.com>; Ulf Hansson <ulf.hansson at linaro.org>; Shawn Guo
> <shawnguo at kernel.org>; Sascha Hauer <s.hauer at pengutronix.de>; Luke
> Wang <ziniu.wang_1 at nxp.com>
> Cc: Arnd Bergmann <arnd at arndb.de>; Pengutronix Kernel Team
> <kernel at pengutronix.de>; Fabio Estevam <festevam at gmail.com>; Ciprian
> Marian Costea (OSS) <ciprianmarian.costea at oss.nxp.com>; Josua Mayer
> <josua at solid-run.com>; imx at lists.linux.dev; linux-mmc at vger.kernel.org;
> dl-S32 <S32 at nxp.com>; linux-arm-kernel at lists.infradead.org;
> linux-kernel at vger.kernel.org
> Subject: [PATCH] mmc: esdhc-imx: convert to modern PM_OPS
> 
> From: Arnd Bergmann <arnd at arndb.de>
> 
> Two newly added functions are unused in configurations without power
> management support:
> 
> drivers/mmc/host/sdhci-esdhc-imx.c:1586:13: error: unused function
> 'sdhc_esdhc_tuning_save' [-Werror,-Wunused-function]
>  1586 | static void sdhc_esdhc_tuning_save(struct sdhci_host *host)
>       |             ^~~~~~~~~~~~~~~~~~~~~~
> drivers/mmc/host/sdhci-esdhc-imx.c:1608:13: error: unused function
> 'sdhc_esdhc_tuning_restore' [-Werror,-Wunused-function]
>  1608 | static void sdhc_esdhc_tuning_restore(struct sdhci_host *host)
>       |             ^~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Remove the #ifdef checks and instead use the better macros that silently drop
> the unused functions when PM is disabled.

Hi Arnd,

Thanks for this catching.

How about add __maybe_unused to define this tuning_save/retore function?


Regards
Haibo Chen
> 
> Fixes: 3d1eea493894 ("mmc: sdhci-esdhc-imx: Save tuning value when card
> stays powered in suspend")
> Signed-off-by: Arnd Bergmann <arnd at arndb.de>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
> b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 7e8addaed697..8742622da55a 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1942,7 +1942,6 @@ static void sdhci_esdhc_imx_remove(struct
> platform_device *pdev)
>  	sdhci_pltfm_free(pdev);
>  }
> 
> -#ifdef CONFIG_PM_SLEEP
>  static int sdhci_esdhc_suspend(struct device *dev)  {
>  	struct sdhci_host *host = dev_get_drvdata(dev); @@ -2021,9 +2020,7 @@
> static int sdhci_esdhc_resume(struct device *dev)
> 
>  	return ret;
>  }
> -#endif
> 
> -#ifdef CONFIG_PM
>  static int sdhci_esdhc_runtime_suspend(struct device *dev)  {
>  	struct sdhci_host *host = dev_get_drvdata(dev); @@ -2103,11 +2100,10
> @@ static int sdhci_esdhc_runtime_resume(struct device *dev)
>  		cpu_latency_qos_remove_request(&imx_data->pm_qos_req);
>  	return err;
>  }
> -#endif
> 
>  static const struct dev_pm_ops sdhci_esdhc_pmops = {
> -	SET_SYSTEM_SLEEP_PM_OPS(sdhci_esdhc_suspend, sdhci_esdhc_resume)
> -	SET_RUNTIME_PM_OPS(sdhci_esdhc_runtime_suspend,
> +	SYSTEM_SLEEP_PM_OPS(sdhci_esdhc_suspend, sdhci_esdhc_resume)
> +	RUNTIME_PM_OPS(sdhci_esdhc_runtime_suspend,
>  				sdhci_esdhc_runtime_resume, NULL)
>  };
> 
> --
> 2.39.5



More information about the linux-arm-kernel mailing list