Re: [PATCH 2/2] spi: rpc-if: Remove CONFIG_PM_SLEEP ifdefery

From: Lad, Prabhakar
Date: Mon Jan 04 2021 - 18:23:49 EST


Hi Geert,

Thank you for the review.

On Mon, Jan 4, 2021 at 12:34 PM Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
>
> Hi Prabhakar,
>
> On Wed, Dec 30, 2020 at 4:00 PM Lad Prabhakar
> <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> wrote:
> > Use __maybe_unused for the suspend()/resume() hooks and get rid of
> > the CONFIG_PM_SLEEP ifdefery to improve the code.
> >
> > Suggested-by: Pavel Machek <pavel@xxxxxxx>
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> Thanks for your patch!
>
> > --- a/drivers/spi/spi-rpc-if.c
> > +++ b/drivers/spi/spi-rpc-if.c
> > @@ -176,15 +176,14 @@ static int rpcif_spi_remove(struct platform_device *pdev)
> > return 0;
> > }
> >
> > -#ifdef CONFIG_PM_SLEEP
> > -static int rpcif_spi_suspend(struct device *dev)
> > +static int __maybe_unused rpcif_spi_suspend(struct device *dev)
> > {
> > struct spi_controller *ctlr = dev_get_drvdata(dev);
> >
> > return spi_controller_suspend(ctlr);
> > }
> >
> > -static int rpcif_spi_resume(struct device *dev)
> > +static int __maybe_unused rpcif_spi_resume(struct device *dev)
> > {
> > struct spi_controller *ctlr = dev_get_drvdata(dev);
> >
> > @@ -192,17 +191,13 @@ static int rpcif_spi_resume(struct device *dev)
> > }
> >
> > static SIMPLE_DEV_PM_OPS(rpcif_spi_pm_ops, rpcif_spi_suspend, rpcif_spi_resume);
> > -#define DEV_PM_OPS (&rpcif_spi_pm_ops)
> > -#else
> > -#define DEV_PM_OPS NULL
> > -#endif
> >
> > static struct platform_driver rpcif_spi_driver = {
> > .probe = rpcif_spi_probe,
> > .remove = rpcif_spi_remove,
> > .driver = {
> > .name = "rpc-if-spi",
> > - .pm = DEV_PM_OPS,
> > + .pm = &rpcif_spi_pm_ops,
>
> You're aware rpcif_spi_pm_ops is now always referenced and thus emitted,
> increasing kernel size by 92 bytes if CONFIG_PM_SLEEP=n?
> This may matter for RZ/A SoCs running from internal SRAM.
>
Hmm didn't realise this would be an issue on RZ/A.

Mark, could you please drop this patch from your branch.

Cheers,
Prabhakar

> > },
> > };
> > module_platform_driver(rpcif_spi_driver);
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds