On Mon, Jan 27, 2025 at 01:46:00PM +0100, Raphael Gallais-Pou 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>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> drivers/ata/ahci_imx.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
> index f01f08048f97aa230877e413ba6e416d79779c1b..ec75a16c630a79ce10ea98b16c44c9a3908f869f 100644
> --- a/drivers/ata/ahci_imx.c
> +++ b/drivers/ata/ahci_imx.c
> @@ -993,7 +993,6 @@ static void ahci_imx_host_stop(struct ata_host *host)
> clk_disable_unprepare(imxpriv->sata_clk);
> }
>
> -#ifdef CONFIG_PM_SLEEP
> static int imx_ahci_suspend(struct device *dev)
> {
> struct ata_host *host = dev_get_drvdata(dev);
> @@ -1021,9 +1020,8 @@ static int imx_ahci_resume(struct device *dev)
>
> return ahci_platform_resume_host(dev);
> }
> -#endif
>
> -static SIMPLE_DEV_PM_OPS(ahci_imx_pm_ops, imx_ahci_suspend, imx_ahci_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(ahci_imx_pm_ops, imx_ahci_suspend, imx_ahci_resume);
>
> static struct platform_driver imx_ahci_driver = {
> .probe = imx_ahci_probe,
> @@ -1031,7 +1029,7 @@ static struct platform_driver imx_ahci_driver = {
> .driver = {
> .name = DRV_NAME,
> .of_match_table = imx_ahci_of_match,
> - .pm = &ahci_imx_pm_ops,
> + .pm = pm_sleep_ptr(&ahci_imx_pm_ops),
> },
> };
> module_platform_driver(imx_ahci_driver);
>
> --
> 2.48.0
>