[Linux-kernel-mentees] [PATCH v1 2/2] realtek/8139cp: Remove Legacy Power Management

Vaibhav Gupta vaibhav.varodek at gmail.com
Fri Apr 24 14:04:50 UTC 2020


> >
> > But in case of "__maybe_unused", we don't keep a check while binding
> > ".driver.pm".
> > Hence, if CONFIG_PM_SLEEP is not defined, still the ".driver.pm" is
> > bind with a structure
> > with some random initial values.
> >
> > We can use the mix of both?
> > __maybe_unused xyz_suspend(){}
> > __maybe_unused xyz_resume(){}
> > ...
> > #ifdef CONFIG_PM_SLEEP
> > .driver.pm = &xyz_pm_ops;
> > #endif
>
> I don't think we need the mix because when CONFIG_PM_SLEEP isn't
> defined, SIMPLE_DEV_PM_OPS() compiles to:
>
>   const struct dev_pm_ops xyz_pm_ops = { }
>
> and the xyz_pm_ops struct should be zero-filled.  The #ifdef around
> ".driver.pm = &xyz_pm_ops" doesn't buy us anything -- the space for
> the driver.pm pointer is there regardless, so we don't save any space,
> and the default initialization is zero-filled, so the result is the
> same.

Then, I guess my step to remove "#ifdef CONFIG_PM" won't go complete
waste, I should just use "__maybe_unused" with suspend() and resume()
to suppress warnings. Right?

-- Vaibhav Gupta


More information about the Linux-kernel-mentees mailing list