Re: [PATCH] PM: Add helper to mark last busy and autosuspend

From: Alan Stern
Date: Tue Sep 16 2014 - 11:58:18 EST


On Tue, 16 Sep 2014, Vinod Koul wrote:

> On Tue, Sep 16, 2014 at 10:27:53AM -0400, Alan Stern wrote:
> > On Tue, 16 Sep 2014, Subhransu S. Prusty wrote:
> >
> > > pm_runtime_mark_last_busy and pm_runtime_put_autosuspend are used together
> > > in quite a lot of places. Add a helper for these.
> > >
> > > Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@xxxxxxxxx>
> > > ---
> > > include/linux/pm_runtime.h | 6 ++++++
> > > 1 file changed, 6 insertions(+)
> > >
> > > diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
> > > index 367f49b..256ec50 100644
> > > --- a/include/linux/pm_runtime.h
> > > +++ b/include/linux/pm_runtime.h
> > > @@ -277,4 +277,10 @@ static inline void pm_runtime_dont_use_autosuspend(struct device *dev)
> > > __pm_runtime_use_autosuspend(dev, false);
> > > }
> > >
> > > +static inline int pm_runtime_last_busy_and_autosuspend(struct device *dev)
> > > +{
> > > + pm_runtime_mark_last_busy(dev);
> > > + return pm_runtime_put_autosuspend(dev);
> > > +}
> > > +
> > > #endif
> >
> > What's the advantage? Removing a few bytes of source code? There will
> > no change to the object code. (Not to mention that your patch didn't
> > actually change _any_ of the places where both routines get called!)
> Yes we didnt change users, as we need this for one of our drivers we are
> trying to push.

Why do you need it? Just change your driver to call

pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);

instead of

pm_runtime_last_busy_and_autosuspend(dev);

Or create a subroutine in your driver to do this.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/