Re: [PATCH 2/2] mmc: mxcmmc: Convert to SIMPLE_DEV_PM_OPS

Arnd Bergmann
2014-02-22T15:42:48Z

On Saturday 22 February 2014 12:05:43 Fabio Estevam wrote:
> On Sat, Feb 22, 2014 at 12:02 PM, Alexander Shiyan <shc_work@mail.ru> wrote:
>
> >> but then you would get a warning saying that "mxcmci_suspend/resume"
> >> are defined by not used" when CONFIG_PM_SLEEP=n
> >
> > Please see the patch first,
> > this warnings is avoided by "__maybe_unused" attributes.
>
> Ok, I see it now
>
> Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>
>

Unfortunately, everyone else uses the #ifdef here, and a lot of people
don't understand how to use __maybe_unused for this. IMHO all
drivers should do it the way that Alexander does it here, or
we should change the SIMPLE_DEV_PM_OPS() definition in a way that
doesn't need the #ifdef.

I have in the past tried to come up with a way to handle this more
naturally, but couldn't figure out how to migrate to it. If
SIMPLE_DEV_PM_OPS() defines an unused variable pointing to the
operations, we need neither the #ifdef nor the __maybe_unused
marker, but then it fails to build when there is an #ifdef.

Arnd