RE: [PATCH 18/38] mmc: sdhci-esdhc-imx: use modern PM macros

From: Bough Chen
Date: Tue Aug 19 2025 - 22:15:53 EST


> -----Original Message-----
> From: Jisheng Zhang <jszhang@xxxxxxxxxx>
> Sent: 2025年8月19日 19:59
> To: Bough Chen <haibo.chen@xxxxxxx>
> Cc: Ulf Hansson <ulf.hansson@xxxxxxxxxx>; Aubin Constans
> <aubin.constans@xxxxxxxxxxxxx>; Nicolas Ferre
> <nicolas.ferre@xxxxxxxxxxxxx>; Alexandre Belloni
> <alexandre.belloni@xxxxxxxxxxx>; Claudiu Beznea
> <claudiu.beznea@xxxxxxxxx>; Manuel Lauss <manuel.lauss@xxxxxxxxx>;
> Micha�� Miros��aw <mirq-linux@xxxxxxxxxxxx>; Jaehoon Chung
> <jh80.chung@xxxxxxxxxxx>; Krzysztof Kozlowski <krzk@xxxxxxxxxx>; Alim
> Akhtar <alim.akhtar@xxxxxxxxxxx>; Heiko Stuebner <heiko@xxxxxxxxx>;
> Russell King <linux@xxxxxxxxxxxxxxx>; Chaotian Jing
> <chaotian.jing@xxxxxxxxxxxx>; Matthias Brugger <matthias.bgg@xxxxxxxxx>;
> AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>;
> Shawn Guo <shawnguo@xxxxxxxxxx>; Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>;
> Pengutronix Kernel Team <kernel@xxxxxxxxxxxxxx>; Fabio Estevam
> <festevam@xxxxxxxxx>; Adrian Hunter <adrian.hunter@xxxxxxxxx>; Kamal
> Dasu <kamal.dasu@xxxxxxxxxxxx>; Al Cooper <alcooperx@xxxxxxxxx>;
> Broadcom internal kernel review list
> <bcm-kernel-feedback-list@xxxxxxxxxxxx>; Florian Fainelli
> <florian.fainelli@xxxxxxxxxxxx>; Michal Simek <michal.simek@xxxxxxx>;
> Eugen Hristev <eugen.hristev@xxxxxxxxxx>; Vignesh Raghavendra
> <vigneshr@xxxxxx>; Ben Dooks <ben-linux@xxxxxxxxx>; Viresh Kumar
> <vireshk@xxxxxxxxxx>; Orson Zhai <orsonzhai@xxxxxxxxx>; Baolin Wang
> <baolin.wang@xxxxxxxxxxxxxxxxx>; Chunyan Zhang <zhang.lyra@xxxxxxxxx>;
> Patrice Chotard <patrice.chotard@xxxxxxxxxxx>; Thierry Reding
> <thierry.reding@xxxxxxxxx>; Jonathan Hunter <jonathanh@xxxxxxxxxx>;
> Chen-Yu Tsai <wens@xxxxxxxx>; Jernej Skrabec <jernej.skrabec@xxxxxxxxx>;
> Samuel Holland <samuel@xxxxxxxxxxxx>; Alexey Charkov <alchark@xxxxxxxxx>;
> linux-mmc@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH 18/38] mmc: sdhci-esdhc-imx: use modern PM macros
>
> On Tue, Aug 19, 2025 at 03:48:57AM +0000, Bough Chen wrote:
> > > -----Original Message-----
> > > From: Jisheng Zhang <jszhang@xxxxxxxxxx>
> > > Sent: 2025年8月18日 20:15
> > > To: Bough Chen <haibo.chen@xxxxxxx>
> > > Cc: Ulf Hansson <ulf.hansson@xxxxxxxxxx>; Aubin Constans
> > > <aubin.constans@xxxxxxxxxxxxx>; Nicolas Ferre
> > > <nicolas.ferre@xxxxxxxxxxxxx>; Alexandre Belloni
> > > <alexandre.belloni@xxxxxxxxxxx>; Claudiu Beznea
> > > <claudiu.beznea@xxxxxxxxx>; Manuel Lauss <manuel.lauss@xxxxxxxxx>;
> > > Micha Miros aw <mirq-linux@xxxxxxxxxxxx>; Jaehoon Chung
> > > <jh80.chung@xxxxxxxxxxx>; Krzysztof Kozlowski <krzk@xxxxxxxxxx>;
> > > Alim Akhtar <alim.akhtar@xxxxxxxxxxx>; Heiko Stuebner
> > > <heiko@xxxxxxxxx>; Russell King <linux@xxxxxxxxxxxxxxx>; Chaotian
> > > Jing <chaotian.jing@xxxxxxxxxxxx>; Matthias Brugger
> > > <matthias.bgg@xxxxxxxxx>; AngeloGioacchino Del Regno
> > > <angelogioacchino.delregno@xxxxxxxxxxxxx>;
> > > Shawn Guo <shawnguo@xxxxxxxxxx>; Sascha Hauer
> > > <s.hauer@xxxxxxxxxxxxxx>; Pengutronix Kernel Team
> > > <kernel@xxxxxxxxxxxxxx>; Fabio Estevam <festevam@xxxxxxxxx>; Adrian
> > > Hunter <adrian.hunter@xxxxxxxxx>; Kamal Dasu
> > > <kamal.dasu@xxxxxxxxxxxx>; Al Cooper <alcooperx@xxxxxxxxx>;
> Broadcom
> > > internal kernel review list <bcm-kernel-feedback-list@xxxxxxxxxxxx>;
> > > Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>; Michal Simek
> > > <michal.simek@xxxxxxx>; Eugen Hristev <eugen.hristev@xxxxxxxxxx>;
> > > Vignesh Raghavendra <vigneshr@xxxxxx>; Ben Dooks
> > > <ben-linux@xxxxxxxxx>; Viresh Kumar <vireshk@xxxxxxxxxx>; Orson Zhai
> > > <orsonzhai@xxxxxxxxx>; Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>;
> > > Chunyan Zhang <zhang.lyra@xxxxxxxxx>; Patrice Chotard
> > > <patrice.chotard@xxxxxxxxxxx>; Thierry Reding
> > > <thierry.reding@xxxxxxxxx>; Jonathan Hunter <jonathanh@xxxxxxxxxx>;
> > > Chen-Yu Tsai <wens@xxxxxxxx>; Jernej Skrabec
> > > <jernej.skrabec@xxxxxxxxx>; Samuel Holland <samuel@xxxxxxxxxxxx>;
> > > Alexey Charkov <alchark@xxxxxxxxx>; linux-mmc@xxxxxxxxxxxxxxx;
> > > linux-kernel@xxxxxxxxxxxxxxx
> > > Subject: Re: [PATCH 18/38] mmc: sdhci-esdhc-imx: use modern PM
> > > macros
> > >
> > > On Sat, Aug 16, 2025 at 02:03:48PM +0800, Jisheng Zhang wrote:
> > > > On Fri, Aug 15, 2025 at 03:23:56AM +0000, Bough Chen wrote:
> > > > > > -----Original Message-----
> > > > > > From: Jisheng Zhang <jszhang@xxxxxxxxxx>
> > > > > > Sent: 2025Ҵ8??15?? 9:34
> > > > > > To: Ulf Hansson <ulf.hansson@xxxxxxxxxx>; Aubin Constans
> > > > > > <aubin.constans@xxxxxxxxxxxxx>; Nicolas Ferre
> > > > > > <nicolas.ferre@xxxxxxxxxxxxx>; Alexandre Belloni
> > > > > > <alexandre.belloni@xxxxxxxxxxx>; Claudiu Beznea
> > > > > > <claudiu.beznea@xxxxxxxxx>; Manuel Lauss
> > > > > > <manuel.lauss@xxxxxxxxx>; Micha?? Miros??aw
> > > > > > <mirq-linux@xxxxxxxxxxxx>; Jaehoon Chung
> > > > > > <jh80.chung@xxxxxxxxxxx>; Krzysztof Kozlowski
> > > > > > <krzk@xxxxxxxxxx>; Alim Akhtar <alim.akhtar@xxxxxxxxxxx>;
> > > > > > Heiko Stuebner <heiko@xxxxxxxxx>; Russell King
> > > > > > <linux@xxxxxxxxxxxxxxx>; Chaotian Jing
> > > > > > <chaotian.jing@xxxxxxxxxxxx>; Matthias Brugger
> > > > > > <matthias.bgg@xxxxxxxxx>; AngeloGioacchino Del Regno
> > > > > > <angelogioacchino.delregno@xxxxxxxxxxxxx>;
> > > > > > Shawn Guo <shawnguo@xxxxxxxxxx>; Sascha Hauer
> > > > > > <s.hauer@xxxxxxxxxxxxxx>; Pengutronix Kernel Team
> > > > > > <kernel@xxxxxxxxxxxxxx>; Fabio Estevam <festevam@xxxxxxxxx>;
> > > > > > Adrian Hunter <adrian.hunter@xxxxxxxxx>; Kamal Dasu
> > > > > > <kamal.dasu@xxxxxxxxxxxx>; Al Cooper <alcooperx@xxxxxxxxx>;
> > > > > > Broadcom internal kernel review list
> > > > > > <bcm-kernel-feedback-list@xxxxxxxxxxxx>; Florian Fainelli
> > > > > > <florian.fainelli@xxxxxxxxxxxx>; Bough Chen
> > > > > > <haibo.chen@xxxxxxx>; Michal Simek <michal.simek@xxxxxxx>;
> > > > > > Eugen Hristev <eugen.hristev@xxxxxxxxxx>; Vignesh Raghavendra
> > > > > > <vigneshr@xxxxxx>; Ben Dooks <ben-linux@xxxxxxxxx>; Viresh
> > > > > > Kumar <vireshk@xxxxxxxxxx>; Orson Zhai <orsonzhai@xxxxxxxxx>;
> > > > > > Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>; Chunyan Zhang
> > > > > > <zhang.lyra@xxxxxxxxx>; Patrice Chotard
> > > > > > <patrice.chotard@xxxxxxxxxxx>; Thierry Reding
> > > > > > <thierry.reding@xxxxxxxxx>; Jonathan Hunter
> > > > > > <jonathanh@xxxxxxxxxx>; Chen-Yu Tsai <wens@xxxxxxxx>; Jernej
> > > > > > Skrabec <jernej.skrabec@xxxxxxxxx>; Samuel Holland
> > > > > > <samuel@xxxxxxxxxxxx>; Alexey Charkov <alchark@xxxxxxxxx>
> > > > > > Cc: linux-mmc@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> > > > > > Subject: [PATCH 18/38] mmc: sdhci-esdhc-imx: use modern PM
> > > > > > macros
> > > > > >
> > > > > > Use the modern PM macros for the suspend and resume functions
> > > > > > to be automatically dropped by the compiler when CONFIG_PM or
> > > > > > CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.
> > > > > >
> > > > > > This has the advantage of always compiling these functions in,
> > > > > > independently of any Kconfig option. Thanks to that, bugs and
> > > > > > other regressions are subsequently easier to catch.
> > > > >
> > > > > Hi Jisheng,
> > > >
> > > > Hi,
> > > >
> > > > >
> > > > > When I remove all the configs under Power management options I
> > > > > got the
> > > following build warning:
> > > > >
> > > > > drivers/mmc/host/sdhci-esdhc-imx.c:2079:12: warning:
> > > > > ??sdhci_esdhc_resume?? defined but not used [-Wunused-function]
> > > > > 2079 | static int sdhci_esdhc_resume(struct device *dev)
> > > > > | ^~~~~~~~~~~~~~~~~~
> > > > > CC drivers/mmc/host/cqhci-core.o
> > > > > drivers/mmc/host/sdhci-esdhc-imx.c:2017:12: warning:
> > > > > ??sdhci_esdhc_suspend?? defined but not used [-Wunused-function]
> > > > > 2017 | static int sdhci_esdhc_suspend(struct device *dev)
> > > > > | ^~~~~~~~~~~~~~~~~~~
> > > >
> > > > Hmm interesting, what's test toolchain? I tested this patch with
> > > > gcc14 with below three combinations before sending out, no warnings at
> all:
> > > > PM + PM_SLEEP
> > > > PM only
> > > > !PM + ! PM_SLEEP
> > > >
> > > > The sdhci_esdhc_suspend|resume are referenced by
> > > SYSTEM_SLEEP_PM_OPS.
> > > > The pm_sleep_ptr() macro does the tricky, when both PM and
> > > > PM_SLEEP are disabled, they are optimized out.
> > >
> > > Hi Haibo,
> > >
> > > Could you plz share your toolchain information? And FYI, today I
> > > tested clang with the above three combinations, also no warnings. So
> > > I'm really interested how to reproduce your warnings.
> > >
> > > And the kernel CI build robot hasn't sent out warning email so far.
> >
> > I'm not sure whether my test step is correct.
> > I find for ARM, it force to enable the CONFIG_PM. to test your patch, I force
> remove all the PM related configs in .config. then meet this warning. And also
> many other driver build warning.
>
> Now, I tried arm multi_v7_defconfig, then unselect those platforms which
> enable CONFIG_PM, then enable COMPILE_TEST, then unselect CONFIG_PM
> and CONFIG_PM_SLEEP, and build with arm-linux-gnueabihf-gcc-14, stil no any
> warning.
> So can you plz share your defconfig? you can save it by 'make savedefconfig'
> And I asked twice about your toolchain information, can you plz provide it?
>

Please ignore my first reply, the test method is wrong.
The toolchain is : aarch64-poky-linux-gcc-13.2.0
I just use the default defconfig in arch/arm64/config.


For this patch:
Reviewed-by: Haibo Chen <haibo.chen@xxxxxxx>

Regards
Haibo Chen

> > Seems this test method is not correct, can anyone confirm here?
> >
> > I did another test today, I enable the COMPILE_TEST, and use x86, chose the
> usdhc in menuconfig, disable CONFIG_PM, and build kernel by the following
> command, do not meet any warning:
> > make ARCH=x86 CC=gcc -j64
> > Seems this means !PM + !PM_SLEEP verify ok.
>
> I tested not only x86, but also arm64 and riscv...
>
> >
> > What's your method to test these PM related combination?
>
> Similar as yours -- enable COMPILE_TEST.
> Sure for the drivers I used: sdhci-of-dwcmshc, sdhci-pxav3 and sdhci-xenon, I
> tested them.
>
> B.R