All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM: Add helper to mark last busy and autosuspend
@ 2014-09-16 10:43 Subhransu S. Prusty
  2014-09-16 14:27 ` Alan Stern
  0 siblings, 1 reply; 7+ messages in thread
From: Subhransu S. Prusty @ 2014-09-16 10:43 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Ulf Hansson, Alan Stern, linux-kernel, vinod.koul, Subhransu S. Prusty

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@intel.com>
---
 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
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] PM: Add helper to mark last busy and autosuspend
  2014-09-16 10:43 [PATCH] PM: Add helper to mark last busy and autosuspend Subhransu S. Prusty
@ 2014-09-16 14:27 ` Alan Stern
  2014-09-16 15:14   ` Vinod Koul
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Stern @ 2014-09-16 14:27 UTC (permalink / raw)
  To: Subhransu S. Prusty
  Cc: Rafael J. Wysocki, Ulf Hansson, linux-kernel, vinod.koul

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@intel.com>
> ---
>  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!)

Besides, if you're going to make an addition to the runtime PM API like 
this, then you also have to update Documentation/power/runtime_pm.txt.

Alan Stern


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] PM: Add helper to mark last busy and autosuspend
  2014-09-16 14:27 ` Alan Stern
@ 2014-09-16 15:14   ` Vinod Koul
  2014-09-16 15:58     ` Alan Stern
  0 siblings, 1 reply; 7+ messages in thread
From: Vinod Koul @ 2014-09-16 15:14 UTC (permalink / raw)
  To: Alan Stern
  Cc: Subhransu S. Prusty, Rafael J. Wysocki, Ulf Hansson, linux-kernel

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@intel.com>
> > ---
> >  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.

> Besides, if you're going to make an addition to the runtime PM API like 
> this, then you also have to update Documentation/power/runtime_pm.txt.
Sure if you folks are okay we can send update with Documentaion patch too

-- 
~Vinod

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] PM: Add helper to mark last busy and autosuspend
  2014-09-16 15:58     ` Alan Stern
@ 2014-09-16 15:36       ` Vinod Koul
  2014-09-16 17:22         ` Alan Stern
  0 siblings, 1 reply; 7+ messages in thread
From: Vinod Koul @ 2014-09-16 15:36 UTC (permalink / raw)
  To: Alan Stern
  Cc: Subhransu S. Prusty, Rafael J. Wysocki, Ulf Hansson, linux-kernel

On Tue, Sep 16, 2014 at 11:58:13AM -0400, Alan Stern wrote:
> 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@intel.com>
> > > > ---
> > > >  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.
Well since this is common why not add a helper in framework!

-- 
~Vinod

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] PM: Add helper to mark last busy and autosuspend
  2014-09-16 15:14   ` Vinod Koul
@ 2014-09-16 15:58     ` Alan Stern
  2014-09-16 15:36       ` Vinod Koul
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Stern @ 2014-09-16 15:58 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Subhransu S. Prusty, Rafael J. Wysocki, Ulf Hansson, linux-kernel

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@intel.com>
> > > ---
> > >  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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] PM: Add helper to mark last busy and autosuspend
  2014-09-16 15:36       ` Vinod Koul
@ 2014-09-16 17:22         ` Alan Stern
  2014-09-16 17:31           ` Vinod Koul
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Stern @ 2014-09-16 17:22 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Subhransu S. Prusty, Rafael J. Wysocki, Ulf Hansson, linux-kernel

On Tue, 16 Sep 2014, Vinod Koul wrote:

> > > > 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.
> Well since this is common why not add a helper in framework!

You said this was common, but you didn't change any of the other places
these routines get used.  I asked why and you didn't asnwer; all you
said was that you needed it for one of your drivers.

I then pointed out that you don't need it.  You didn't asnwer.

I asked what advantage this change brings.  You didn't answer.

Alan Stern


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] PM: Add helper to mark last busy and autosuspend
  2014-09-16 17:22         ` Alan Stern
@ 2014-09-16 17:31           ` Vinod Koul
  0 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2014-09-16 17:31 UTC (permalink / raw)
  To: Alan Stern
  Cc: Subhransu S. Prusty, Rafael J. Wysocki, Ulf Hansson, linux-kernel

On Tue, Sep 16, 2014 at 01:22:11PM -0400, Alan Stern wrote:
> On Tue, 16 Sep 2014, Vinod Koul wrote:
> 
> > > > > 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.
> > Well since this is common why not add a helper in framework!
> 
> You said this was common, but you didn't change any of the other places
> these routines get used.  I asked why and you didn't asnwer; all you
> said was that you needed it for one of your drivers.
I didnt say we wont change users either. If you do a quick search you would
see a good numbers of folks who are using above and also have their own
helpers.

> I then pointed out that you don't need it.  You didn't asnwer.
Since we have lot of users as well as my driver which we have already posted
we would like this to be in framwork
 
> I asked what advantage this change brings.  You didn't answer.
IMHO helpers like these should be part of framework rather than everyone
having their own versions!
Yes it doesnt change the object code at all, but will reduce LOC and driver
macros

Hope this explains your questions, Will come back witha a v2 with users
converted as well

-- 
~Vinod

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-09-16 17:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-16 10:43 [PATCH] PM: Add helper to mark last busy and autosuspend Subhransu S. Prusty
2014-09-16 14:27 ` Alan Stern
2014-09-16 15:14   ` Vinod Koul
2014-09-16 15:58     ` Alan Stern
2014-09-16 15:36       ` Vinod Koul
2014-09-16 17:22         ` Alan Stern
2014-09-16 17:31           ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.