Re: [PATCH v2 08/18] GPIO: OMAP: Use wkup regs off/suspend support flag

Kevin Hilman
2011-06-30T22:57:25Z

"DebBarma, Tarun Kanti" <tarun.kanti@ti.com> writes:

> Kevin,
> [...]
>> > -#endif
>> > - default:
>> > - continue;
>> > - }
>> > + if (!bank->suspend_support)
>> > + return 0;
>>
>> Rather than check the flag here in every suspend, don't add a suspend
>> method in dev_pm_ops for banks that don't have the wkup_* registers.
> While trying to implement this comment I am facing issues:
>
> struct device_driver {
> ...
> const struct dev_pm_ops *pm;
>
> ...
> };
>
> Since *pm is constant we can not assign pm->suspend/resume dynamically.

Oh, right.

> Also, I am not sure if it is permissible to have following code in probe:
>
> ... omap_gpio_probe(...)
> {
> ...
> if (bank->regs->wkup_status) {
> pdrv->driver.pm->suspend = omap_gpio_suspend;
> pdrv->driver.pm->resume = omap_gpio_resume;
> }
> ...
>

OK, then I guess having a check for regs->wkup_status in the beginning
of the suspend/resume functions will be fine.

Thanks,

Kevin