diff mbox series

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

Message ID 20250411085932.1902662-1-arnd@kernel.org
State New
Headers show
Series [v2] mmc: esdhc-imx: convert to modern PM_OPS | expand

Commit Message

Arnd Bergmann April 11, 2025, 8:59 a.m. UTC
From: Arnd Bergmann <arnd@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. This also
requires using pm_ptr() to eliminate both the runtime and pm_sleep
operations.

Fixes: 3d1eea493894 ("mmc: sdhci-esdhc-imx: Save tuning value when card stays powered in suspend")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2: add pm_ptr()
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Luke Wang April 11, 2025, 11:02 a.m. UTC | #1
Tested-by: Luke Wang <ziniu.wang_1@nxp.com>

> -----Original Message-----
> From: Arnd Bergmann <arnd@kernel.org>
> Sent: Friday, April 11, 2025 4:59 PM
> To: Bough Chen <haibo.chen@nxp.com>; Adrian Hunter
> <adrian.hunter@intel.com>; Ulf Hansson <ulf.hansson@linaro.org>; Shawn
> Guo <shawnguo@kernel.org>; Sascha Hauer <s.hauer@pengutronix.de>;
> Luke Wang <ziniu.wang_1@nxp.com>
> Cc: Arnd Bergmann <arnd@arndb.de>; Pengutronix Kernel Team
> <kernel@pengutronix.de>; Fabio Estevam <festevam@gmail.com>; Josua
> Mayer <josua@solid-run.com>; imx@lists.linux.dev; linux-
> mmc@vger.kernel.org; dl-S32 <S32@nxp.com>; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: [EXT] [PATCH] [v2] mmc: esdhc-imx: convert to modern PM_OPS
> 
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
> 
> 
> From: Arnd Bergmann <arnd@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. This also
> requires using pm_ptr() to eliminate both the runtime and pm_sleep
> operations.
> 
> Fixes: 3d1eea493894 ("mmc: sdhci-esdhc-imx: Save tuning value when card
> stays powered in suspend")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> v2: add pm_ptr()
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-
> esdhc-imx.c
> index 7e8addaed697..3c2e50d0260d 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)
>  };
> 
> @@ -2116,7 +2112,7 @@ static struct platform_driver
> sdhci_esdhc_imx_driver = {
>                 .name   = "sdhci-esdhc-imx",
>                 .probe_type = PROBE_PREFER_ASYNCHRONOUS,
>                 .of_match_table = imx_esdhc_dt_ids,
> -               .pm     = &sdhci_esdhc_pmops,
> +               .pm     = pm_ptr(&sdhci_esdhc_pmops),
>         },
>         .probe          = sdhci_esdhc_imx_probe,
>         .remove         = sdhci_esdhc_imx_remove,
> --
> 2.39.5
Luke Wang April 14, 2025, 6:49 a.m. UTC | #2
> -----Original Message-----
> From: Adrian Hunter <adrian.hunter@intel.com>
> Sent: Friday, April 11, 2025 7:47 PM
> To: Luke Wang <ziniu.wang_1@nxp.com>; Arnd Bergmann
> <arnd@kernel.org>; Bough Chen <haibo.chen@nxp.com>; Ulf Hansson
> <ulf.hansson@linaro.org>; Shawn Guo <shawnguo@kernel.org>; Sascha
> Hauer <s.hauer@pengutronix.de>
> Cc: Arnd Bergmann <arnd@arndb.de>; Pengutronix Kernel Team
> <kernel@pengutronix.de>; Fabio Estevam <festevam@gmail.com>; Josua
> Mayer <josua@solid-run.com>; imx@lists.linux.dev; linux-
> mmc@vger.kernel.org; dl-S32 <S32@nxp.com>; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: Re: [EXT] [PATCH] [v2] mmc: esdhc-imx: convert to modern PM_OPS
> 
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
> 
> 
> On 11/04/25 14:02, Luke Wang wrote:
> > Tested-by: Luke Wang <ziniu.wang_1@nxp.com>
> 
> Did you test with "# CONFIG_PM is not set"? Because FWIW
> it does not work for me on x86 with CONFIG_COMPILE_TEST=y

Hi Adrian

Sorry, I didn't test with "# CONFIG_PM is not set". I did the functional test and it work fine.
If # CONFIG_PM is not set, there indeed be problems with compilation.

Regard
Luke
kernel test robot April 14, 2025, 8:08 a.m. UTC | #3
Hi Arnd,

kernel test robot noticed the following build errors:

[auto build test ERROR on v6.15-rc2]
[also build test ERROR on linus/master next-20250411]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Arnd-Bergmann/mmc-esdhc-imx-convert-to-modern-PM_OPS/20250414-092134
base:   v6.15-rc2
patch link:    https://lore.kernel.org/r/20250411085932.1902662-1-arnd%40kernel.org
patch subject: [PATCH] [v2] mmc: esdhc-imx: convert to modern PM_OPS
config: i386-buildonly-randconfig-006-20250414 (https://download.01.org/0day-ci/archive/20250414/202504141551.hdiQj4os-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250414/202504141551.hdiQj4os-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504141551.hdiQj4os-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/mmc/host/sdhci-esdhc-imx.c: In function 'sdhci_esdhc_suspend':
>> drivers/mmc/host/sdhci-esdhc-imx.c:1902:15: error: implicit declaration of function 'sdhci_suspend_host'; did you mean 'sdhci_add_host'? [-Werror=implicit-function-declaration]
    1902 |         ret = sdhci_suspend_host(host);
         |               ^~~~~~~~~~~~~~~~~~
         |               sdhci_add_host
   drivers/mmc/host/sdhci-esdhc-imx.c: In function 'sdhci_esdhc_resume':
>> drivers/mmc/host/sdhci-esdhc-imx.c:1927:15: error: implicit declaration of function 'sdhci_resume_host'; did you mean 'sdhci_remove_host'? [-Werror=implicit-function-declaration]
    1927 |         ret = sdhci_resume_host(host);
         |               ^~~~~~~~~~~~~~~~~
         |               sdhci_remove_host
   drivers/mmc/host/sdhci-esdhc-imx.c: In function 'sdhci_esdhc_runtime_suspend':
>> drivers/mmc/host/sdhci-esdhc-imx.c:1953:15: error: implicit declaration of function 'sdhci_runtime_suspend_host' [-Werror=implicit-function-declaration]
    1953 |         ret = sdhci_runtime_suspend_host(host);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mmc/host/sdhci-esdhc-imx.c: In function 'sdhci_esdhc_runtime_resume':
>> drivers/mmc/host/sdhci-esdhc-imx.c:1999:15: error: implicit declaration of function 'sdhci_runtime_resume_host' [-Werror=implicit-function-declaration]
    1999 |         err = sdhci_runtime_resume_host(host, 0);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +1902 drivers/mmc/host/sdhci-esdhc-imx.c

95f25efe0ce22e Wolfram Sang      2010-10-15  1879  
04143fbaeb5799 Dong Aisheng      2016-07-12  1880  static int sdhci_esdhc_suspend(struct device *dev)
04143fbaeb5799 Dong Aisheng      2016-07-12  1881  {
3e3274ab9ff37f Ulf Hansson       2016-07-27  1882  	struct sdhci_host *host = dev_get_drvdata(dev);
a26a4f1baca55a Haibo Chen        2020-02-19  1883  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
a26a4f1baca55a Haibo Chen        2020-02-19  1884  	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
bb6e358169bf62 BOUGH CHEN        2019-01-07  1885  	int ret;
bb6e358169bf62 BOUGH CHEN        2019-01-07  1886  
bb6e358169bf62 BOUGH CHEN        2019-01-07  1887  	if (host->mmc->caps2 & MMC_CAP2_CQE) {
bb6e358169bf62 BOUGH CHEN        2019-01-07  1888  		ret = cqhci_suspend(host->mmc);
bb6e358169bf62 BOUGH CHEN        2019-01-07  1889  		if (ret)
bb6e358169bf62 BOUGH CHEN        2019-01-07  1890  			return ret;
bb6e358169bf62 BOUGH CHEN        2019-01-07  1891  	}
3e3274ab9ff37f Ulf Hansson       2016-07-27  1892  
a26a4f1baca55a Haibo Chen        2020-02-19  1893  	if ((imx_data->socdata->flags & ESDHC_FLAG_STATE_LOST_IN_LPMODE) &&
a26a4f1baca55a Haibo Chen        2020-02-19  1894  		(host->tuning_mode != SDHCI_TUNING_MODE_1)) {
a26a4f1baca55a Haibo Chen        2020-02-19  1895  		mmc_retune_timer_stop(host->mmc);
a26a4f1baca55a Haibo Chen        2020-02-19  1896  		mmc_retune_needed(host->mmc);
a26a4f1baca55a Haibo Chen        2020-02-19  1897  	}
a26a4f1baca55a Haibo Chen        2020-02-19  1898  
d38dcad4e7b48f Adrian Hunter     2017-03-20  1899  	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
d38dcad4e7b48f Adrian Hunter     2017-03-20  1900  		mmc_retune_needed(host->mmc);
d38dcad4e7b48f Adrian Hunter     2017-03-20  1901  
af8fade4bd7bc7 Haibo Chen        2020-02-19 @1902  	ret = sdhci_suspend_host(host);
f6140462611308 Haibo Chen        2020-05-27  1903  	if (ret)
f6140462611308 Haibo Chen        2020-05-27  1904  		return ret;
f6140462611308 Haibo Chen        2020-05-27  1905  
f6140462611308 Haibo Chen        2020-05-27  1906  	ret = pinctrl_pm_select_sleep_state(dev);
f6140462611308 Haibo Chen        2020-05-27  1907  	if (ret)
f6140462611308 Haibo Chen        2020-05-27  1908  		return ret;
f6140462611308 Haibo Chen        2020-05-27  1909  
f6140462611308 Haibo Chen        2020-05-27  1910  	ret = mmc_gpio_set_cd_wake(host->mmc, true);
af8fade4bd7bc7 Haibo Chen        2020-02-19  1911  
af8fade4bd7bc7 Haibo Chen        2020-02-19  1912  	return ret;
04143fbaeb5799 Dong Aisheng      2016-07-12  1913  }
04143fbaeb5799 Dong Aisheng      2016-07-12  1914  
04143fbaeb5799 Dong Aisheng      2016-07-12  1915  static int sdhci_esdhc_resume(struct device *dev)
04143fbaeb5799 Dong Aisheng      2016-07-12  1916  {
cc17e1294b8aeb Dong Aisheng      2016-07-12  1917  	struct sdhci_host *host = dev_get_drvdata(dev);
bb6e358169bf62 BOUGH CHEN        2019-01-07  1918  	int ret;
cc17e1294b8aeb Dong Aisheng      2016-07-12  1919  
af8fade4bd7bc7 Haibo Chen        2020-02-19  1920  	ret = pinctrl_pm_select_default_state(dev);
af8fade4bd7bc7 Haibo Chen        2020-02-19  1921  	if (ret)
af8fade4bd7bc7 Haibo Chen        2020-02-19  1922  		return ret;
af8fade4bd7bc7 Haibo Chen        2020-02-19  1923  
19dbfdd3d5152d Dong Aisheng      2016-07-12  1924  	/* re-initialize hw state in case it's lost in low power mode */
19dbfdd3d5152d Dong Aisheng      2016-07-12  1925  	sdhci_esdhc_imx_hwinit(host);
cc17e1294b8aeb Dong Aisheng      2016-07-12  1926  
bb6e358169bf62 BOUGH CHEN        2019-01-07 @1927  	ret = sdhci_resume_host(host);
bb6e358169bf62 BOUGH CHEN        2019-01-07  1928  	if (ret)
bb6e358169bf62 BOUGH CHEN        2019-01-07  1929  		return ret;
bb6e358169bf62 BOUGH CHEN        2019-01-07  1930  
bb6e358169bf62 BOUGH CHEN        2019-01-07  1931  	if (host->mmc->caps2 & MMC_CAP2_CQE)
bb6e358169bf62 BOUGH CHEN        2019-01-07  1932  		ret = cqhci_resume(host->mmc);
bb6e358169bf62 BOUGH CHEN        2019-01-07  1933  
f6140462611308 Haibo Chen        2020-05-27  1934  	if (!ret)
f6140462611308 Haibo Chen        2020-05-27  1935  		ret = mmc_gpio_set_cd_wake(host->mmc, false);
f6140462611308 Haibo Chen        2020-05-27  1936  
bb6e358169bf62 BOUGH CHEN        2019-01-07  1937  	return ret;
04143fbaeb5799 Dong Aisheng      2016-07-12  1938  }
04143fbaeb5799 Dong Aisheng      2016-07-12  1939  
89d7e5c131228a Dong Aisheng      2013-11-04  1940  static int sdhci_esdhc_runtime_suspend(struct device *dev)
89d7e5c131228a Dong Aisheng      2013-11-04  1941  {
89d7e5c131228a Dong Aisheng      2013-11-04  1942  	struct sdhci_host *host = dev_get_drvdata(dev);
89d7e5c131228a Dong Aisheng      2013-11-04  1943  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
070e6d3ff5a696 Jisheng Zhang     2016-02-16  1944  	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
89d7e5c131228a Dong Aisheng      2013-11-04  1945  	int ret;
89d7e5c131228a Dong Aisheng      2013-11-04  1946  
bb6e358169bf62 BOUGH CHEN        2019-01-07  1947  	if (host->mmc->caps2 & MMC_CAP2_CQE) {
bb6e358169bf62 BOUGH CHEN        2019-01-07  1948  		ret = cqhci_suspend(host->mmc);
bb6e358169bf62 BOUGH CHEN        2019-01-07  1949  		if (ret)
bb6e358169bf62 BOUGH CHEN        2019-01-07  1950  			return ret;
bb6e358169bf62 BOUGH CHEN        2019-01-07  1951  	}
bb6e358169bf62 BOUGH CHEN        2019-01-07  1952  
89d7e5c131228a Dong Aisheng      2013-11-04 @1953  	ret = sdhci_runtime_suspend_host(host);
371d39fabcebc3 Michael Trimarchi 2018-01-04  1954  	if (ret)
371d39fabcebc3 Michael Trimarchi 2018-01-04  1955  		return ret;
89d7e5c131228a Dong Aisheng      2013-11-04  1956  
d38dcad4e7b48f Adrian Hunter     2017-03-20  1957  	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
d38dcad4e7b48f Adrian Hunter     2017-03-20  1958  		mmc_retune_needed(host->mmc);
d38dcad4e7b48f Adrian Hunter     2017-03-20  1959  
3602785b341a95 Michael Trimarchi 2018-01-04  1960  	imx_data->actual_clock = host->mmc->actual_clock;
3602785b341a95 Michael Trimarchi 2018-01-04  1961  	esdhc_pltfm_set_clock(host, 0);
89d7e5c131228a Dong Aisheng      2013-11-04  1962  	clk_disable_unprepare(imx_data->clk_per);
89d7e5c131228a Dong Aisheng      2013-11-04  1963  	clk_disable_unprepare(imx_data->clk_ipg);
89d7e5c131228a Dong Aisheng      2013-11-04  1964  	clk_disable_unprepare(imx_data->clk_ahb);
89d7e5c131228a Dong Aisheng      2013-11-04  1965  
1c4989b000aeac BOUGH CHEN        2019-04-29  1966  	if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS)
d1b98305916bc0 Rafael J. Wysocki 2020-02-12  1967  		cpu_latency_qos_remove_request(&imx_data->pm_qos_req);
1c4989b000aeac BOUGH CHEN        2019-04-29  1968  
89d7e5c131228a Dong Aisheng      2013-11-04  1969  	return ret;
89d7e5c131228a Dong Aisheng      2013-11-04  1970  }
89d7e5c131228a Dong Aisheng      2013-11-04  1971  
89d7e5c131228a Dong Aisheng      2013-11-04  1972  static int sdhci_esdhc_runtime_resume(struct device *dev)
89d7e5c131228a Dong Aisheng      2013-11-04  1973  {
89d7e5c131228a Dong Aisheng      2013-11-04  1974  	struct sdhci_host *host = dev_get_drvdata(dev);
89d7e5c131228a Dong Aisheng      2013-11-04  1975  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
070e6d3ff5a696 Jisheng Zhang     2016-02-16  1976  	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  1977  	int err;
89d7e5c131228a Dong Aisheng      2013-11-04  1978  
1c4989b000aeac BOUGH CHEN        2019-04-29  1979  	if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS)
d1b98305916bc0 Rafael J. Wysocki 2020-02-12  1980  		cpu_latency_qos_add_request(&imx_data->pm_qos_req, 0);
1c4989b000aeac BOUGH CHEN        2019-04-29  1981  
5c11f1ffb02244 Haibo Chen        2020-02-19  1982  	if (imx_data->socdata->flags & ESDHC_FLAG_CLK_RATE_LOST_IN_PM_RUNTIME)
5c11f1ffb02244 Haibo Chen        2020-02-19  1983  		clk_set_rate(imx_data->clk_per, pltfm_host->clock);
5c11f1ffb02244 Haibo Chen        2020-02-19  1984  
a0ad3087586d09 Michael Trimarchi 2018-01-04  1985  	err = clk_prepare_enable(imx_data->clk_ahb);
a0ad3087586d09 Michael Trimarchi 2018-01-04  1986  	if (err)
1c4989b000aeac BOUGH CHEN        2019-04-29  1987  		goto remove_pm_qos_request;
a0ad3087586d09 Michael Trimarchi 2018-01-04  1988  
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  1989  	err = clk_prepare_enable(imx_data->clk_per);
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  1990  	if (err)
a0ad3087586d09 Michael Trimarchi 2018-01-04  1991  		goto disable_ahb_clk;
af5d2b7b0d24f5 Ulf Hansson       2019-09-08  1992  
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  1993  	err = clk_prepare_enable(imx_data->clk_ipg);
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  1994  	if (err)
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  1995  		goto disable_per_clk;
af5d2b7b0d24f5 Ulf Hansson       2019-09-08  1996  
3602785b341a95 Michael Trimarchi 2018-01-04  1997  	esdhc_pltfm_set_clock(host, imx_data->actual_clock);
a0ad3087586d09 Michael Trimarchi 2018-01-04  1998  
c6303c5d52d5ec Baolin Wang       2019-07-25 @1999  	err = sdhci_runtime_resume_host(host, 0);
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  2000  	if (err)
a0ad3087586d09 Michael Trimarchi 2018-01-04  2001  		goto disable_ipg_clk;
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  2002  
bb6e358169bf62 BOUGH CHEN        2019-01-07  2003  	if (host->mmc->caps2 & MMC_CAP2_CQE)
bb6e358169bf62 BOUGH CHEN        2019-01-07  2004  		err = cqhci_resume(host->mmc);
bb6e358169bf62 BOUGH CHEN        2019-01-07  2005  
bb6e358169bf62 BOUGH CHEN        2019-01-07  2006  	return err;
89d7e5c131228a Dong Aisheng      2013-11-04  2007  
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  2008  disable_ipg_clk:
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  2009  	clk_disable_unprepare(imx_data->clk_ipg);
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  2010  disable_per_clk:
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  2011  	clk_disable_unprepare(imx_data->clk_per);
a0ad3087586d09 Michael Trimarchi 2018-01-04  2012  disable_ahb_clk:
a0ad3087586d09 Michael Trimarchi 2018-01-04  2013  	clk_disable_unprepare(imx_data->clk_ahb);
1c4989b000aeac BOUGH CHEN        2019-04-29  2014  remove_pm_qos_request:
1c4989b000aeac BOUGH CHEN        2019-04-29  2015  	if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS)
d1b98305916bc0 Rafael J. Wysocki 2020-02-12  2016  		cpu_latency_qos_remove_request(&imx_data->pm_qos_req);
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  2017  	return err;
89d7e5c131228a Dong Aisheng      2013-11-04  2018  }
89d7e5c131228a Dong Aisheng      2013-11-04  2019
kernel test robot April 14, 2025, 10:32 a.m. UTC | #4
Hi Arnd,

kernel test robot noticed the following build errors:

[auto build test ERROR on v6.15-rc2]
[also build test ERROR on linus/master next-20250414]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Arnd-Bergmann/mmc-esdhc-imx-convert-to-modern-PM_OPS/20250414-092134
base:   v6.15-rc2
patch link:    https://lore.kernel.org/r/20250411085932.1902662-1-arnd%40kernel.org
patch subject: [PATCH] [v2] mmc: esdhc-imx: convert to modern PM_OPS
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250414/202504141852.82kZm4nO-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250414/202504141852.82kZm4nO-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504141852.82kZm4nO-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/mmc/host/sdhci-esdhc-imx.c:1902:8: error: call to undeclared function 'sdhci_suspend_host'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1902 |         ret = sdhci_suspend_host(host);
         |               ^
>> drivers/mmc/host/sdhci-esdhc-imx.c:1927:8: error: call to undeclared function 'sdhci_resume_host'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1927 |         ret = sdhci_resume_host(host);
         |               ^
   drivers/mmc/host/sdhci-esdhc-imx.c:1927:8: note: did you mean 'sdhci_remove_host'?
   drivers/mmc/host/sdhci.h:827:6: note: 'sdhci_remove_host' declared here
     827 | void sdhci_remove_host(struct sdhci_host *host, int dead);
         |      ^
>> drivers/mmc/host/sdhci-esdhc-imx.c:1953:8: error: call to undeclared function 'sdhci_runtime_suspend_host'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1953 |         ret = sdhci_runtime_suspend_host(host);
         |               ^
>> drivers/mmc/host/sdhci-esdhc-imx.c:1999:8: error: call to undeclared function 'sdhci_runtime_resume_host'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1999 |         err = sdhci_runtime_resume_host(host, 0);
         |               ^
   4 errors generated.


vim +/sdhci_suspend_host +1902 drivers/mmc/host/sdhci-esdhc-imx.c

95f25efe0ce22e Wolfram Sang      2010-10-15  1879  
04143fbaeb5799 Dong Aisheng      2016-07-12  1880  static int sdhci_esdhc_suspend(struct device *dev)
04143fbaeb5799 Dong Aisheng      2016-07-12  1881  {
3e3274ab9ff37f Ulf Hansson       2016-07-27  1882  	struct sdhci_host *host = dev_get_drvdata(dev);
a26a4f1baca55a Haibo Chen        2020-02-19  1883  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
a26a4f1baca55a Haibo Chen        2020-02-19  1884  	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
bb6e358169bf62 BOUGH CHEN        2019-01-07  1885  	int ret;
bb6e358169bf62 BOUGH CHEN        2019-01-07  1886  
bb6e358169bf62 BOUGH CHEN        2019-01-07  1887  	if (host->mmc->caps2 & MMC_CAP2_CQE) {
bb6e358169bf62 BOUGH CHEN        2019-01-07  1888  		ret = cqhci_suspend(host->mmc);
bb6e358169bf62 BOUGH CHEN        2019-01-07  1889  		if (ret)
bb6e358169bf62 BOUGH CHEN        2019-01-07  1890  			return ret;
bb6e358169bf62 BOUGH CHEN        2019-01-07  1891  	}
3e3274ab9ff37f Ulf Hansson       2016-07-27  1892  
a26a4f1baca55a Haibo Chen        2020-02-19  1893  	if ((imx_data->socdata->flags & ESDHC_FLAG_STATE_LOST_IN_LPMODE) &&
a26a4f1baca55a Haibo Chen        2020-02-19  1894  		(host->tuning_mode != SDHCI_TUNING_MODE_1)) {
a26a4f1baca55a Haibo Chen        2020-02-19  1895  		mmc_retune_timer_stop(host->mmc);
a26a4f1baca55a Haibo Chen        2020-02-19  1896  		mmc_retune_needed(host->mmc);
a26a4f1baca55a Haibo Chen        2020-02-19  1897  	}
a26a4f1baca55a Haibo Chen        2020-02-19  1898  
d38dcad4e7b48f Adrian Hunter     2017-03-20  1899  	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
d38dcad4e7b48f Adrian Hunter     2017-03-20  1900  		mmc_retune_needed(host->mmc);
d38dcad4e7b48f Adrian Hunter     2017-03-20  1901  
af8fade4bd7bc7 Haibo Chen        2020-02-19 @1902  	ret = sdhci_suspend_host(host);
f6140462611308 Haibo Chen        2020-05-27  1903  	if (ret)
f6140462611308 Haibo Chen        2020-05-27  1904  		return ret;
f6140462611308 Haibo Chen        2020-05-27  1905  
f6140462611308 Haibo Chen        2020-05-27  1906  	ret = pinctrl_pm_select_sleep_state(dev);
f6140462611308 Haibo Chen        2020-05-27  1907  	if (ret)
f6140462611308 Haibo Chen        2020-05-27  1908  		return ret;
f6140462611308 Haibo Chen        2020-05-27  1909  
f6140462611308 Haibo Chen        2020-05-27  1910  	ret = mmc_gpio_set_cd_wake(host->mmc, true);
af8fade4bd7bc7 Haibo Chen        2020-02-19  1911  
af8fade4bd7bc7 Haibo Chen        2020-02-19  1912  	return ret;
04143fbaeb5799 Dong Aisheng      2016-07-12  1913  }
04143fbaeb5799 Dong Aisheng      2016-07-12  1914  
04143fbaeb5799 Dong Aisheng      2016-07-12  1915  static int sdhci_esdhc_resume(struct device *dev)
04143fbaeb5799 Dong Aisheng      2016-07-12  1916  {
cc17e1294b8aeb Dong Aisheng      2016-07-12  1917  	struct sdhci_host *host = dev_get_drvdata(dev);
bb6e358169bf62 BOUGH CHEN        2019-01-07  1918  	int ret;
cc17e1294b8aeb Dong Aisheng      2016-07-12  1919  
af8fade4bd7bc7 Haibo Chen        2020-02-19  1920  	ret = pinctrl_pm_select_default_state(dev);
af8fade4bd7bc7 Haibo Chen        2020-02-19  1921  	if (ret)
af8fade4bd7bc7 Haibo Chen        2020-02-19  1922  		return ret;
af8fade4bd7bc7 Haibo Chen        2020-02-19  1923  
19dbfdd3d5152d Dong Aisheng      2016-07-12  1924  	/* re-initialize hw state in case it's lost in low power mode */
19dbfdd3d5152d Dong Aisheng      2016-07-12  1925  	sdhci_esdhc_imx_hwinit(host);
cc17e1294b8aeb Dong Aisheng      2016-07-12  1926  
bb6e358169bf62 BOUGH CHEN        2019-01-07 @1927  	ret = sdhci_resume_host(host);
bb6e358169bf62 BOUGH CHEN        2019-01-07  1928  	if (ret)
bb6e358169bf62 BOUGH CHEN        2019-01-07  1929  		return ret;
bb6e358169bf62 BOUGH CHEN        2019-01-07  1930  
bb6e358169bf62 BOUGH CHEN        2019-01-07  1931  	if (host->mmc->caps2 & MMC_CAP2_CQE)
bb6e358169bf62 BOUGH CHEN        2019-01-07  1932  		ret = cqhci_resume(host->mmc);
bb6e358169bf62 BOUGH CHEN        2019-01-07  1933  
f6140462611308 Haibo Chen        2020-05-27  1934  	if (!ret)
f6140462611308 Haibo Chen        2020-05-27  1935  		ret = mmc_gpio_set_cd_wake(host->mmc, false);
f6140462611308 Haibo Chen        2020-05-27  1936  
bb6e358169bf62 BOUGH CHEN        2019-01-07  1937  	return ret;
04143fbaeb5799 Dong Aisheng      2016-07-12  1938  }
04143fbaeb5799 Dong Aisheng      2016-07-12  1939  
89d7e5c131228a Dong Aisheng      2013-11-04  1940  static int sdhci_esdhc_runtime_suspend(struct device *dev)
89d7e5c131228a Dong Aisheng      2013-11-04  1941  {
89d7e5c131228a Dong Aisheng      2013-11-04  1942  	struct sdhci_host *host = dev_get_drvdata(dev);
89d7e5c131228a Dong Aisheng      2013-11-04  1943  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
070e6d3ff5a696 Jisheng Zhang     2016-02-16  1944  	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
89d7e5c131228a Dong Aisheng      2013-11-04  1945  	int ret;
89d7e5c131228a Dong Aisheng      2013-11-04  1946  
bb6e358169bf62 BOUGH CHEN        2019-01-07  1947  	if (host->mmc->caps2 & MMC_CAP2_CQE) {
bb6e358169bf62 BOUGH CHEN        2019-01-07  1948  		ret = cqhci_suspend(host->mmc);
bb6e358169bf62 BOUGH CHEN        2019-01-07  1949  		if (ret)
bb6e358169bf62 BOUGH CHEN        2019-01-07  1950  			return ret;
bb6e358169bf62 BOUGH CHEN        2019-01-07  1951  	}
bb6e358169bf62 BOUGH CHEN        2019-01-07  1952  
89d7e5c131228a Dong Aisheng      2013-11-04 @1953  	ret = sdhci_runtime_suspend_host(host);
371d39fabcebc3 Michael Trimarchi 2018-01-04  1954  	if (ret)
371d39fabcebc3 Michael Trimarchi 2018-01-04  1955  		return ret;
89d7e5c131228a Dong Aisheng      2013-11-04  1956  
d38dcad4e7b48f Adrian Hunter     2017-03-20  1957  	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
d38dcad4e7b48f Adrian Hunter     2017-03-20  1958  		mmc_retune_needed(host->mmc);
d38dcad4e7b48f Adrian Hunter     2017-03-20  1959  
3602785b341a95 Michael Trimarchi 2018-01-04  1960  	imx_data->actual_clock = host->mmc->actual_clock;
3602785b341a95 Michael Trimarchi 2018-01-04  1961  	esdhc_pltfm_set_clock(host, 0);
89d7e5c131228a Dong Aisheng      2013-11-04  1962  	clk_disable_unprepare(imx_data->clk_per);
89d7e5c131228a Dong Aisheng      2013-11-04  1963  	clk_disable_unprepare(imx_data->clk_ipg);
89d7e5c131228a Dong Aisheng      2013-11-04  1964  	clk_disable_unprepare(imx_data->clk_ahb);
89d7e5c131228a Dong Aisheng      2013-11-04  1965  
1c4989b000aeac BOUGH CHEN        2019-04-29  1966  	if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS)
d1b98305916bc0 Rafael J. Wysocki 2020-02-12  1967  		cpu_latency_qos_remove_request(&imx_data->pm_qos_req);
1c4989b000aeac BOUGH CHEN        2019-04-29  1968  
89d7e5c131228a Dong Aisheng      2013-11-04  1969  	return ret;
89d7e5c131228a Dong Aisheng      2013-11-04  1970  }
89d7e5c131228a Dong Aisheng      2013-11-04  1971  
89d7e5c131228a Dong Aisheng      2013-11-04  1972  static int sdhci_esdhc_runtime_resume(struct device *dev)
89d7e5c131228a Dong Aisheng      2013-11-04  1973  {
89d7e5c131228a Dong Aisheng      2013-11-04  1974  	struct sdhci_host *host = dev_get_drvdata(dev);
89d7e5c131228a Dong Aisheng      2013-11-04  1975  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
070e6d3ff5a696 Jisheng Zhang     2016-02-16  1976  	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  1977  	int err;
89d7e5c131228a Dong Aisheng      2013-11-04  1978  
1c4989b000aeac BOUGH CHEN        2019-04-29  1979  	if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS)
d1b98305916bc0 Rafael J. Wysocki 2020-02-12  1980  		cpu_latency_qos_add_request(&imx_data->pm_qos_req, 0);
1c4989b000aeac BOUGH CHEN        2019-04-29  1981  
5c11f1ffb02244 Haibo Chen        2020-02-19  1982  	if (imx_data->socdata->flags & ESDHC_FLAG_CLK_RATE_LOST_IN_PM_RUNTIME)
5c11f1ffb02244 Haibo Chen        2020-02-19  1983  		clk_set_rate(imx_data->clk_per, pltfm_host->clock);
5c11f1ffb02244 Haibo Chen        2020-02-19  1984  
a0ad3087586d09 Michael Trimarchi 2018-01-04  1985  	err = clk_prepare_enable(imx_data->clk_ahb);
a0ad3087586d09 Michael Trimarchi 2018-01-04  1986  	if (err)
1c4989b000aeac BOUGH CHEN        2019-04-29  1987  		goto remove_pm_qos_request;
a0ad3087586d09 Michael Trimarchi 2018-01-04  1988  
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  1989  	err = clk_prepare_enable(imx_data->clk_per);
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  1990  	if (err)
a0ad3087586d09 Michael Trimarchi 2018-01-04  1991  		goto disable_ahb_clk;
af5d2b7b0d24f5 Ulf Hansson       2019-09-08  1992  
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  1993  	err = clk_prepare_enable(imx_data->clk_ipg);
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  1994  	if (err)
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  1995  		goto disable_per_clk;
af5d2b7b0d24f5 Ulf Hansson       2019-09-08  1996  
3602785b341a95 Michael Trimarchi 2018-01-04  1997  	esdhc_pltfm_set_clock(host, imx_data->actual_clock);
a0ad3087586d09 Michael Trimarchi 2018-01-04  1998  
c6303c5d52d5ec Baolin Wang       2019-07-25 @1999  	err = sdhci_runtime_resume_host(host, 0);
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  2000  	if (err)
a0ad3087586d09 Michael Trimarchi 2018-01-04  2001  		goto disable_ipg_clk;
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  2002  
bb6e358169bf62 BOUGH CHEN        2019-01-07  2003  	if (host->mmc->caps2 & MMC_CAP2_CQE)
bb6e358169bf62 BOUGH CHEN        2019-01-07  2004  		err = cqhci_resume(host->mmc);
bb6e358169bf62 BOUGH CHEN        2019-01-07  2005  
bb6e358169bf62 BOUGH CHEN        2019-01-07  2006  	return err;
89d7e5c131228a Dong Aisheng      2013-11-04  2007  
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  2008  disable_ipg_clk:
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  2009  	clk_disable_unprepare(imx_data->clk_ipg);
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  2010  disable_per_clk:
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  2011  	clk_disable_unprepare(imx_data->clk_per);
a0ad3087586d09 Michael Trimarchi 2018-01-04  2012  disable_ahb_clk:
a0ad3087586d09 Michael Trimarchi 2018-01-04  2013  	clk_disable_unprepare(imx_data->clk_ahb);
1c4989b000aeac BOUGH CHEN        2019-04-29  2014  remove_pm_qos_request:
1c4989b000aeac BOUGH CHEN        2019-04-29  2015  	if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS)
d1b98305916bc0 Rafael J. Wysocki 2020-02-12  2016  		cpu_latency_qos_remove_request(&imx_data->pm_qos_req);
17b1eb7f0bf3dc Fabio Estevam     2017-05-16  2017  	return err;
89d7e5c131228a Dong Aisheng      2013-11-04  2018  }
89d7e5c131228a Dong Aisheng      2013-11-04  2019
Luke Wang April 15, 2025, 3:15 a.m. UTC | #5
Hi Arnd,

This patch has compilation issue because sdhci.c still uses #ifdef CONFIG_PM. Do you plan to send a new patch to fix? If not, I can send a patch to fix the compilation warning.

Regards
Luke

> -----Original Message-----
> From: Arnd Bergmann <arnd@kernel.org>
> Sent: Friday, April 11, 2025 4:59 PM
> To: Bough Chen <haibo.chen@nxp.com>; Adrian Hunter
> <adrian.hunter@intel.com>; Ulf Hansson <ulf.hansson@linaro.org>; Shawn
> Guo <shawnguo@kernel.org>; Sascha Hauer <s.hauer@pengutronix.de>;
> Luke Wang <ziniu.wang_1@nxp.com>
> Cc: Arnd Bergmann <arnd@arndb.de>; Pengutronix Kernel Team
> <kernel@pengutronix.de>; Fabio Estevam <festevam@gmail.com>; Josua
> Mayer <josua@solid-run.com>; imx@lists.linux.dev; linux-
> mmc@vger.kernel.org; dl-S32 <S32@nxp.com>; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: [EXT] [PATCH] [v2] mmc: esdhc-imx: convert to modern PM_OPS
> 
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
> 
> 
> From: Arnd Bergmann <arnd@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. This also
> requires using pm_ptr() to eliminate both the runtime and pm_sleep
> operations.
> 
> Fixes: 3d1eea493894 ("mmc: sdhci-esdhc-imx: Save tuning value when card
> stays powered in suspend")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> v2: add pm_ptr()
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-
> esdhc-imx.c
> index 7e8addaed697..3c2e50d0260d 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)
>  };
> 
> @@ -2116,7 +2112,7 @@ static struct platform_driver
> sdhci_esdhc_imx_driver = {
>                 .name   = "sdhci-esdhc-imx",
>                 .probe_type = PROBE_PREFER_ASYNCHRONOUS,
>                 .of_match_table = imx_esdhc_dt_ids,
> -               .pm     = &sdhci_esdhc_pmops,
> +               .pm     = pm_ptr(&sdhci_esdhc_pmops),
>         },
>         .probe          = sdhci_esdhc_imx_probe,
>         .remove         = sdhci_esdhc_imx_remove,
> --
> 2.39.5
Arnd Bergmann April 15, 2025, 12:57 p.m. UTC | #6
On Tue, Apr 15, 2025, at 05:15, Luke Wang wrote:
> Hi Arnd,
>
> This patch has compilation issue because sdhci.c still uses #ifdef 
> CONFIG_PM. Do you plan to send a new patch to fix? If not, I can send a 
> patch to fix the compilation warning.

Can you see if the change below is sufficient? I see I have that
in my randconfig tree and I did not see any problems with my
v2 patch and that. I probably added that one originally because
of some other build failure but then never sent it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index cd0e35a80542..4ee2695b0202 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -874,12 +874,10 @@ irqreturn_t sdhci_thread_irq(int irq, void *dev_id);
 void sdhci_adma_write_desc(struct sdhci_host *host, void **desc,
                           dma_addr_t addr, int len, unsigned int cmd);
 
-#ifdef CONFIG_PM
 int sdhci_suspend_host(struct sdhci_host *host);
 int sdhci_resume_host(struct sdhci_host *host);
 int sdhci_runtime_suspend_host(struct sdhci_host *host);
 int sdhci_runtime_resume_host(struct sdhci_host *host, int soft_reset);
-#endif
 
 void sdhci_cqe_enable(struct mmc_host *mmc);
 void sdhci_cqe_disable(struct mmc_host *mmc, bool recovery);
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 7e8addaed697..3c2e50d0260d 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)
 };
 
@@ -2116,7 +2112,7 @@  static struct platform_driver sdhci_esdhc_imx_driver = {
 		.name	= "sdhci-esdhc-imx",
 		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 		.of_match_table = imx_esdhc_dt_ids,
-		.pm	= &sdhci_esdhc_pmops,
+		.pm	= pm_ptr(&sdhci_esdhc_pmops),
 	},
 	.probe		= sdhci_esdhc_imx_probe,
 	.remove		= sdhci_esdhc_imx_remove,