Message ID | 20250127-pm_ata-v1-14-f8f50c821a2a@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | AHCI power management cleanup | expand |
Hi Raphael, On Mon, 27 Jan 2025 at 13:46, Raphael Gallais-Pou <rgallaispou@gmail.com> wrote: > Letting the compiler remove these functions when the kernel is built > without CONFIG_PM_SLEEP support is simpler and less error prone than the > use of #ifdef based kernel configuration guards. > > Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com> Thanks for your patch! The subsystem prefix is "ata", not "ahci" (not all ATA-drivers are AHCI-drivers). > --- a/drivers/ata/sata_rcar.c > +++ b/drivers/ata/sata_rcar.c > @@ -927,7 +927,6 @@ static void sata_rcar_remove(struct platform_device *pdev) > pm_runtime_disable(&pdev->dev); > } > > -#ifdef CONFIG_PM_SLEEP > static int sata_rcar_suspend(struct device *dev) > { > struct ata_host *host = dev_get_drvdata(dev); > @@ -1005,7 +1004,6 @@ static const struct dev_pm_ops sata_rcar_pm_ops = { > .poweroff = sata_rcar_suspend, > .restore = sata_rcar_restore, > }; > -#endif If CONFIG_PM_SLEEP is disabled (e.g. m68k allyesconfig): drivers/ata/sata_rcar.c: In function ‘sata_rcar_suspend’: drivers/ata/sata_rcar.c:936:9: error: implicit declaration of function ‘ata_host_suspend’; did you mean ‘sata_rcar_suspend’? [-Werror=implicit-function-declaration] 936 | ata_host_suspend(host, PMSG_SUSPEND); | ^~~~~~~~~~~~~~~~ | sata_rcar_suspend drivers/ata/sata_rcar.c: In function ‘sata_rcar_resume’: drivers/ata/sata_rcar.c:973:9: error: implicit declaration of function ‘ata_host_resume’; did you mean ‘sata_rcar_resume’? [-Werror=implicit-function-declaration] 973 | ata_host_resume(host); | ^~~~~~~~~~~~~~~ | sata_rcar_resume > > static struct platform_driver sata_rcar_driver = { > .probe = sata_rcar_probe, > @@ -1013,9 +1011,7 @@ static struct platform_driver sata_rcar_driver = { > .driver = { > .name = DRV_NAME, > .of_match_table = sata_rcar_match, > -#ifdef CONFIG_PM_SLEEP > - .pm = &sata_rcar_pm_ops, > -#endif > + .pm = pm_sleep_ptr(&sata_rcar_pm_ops), > }, > }; Gr{oetje,eeting}s, Geert
On 1/27/25 22:45, Geert Uytterhoeven wrote: > Hi Raphael, > > On Mon, 27 Jan 2025 at 13:46, Raphael Gallais-Pou <rgallaispou@gmail.com> wrote: >> Letting the compiler remove these functions when the kernel is built >> without CONFIG_PM_SLEEP support is simpler and less error prone than the >> use of #ifdef based kernel configuration guards. >> >> Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com> > > Thanks for your patch! > > The subsystem prefix is "ata", not "ahci" (not all ATA-drivers are > AHCI-drivers). Yep. The convention is: ata: driver_name: xxx So it would be: ata: sata_rcar: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() for this patch. And the same comment applies to all your other patches in the series. > >> --- a/drivers/ata/sata_rcar.c >> +++ b/drivers/ata/sata_rcar.c >> @@ -927,7 +927,6 @@ static void sata_rcar_remove(struct platform_device *pdev) >> pm_runtime_disable(&pdev->dev); >> } >> >> -#ifdef CONFIG_PM_SLEEP >> static int sata_rcar_suspend(struct device *dev) >> { >> struct ata_host *host = dev_get_drvdata(dev); >> @@ -1005,7 +1004,6 @@ static const struct dev_pm_ops sata_rcar_pm_ops = { >> .poweroff = sata_rcar_suspend, >> .restore = sata_rcar_restore, >> }; >> -#endif > > If CONFIG_PM_SLEEP is disabled (e.g. m68k allyesconfig): > > drivers/ata/sata_rcar.c: In function ‘sata_rcar_suspend’: > drivers/ata/sata_rcar.c:936:9: error: implicit declaration of > function ‘ata_host_suspend’; did you mean ‘sata_rcar_suspend’? > [-Werror=implicit-function-declaration] > 936 | ata_host_suspend(host, PMSG_SUSPEND); > | ^~~~~~~~~~~~~~~~ > | sata_rcar_suspend > drivers/ata/sata_rcar.c: In function ‘sata_rcar_resume’: > drivers/ata/sata_rcar.c:973:9: error: implicit declaration of > function ‘ata_host_resume’; did you mean ‘sata_rcar_resume’? > [-Werror=implicit-function-declaration] > 973 | ata_host_resume(host); > | ^~~~~~~~~~~~~~~ > | sata_rcar_resume > >> >> static struct platform_driver sata_rcar_driver = { >> .probe = sata_rcar_probe, >> @@ -1013,9 +1011,7 @@ static struct platform_driver sata_rcar_driver = { >> .driver = { >> .name = DRV_NAME, >> .of_match_table = sata_rcar_match, >> -#ifdef CONFIG_PM_SLEEP >> - .pm = &sata_rcar_pm_ops, >> -#endif >> + .pm = pm_sleep_ptr(&sata_rcar_pm_ops), >> }, >> }; > > Gr{oetje,eeting}s, > > Geert >
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c index 22820a02d7408033d698a98373e1e8e7ef47f908..4c5f5938c12efc7c8594df4092915011e83f910d 100644 --- a/drivers/ata/sata_rcar.c +++ b/drivers/ata/sata_rcar.c @@ -927,7 +927,6 @@ static void sata_rcar_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); } -#ifdef CONFIG_PM_SLEEP static int sata_rcar_suspend(struct device *dev) { struct ata_host *host = dev_get_drvdata(dev); @@ -1005,7 +1004,6 @@ static const struct dev_pm_ops sata_rcar_pm_ops = { .poweroff = sata_rcar_suspend, .restore = sata_rcar_restore, }; -#endif static struct platform_driver sata_rcar_driver = { .probe = sata_rcar_probe, @@ -1013,9 +1011,7 @@ static struct platform_driver sata_rcar_driver = { .driver = { .name = DRV_NAME, .of_match_table = sata_rcar_match, -#ifdef CONFIG_PM_SLEEP - .pm = &sata_rcar_pm_ops, -#endif + .pm = pm_sleep_ptr(&sata_rcar_pm_ops), }, };
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based kernel configuration guards. Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com> --- drivers/ata/sata_rcar.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)