gpio: mxc: Improve PM configuration

Message ID 20230711072053.2837327-1-geert+renesas@glider.be
State New
Headers
Series gpio: mxc: Improve PM configuration |

Commit Message

Geert Uytterhoeven July 11, 2023, 7:20 a.m. UTC
  If CONFIG_PM=n (e.g. m68k/allmodconfig):

    drivers/gpio/gpio-mxc.c:612:12: error: ‘mxc_gpio_runtime_resume’ defined but not used [-Werror=unused-function]
      612 | static int mxc_gpio_runtime_resume(struct device *dev)
          |            ^~~~~~~~~~~~~~~~~~~~~~~
    drivers/gpio/gpio-mxc.c:602:12: error: ‘mxc_gpio_runtime_suspend’ defined but not used [-Werror=unused-function]
      602 | static int mxc_gpio_runtime_suspend(struct device *dev)
          |            ^~~~~~~~~~~~~~~~~~~~~~~~

Fix this by using the non-SET *_PM_OPS to configure the dev_pm_ops
callbacks, and by wrapping the driver.pm initializer insider pm_ptr().

As NOIRQ_SYSTEM_SLEEP_PM_OPS() uses pm_sleep_ptr() internally, the
__maybe_unused annotations for the noirq callbacks are no longer needed,
and can be removed.

Fixes: 3283d820dce649ad ("gpio: mxc: add runtime pm support")
Reported-by: noreply@ellerman.id.au
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/gpio/gpio-mxc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
  

Comments

Andy Shevchenko July 11, 2023, 9 a.m. UTC | #1
On Tue, Jul 11, 2023 at 10:21 AM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> If CONFIG_PM=n (e.g. m68k/allmodconfig):
>
>     drivers/gpio/gpio-mxc.c:612:12: error: ‘mxc_gpio_runtime_resume’ defined but not used [-Werror=unused-function]
>       612 | static int mxc_gpio_runtime_resume(struct device *dev)
>           |            ^~~~~~~~~~~~~~~~~~~~~~~
>     drivers/gpio/gpio-mxc.c:602:12: error: ‘mxc_gpio_runtime_suspend’ defined but not used [-Werror=unused-function]
>       602 | static int mxc_gpio_runtime_suspend(struct device *dev)
>           |            ^~~~~~~~~~~~~~~~~~~~~~~~
>
> Fix this by using the non-SET *_PM_OPS to configure the dev_pm_ops
> callbacks, and by wrapping the driver.pm initializer insider pm_ptr().
>
> As NOIRQ_SYSTEM_SLEEP_PM_OPS() uses pm_sleep_ptr() internally, the
> __maybe_unused annotations for the noirq callbacks are no longer needed,
> and can be removed.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Fixes: 3283d820dce649ad ("gpio: mxc: add runtime pm support")
> Reported-by: noreply@ellerman.id.au
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/gpio/gpio-mxc.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index a9fb6bd9aa6f9645..a43df5d5006e62d3 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -623,7 +623,7 @@ static int mxc_gpio_runtime_resume(struct device *dev)
>         return 0;
>  }
>
> -static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
> +static int mxc_gpio_noirq_suspend(struct device *dev)
>  {
>         struct platform_device *pdev = to_platform_device(dev);
>         struct mxc_gpio_port *port = platform_get_drvdata(pdev);
> @@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
>         return 0;
>  }
>
> -static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
> +static int mxc_gpio_noirq_resume(struct device *dev)
>  {
>         struct platform_device *pdev = to_platform_device(dev);
>         struct mxc_gpio_port *port = platform_get_drvdata(pdev);
> @@ -647,8 +647,8 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
>  }
>
>  static const struct dev_pm_ops mxc_gpio_dev_pm_ops = {
> -       SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
> -       SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
> +       NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
> +       RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
>  };
>
>  static int mxc_gpio_syscore_suspend(void)
> @@ -695,7 +695,7 @@ static struct platform_driver mxc_gpio_driver = {
>                 .name   = "gpio-mxc",
>                 .of_match_table = mxc_gpio_dt_ids,
>                 .suppress_bind_attrs = true,
> -               .pm = &mxc_gpio_dev_pm_ops,
> +               .pm = pm_ptr(&mxc_gpio_dev_pm_ops),
>         },
>         .probe          = mxc_gpio_probe,
>  };
> --
> 2.34.1
>
  
Bartosz Golaszewski July 20, 2023, 3:17 p.m. UTC | #2
On Tue, Jul 11, 2023 at 9:20 AM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> If CONFIG_PM=n (e.g. m68k/allmodconfig):
>
>     drivers/gpio/gpio-mxc.c:612:12: error: ‘mxc_gpio_runtime_resume’ defined but not used [-Werror=unused-function]
>       612 | static int mxc_gpio_runtime_resume(struct device *dev)
>           |            ^~~~~~~~~~~~~~~~~~~~~~~
>     drivers/gpio/gpio-mxc.c:602:12: error: ‘mxc_gpio_runtime_suspend’ defined but not used [-Werror=unused-function]
>       602 | static int mxc_gpio_runtime_suspend(struct device *dev)
>           |            ^~~~~~~~~~~~~~~~~~~~~~~~
>
> Fix this by using the non-SET *_PM_OPS to configure the dev_pm_ops
> callbacks, and by wrapping the driver.pm initializer insider pm_ptr().
>
> As NOIRQ_SYSTEM_SLEEP_PM_OPS() uses pm_sleep_ptr() internally, the
> __maybe_unused annotations for the noirq callbacks are no longer needed,
> and can be removed.
>
> Fixes: 3283d820dce649ad ("gpio: mxc: add runtime pm support")
> Reported-by: noreply@ellerman.id.au
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/gpio/gpio-mxc.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index a9fb6bd9aa6f9645..a43df5d5006e62d3 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -623,7 +623,7 @@ static int mxc_gpio_runtime_resume(struct device *dev)
>         return 0;
>  }
>
> -static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
> +static int mxc_gpio_noirq_suspend(struct device *dev)
>  {
>         struct platform_device *pdev = to_platform_device(dev);
>         struct mxc_gpio_port *port = platform_get_drvdata(pdev);
> @@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
>         return 0;
>  }
>
> -static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
> +static int mxc_gpio_noirq_resume(struct device *dev)
>  {
>         struct platform_device *pdev = to_platform_device(dev);
>         struct mxc_gpio_port *port = platform_get_drvdata(pdev);
> @@ -647,8 +647,8 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
>  }
>
>  static const struct dev_pm_ops mxc_gpio_dev_pm_ops = {
> -       SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
> -       SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
> +       NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
> +       RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
>  };
>
>  static int mxc_gpio_syscore_suspend(void)
> @@ -695,7 +695,7 @@ static struct platform_driver mxc_gpio_driver = {
>                 .name   = "gpio-mxc",
>                 .of_match_table = mxc_gpio_dt_ids,
>                 .suppress_bind_attrs = true,
> -               .pm = &mxc_gpio_dev_pm_ops,
> +               .pm = pm_ptr(&mxc_gpio_dev_pm_ops),
>         },
>         .probe          = mxc_gpio_probe,
>  };
> --
> 2.34.1
>

Applied, thanks!

Bart
  
Bartosz Golaszewski July 20, 2023, 3:22 p.m. UTC | #3
On Thu, Jul 20, 2023 at 5:17 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> On Tue, Jul 11, 2023 at 9:20 AM Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
> >
> > If CONFIG_PM=n (e.g. m68k/allmodconfig):
> >
> >     drivers/gpio/gpio-mxc.c:612:12: error: ‘mxc_gpio_runtime_resume’ defined but not used [-Werror=unused-function]
> >       612 | static int mxc_gpio_runtime_resume(struct device *dev)
> >           |            ^~~~~~~~~~~~~~~~~~~~~~~
> >     drivers/gpio/gpio-mxc.c:602:12: error: ‘mxc_gpio_runtime_suspend’ defined but not used [-Werror=unused-function]
> >       602 | static int mxc_gpio_runtime_suspend(struct device *dev)
> >           |            ^~~~~~~~~~~~~~~~~~~~~~~~
> >
> > Fix this by using the non-SET *_PM_OPS to configure the dev_pm_ops
> > callbacks, and by wrapping the driver.pm initializer insider pm_ptr().
> >
> > As NOIRQ_SYSTEM_SLEEP_PM_OPS() uses pm_sleep_ptr() internally, the
> > __maybe_unused annotations for the noirq callbacks are no longer needed,
> > and can be removed.
> >
> > Fixes: 3283d820dce649ad ("gpio: mxc: add runtime pm support")
> > Reported-by: noreply@ellerman.id.au
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> >  drivers/gpio/gpio-mxc.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> > index a9fb6bd9aa6f9645..a43df5d5006e62d3 100644
> > --- a/drivers/gpio/gpio-mxc.c
> > +++ b/drivers/gpio/gpio-mxc.c
> > @@ -623,7 +623,7 @@ static int mxc_gpio_runtime_resume(struct device *dev)
> >         return 0;
> >  }
> >
> > -static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
> > +static int mxc_gpio_noirq_suspend(struct device *dev)
> >  {
> >         struct platform_device *pdev = to_platform_device(dev);
> >         struct mxc_gpio_port *port = platform_get_drvdata(pdev);
> > @@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
> >         return 0;
> >  }
> >
> > -static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
> > +static int mxc_gpio_noirq_resume(struct device *dev)
> >  {
> >         struct platform_device *pdev = to_platform_device(dev);
> >         struct mxc_gpio_port *port = platform_get_drvdata(pdev);
> > @@ -647,8 +647,8 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
> >  }
> >
> >  static const struct dev_pm_ops mxc_gpio_dev_pm_ops = {
> > -       SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
> > -       SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
> > +       NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
> > +       RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
> >  };
> >
> >  static int mxc_gpio_syscore_suspend(void)
> > @@ -695,7 +695,7 @@ static struct platform_driver mxc_gpio_driver = {
> >                 .name   = "gpio-mxc",
> >                 .of_match_table = mxc_gpio_dt_ids,
> >                 .suppress_bind_attrs = true,
> > -               .pm = &mxc_gpio_dev_pm_ops,
> > +               .pm = pm_ptr(&mxc_gpio_dev_pm_ops),
> >         },
> >         .probe          = mxc_gpio_probe,
> >  };
> > --
> > 2.34.1
> >
>
> Applied, thanks!
>
> Bart

Nevermind, Arnd has a better fix for that so I'll apply his change.

Bart
  
Geert Uytterhoeven July 24, 2023, 4:50 p.m. UTC | #4
Hi Bartosz,

On Thu, Jul 20, 2023 at 5:23 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> On Thu, Jul 20, 2023 at 5:17 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > On Tue, Jul 11, 2023 at 9:20 AM Geert Uytterhoeven
> > <geert+renesas@glider.be> wrote:
> > > If CONFIG_PM=n (e.g. m68k/allmodconfig):
> > >
> > >     drivers/gpio/gpio-mxc.c:612:12: error: ‘mxc_gpio_runtime_resume’ defined but not used [-Werror=unused-function]
> > >       612 | static int mxc_gpio_runtime_resume(struct device *dev)
> > >           |            ^~~~~~~~~~~~~~~~~~~~~~~
> > >     drivers/gpio/gpio-mxc.c:602:12: error: ‘mxc_gpio_runtime_suspend’ defined but not used [-Werror=unused-function]
> > >       602 | static int mxc_gpio_runtime_suspend(struct device *dev)
> > >           |            ^~~~~~~~~~~~~~~~~~~~~~~~
> > >
> > > Fix this by using the non-SET *_PM_OPS to configure the dev_pm_ops
> > > callbacks, and by wrapping the driver.pm initializer insider pm_ptr().
> > >
> > > As NOIRQ_SYSTEM_SLEEP_PM_OPS() uses pm_sleep_ptr() internally, the
> > > __maybe_unused annotations for the noirq callbacks are no longer needed,
> > > and can be removed.
> > >
> > > Fixes: 3283d820dce649ad ("gpio: mxc: add runtime pm support")
> > > Reported-by: noreply@ellerman.id.au
> > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > ---
> > >  drivers/gpio/gpio-mxc.c | 10 +++++-----
> > >  1 file changed, 5 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> > > index a9fb6bd9aa6f9645..a43df5d5006e62d3 100644
> > > --- a/drivers/gpio/gpio-mxc.c
> > > +++ b/drivers/gpio/gpio-mxc.c
> > > @@ -623,7 +623,7 @@ static int mxc_gpio_runtime_resume(struct device *dev)
> > >         return 0;
> > >  }
> > >
> > > -static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
> > > +static int mxc_gpio_noirq_suspend(struct device *dev)
> > >  {
> > >         struct platform_device *pdev = to_platform_device(dev);
> > >         struct mxc_gpio_port *port = platform_get_drvdata(pdev);
> > > @@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
> > >         return 0;
> > >  }
> > >
> > > -static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
> > > +static int mxc_gpio_noirq_resume(struct device *dev)
> > >  {
> > >         struct platform_device *pdev = to_platform_device(dev);
> > >         struct mxc_gpio_port *port = platform_get_drvdata(pdev);
> > > @@ -647,8 +647,8 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
> > >  }
> > >
> > >  static const struct dev_pm_ops mxc_gpio_dev_pm_ops = {
> > > -       SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
> > > -       SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
> > > +       NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
> > > +       RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
> > >  };
> > >
> > >  static int mxc_gpio_syscore_suspend(void)
> > > @@ -695,7 +695,7 @@ static struct platform_driver mxc_gpio_driver = {
> > >                 .name   = "gpio-mxc",
> > >                 .of_match_table = mxc_gpio_dt_ids,
> > >                 .suppress_bind_attrs = true,
> > > -               .pm = &mxc_gpio_dev_pm_ops,
> > > +               .pm = pm_ptr(&mxc_gpio_dev_pm_ops),
> > >         },
> > >         .probe          = mxc_gpio_probe,
> > >  };
> > > --
> > > 2.34.1
> > >
> >
> > Applied, thanks!
> >
> > Bart
>
> Nevermind, Arnd has a better fix for that so I'll apply his change.

I disagree. And my patch was first ;-)

Arnd's version lacks the pm_ptr() around the mxc_gpio_driver.driver.pm
initializer, so the compiler cannot throw out the (rather large) unused
mxc_gpio_dev_pm_ops structure.

Thanks!

Gr{oetje,eeting}s,

                        Geert
  
Bartosz Golaszewski July 25, 2023, 9:58 a.m. UTC | #5
On Mon, Jul 24, 2023 at 6:50 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Bartosz,
>
> On Thu, Jul 20, 2023 at 5:23 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > On Thu, Jul 20, 2023 at 5:17 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > > On Tue, Jul 11, 2023 at 9:20 AM Geert Uytterhoeven
> > > <geert+renesas@glider.be> wrote:
> > > > If CONFIG_PM=n (e.g. m68k/allmodconfig):
> > > >
> > > >     drivers/gpio/gpio-mxc.c:612:12: error: ‘mxc_gpio_runtime_resume’ defined but not used [-Werror=unused-function]
> > > >       612 | static int mxc_gpio_runtime_resume(struct device *dev)
> > > >           |            ^~~~~~~~~~~~~~~~~~~~~~~
> > > >     drivers/gpio/gpio-mxc.c:602:12: error: ‘mxc_gpio_runtime_suspend’ defined but not used [-Werror=unused-function]
> > > >       602 | static int mxc_gpio_runtime_suspend(struct device *dev)
> > > >           |            ^~~~~~~~~~~~~~~~~~~~~~~~
> > > >
> > > > Fix this by using the non-SET *_PM_OPS to configure the dev_pm_ops
> > > > callbacks, and by wrapping the driver.pm initializer insider pm_ptr().
> > > >
> > > > As NOIRQ_SYSTEM_SLEEP_PM_OPS() uses pm_sleep_ptr() internally, the
> > > > __maybe_unused annotations for the noirq callbacks are no longer needed,
> > > > and can be removed.
> > > >
> > > > Fixes: 3283d820dce649ad ("gpio: mxc: add runtime pm support")
> > > > Reported-by: noreply@ellerman.id.au
> > > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > ---
> > > >  drivers/gpio/gpio-mxc.c | 10 +++++-----
> > > >  1 file changed, 5 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> > > > index a9fb6bd9aa6f9645..a43df5d5006e62d3 100644
> > > > --- a/drivers/gpio/gpio-mxc.c
> > > > +++ b/drivers/gpio/gpio-mxc.c
> > > > @@ -623,7 +623,7 @@ static int mxc_gpio_runtime_resume(struct device *dev)
> > > >         return 0;
> > > >  }
> > > >
> > > > -static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
> > > > +static int mxc_gpio_noirq_suspend(struct device *dev)
> > > >  {
> > > >         struct platform_device *pdev = to_platform_device(dev);
> > > >         struct mxc_gpio_port *port = platform_get_drvdata(pdev);
> > > > @@ -634,7 +634,7 @@ static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
> > > >         return 0;
> > > >  }
> > > >
> > > > -static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
> > > > +static int mxc_gpio_noirq_resume(struct device *dev)
> > > >  {
> > > >         struct platform_device *pdev = to_platform_device(dev);
> > > >         struct mxc_gpio_port *port = platform_get_drvdata(pdev);
> > > > @@ -647,8 +647,8 @@ static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
> > > >  }
> > > >
> > > >  static const struct dev_pm_ops mxc_gpio_dev_pm_ops = {
> > > > -       SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
> > > > -       SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
> > > > +       NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
> > > > +       RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
> > > >  };
> > > >
> > > >  static int mxc_gpio_syscore_suspend(void)
> > > > @@ -695,7 +695,7 @@ static struct platform_driver mxc_gpio_driver = {
> > > >                 .name   = "gpio-mxc",
> > > >                 .of_match_table = mxc_gpio_dt_ids,
> > > >                 .suppress_bind_attrs = true,
> > > > -               .pm = &mxc_gpio_dev_pm_ops,
> > > > +               .pm = pm_ptr(&mxc_gpio_dev_pm_ops),
> > > >         },
> > > >         .probe          = mxc_gpio_probe,
> > > >  };
> > > > --
> > > > 2.34.1
> > > >
> > >
> > > Applied, thanks!
> > >
> > > Bart
> >
> > Nevermind, Arnd has a better fix for that so I'll apply his change.
>
> I disagree. And my patch was first ;-)
>
> Arnd's version lacks the pm_ptr() around the mxc_gpio_driver.driver.pm
> initializer, so the compiler cannot throw out the (rather large) unused
> mxc_gpio_dev_pm_ops structure.
>
> Thanks!
>

Fair enough, I replaced Arnd's patch with yours.

Thanks,
Bartosz
  

Patch

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index a9fb6bd9aa6f9645..a43df5d5006e62d3 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -623,7 +623,7 @@  static int mxc_gpio_runtime_resume(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
+static int mxc_gpio_noirq_suspend(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct mxc_gpio_port *port = platform_get_drvdata(pdev);
@@ -634,7 +634,7 @@  static int __maybe_unused mxc_gpio_noirq_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
+static int mxc_gpio_noirq_resume(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct mxc_gpio_port *port = platform_get_drvdata(pdev);
@@ -647,8 +647,8 @@  static int __maybe_unused mxc_gpio_noirq_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops mxc_gpio_dev_pm_ops = {
-	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
-	SET_RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
+	NOIRQ_SYSTEM_SLEEP_PM_OPS(mxc_gpio_noirq_suspend, mxc_gpio_noirq_resume)
+	RUNTIME_PM_OPS(mxc_gpio_runtime_suspend, mxc_gpio_runtime_resume, NULL)
 };
 
 static int mxc_gpio_syscore_suspend(void)
@@ -695,7 +695,7 @@  static struct platform_driver mxc_gpio_driver = {
 		.name	= "gpio-mxc",
 		.of_match_table = mxc_gpio_dt_ids,
 		.suppress_bind_attrs = true,
-		.pm = &mxc_gpio_dev_pm_ops,
+		.pm = pm_ptr(&mxc_gpio_dev_pm_ops),
 	},
 	.probe		= mxc_gpio_probe,
 };