Re: [PATCH 07/39] spi: bcmbca-hsspi: use modern PM macros

William Zhang <[email protected]>
Newsgroups org.kernel.vger.linux-spi,org.kernel.vger.linux-kernel
Message-ID <CAHi4H7GJ3CB-4s+92vMYmTDJn=rJa11OYivzdgrZnS1kpCSu1Q@mail.gmail.com>
On Mon, Aug 3, 2026 at 7:41 AM Jisheng Zhang <[email protected]> wrote:
>
> 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.
>
> Signed-off-by: Jisheng Zhang <[email protected]>
> ---
>  drivers/spi/spi-bcmbca-hsspi.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/spi/spi-bcmbca-hsspi.c b/drivers/spi/spi-bcmbca-hsspi.c
> index 09c1472ae4fa..570ea635ab0c 100644
> --- a/drivers/spi/spi-bcmbca-hsspi.c
> +++ b/drivers/spi/spi-bcmbca-hsspi.c
> @@ -563,7 +563,6 @@ static void bcmbca_hsspi_remove(struct platform_device *pdev)
>         sysfs_remove_group(&pdev->dev.kobj, &bcmbca_hsspi_group);
>  }
>
> -#ifdef CONFIG_PM_SLEEP
>  static int bcmbca_hsspi_suspend(struct device *dev)
>  {
>         struct spi_controller *host = dev_get_drvdata(dev);
> @@ -598,10 +597,9 @@ static int bcmbca_hsspi_resume(struct device *dev)
>
>         return 0;
>  }
> -#endif
>
> -static SIMPLE_DEV_PM_OPS(bcmbca_hsspi_pm_ops, bcmbca_hsspi_suspend,
> -                        bcmbca_hsspi_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(bcmbca_hsspi_pm_ops, bcmbca_hsspi_suspend,
> +                               bcmbca_hsspi_resume);
>
>  static const struct of_device_id bcmbca_hsspi_of_match[] = {
>         { .compatible = "brcm,bcmbca-hsspi-v1.1", },
> @@ -613,7 +611,7 @@ MODULE_DEVICE_TABLE(of, bcmbca_hsspi_of_match);
>  static struct platform_driver bcmbca_hsspi_driver = {
>         .driver = {
>                    .name = "bcmbca-hsspi",
> -                  .pm = &bcmbca_hsspi_pm_ops,
> +                  .pm = pm_sleep_ptr(&bcmbca_hsspi_pm_ops),
>                    .of_match_table = bcmbca_hsspi_of_match,
>                    },
>         .probe = bcmbca_hsspi_probe,
> --
> 2.53.0
>

Acked-by: William Zhang <[email protected]>
smime.p7s (application/pkcs7-signature, 5.3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.