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

Vaibhav Gupta vaibhav.varodek at gmail.com
Fri Apr 24 15:13:35 UTC 2020


On Fri, 24 Apr 2020 at 20:31, Bjorn Helgaas <helgaas at kernel.org> wrote:
>
> On Fri, Apr 24, 2020 at 07:34:50PM +0530, Vaibhav Gupta wrote:
> > > >
> > > > 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?
>
> Yes, that's what I'd do.  This is all window dressing; the important
> thing is getting the semantic change right, i.e., the transformations
> of the xyz_suspend() and xyz_resume() functions.  This #ifdef and
> __maybe_unused stuff can be trivially changed if necessary.
Yes, I will send a new patch series for this one.

-- Vaibhav Gupta
>
> Bjorn


More information about the Linux-kernel-mentees mailing list