Skip to contentSkip to conversation

PM: Add helper to mark last busy and autosuspend

PATCH In review Subhransu S. Prusty 3 participants 7 messages Sep 16, 2014 Power management core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM: Add helper to mark last busy and autosuspend

pm_runtime_mark_last_busy and pm_runtime_put_autosuspend are used together in quite a lot of places. Add a helper for these.

---
 include/linux/pm_runtime.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/pm_runtime.h +6 -0
index 367f49b..256ec50 100644
@@ -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
Signature · 1 line
1.9.0
#1 lore raw
Quoted 13 lines · 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.

---
 include/linux/pm_runtime.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/pm_runtime.h +0 -0
index 367f49b..256ec50 100644

include/linux/pm_runtime.h static inline void pm_runtime_dont_use_autosuspend(struct device *dev) · line 286

Quoted 10 lines
include/linux/pm_runtime.h +6 -0
@@ -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

#2 lore raw
Quoted 18 lines · Alan Stern
Quoted 16 lines · 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.

---
 include/linux/pm_runtime.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/pm_runtime.h +0 -0
index 367f49b..256ec50 100644
@@ -277,4 +277,10 @@ static inline void pm_runtime_dont_use_autosuspend(struct device *dev)
 	__pm_runtime_use_autosuspend(dev, false);
 }
 
Quoted 11 lines

include/linux/pm_runtime.h static inline void pm_runtime_dont_use_autosuspend(struct device *dev) · line 286

Quoted 7 lines
include/linux/pm_runtime.h +6 -0
+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.

Quoted 2 lines

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

Signature · 1 line
~Vinod
#3 lore raw
Quoted 30 lines · Vinod Koul
Quoted 18 lines · Alan Stern
Quoted 16 lines · 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.

---
 include/linux/pm_runtime.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/pm_runtime.h +0 -0
index 367f49b..256ec50 100644
@@ -277,4 +277,10 @@ static inline void pm_runtime_dont_use_autosuspend(struct device *dev)
 	__pm_runtime_use_autosuspend(dev, false);
 }
 
Quoted 11 lines

include/linux/pm_runtime.h static inline void pm_runtime_dont_use_autosuspend(struct device *dev) · line 286

Quoted 7 lines
include/linux/pm_runtime.h +6 -0
+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!)

Quoted 2 lines

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

#4 lore raw
Quoted 37 lines · Alan Stern
Quoted 30 lines · Vinod Koul
Quoted 18 lines · Alan Stern
Quoted 16 lines · 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.

---
 include/linux/pm_runtime.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/pm_runtime.h +0 -0
index 367f49b..256ec50 100644
@@ -277,4 +277,10 @@ static inline void pm_runtime_dont_use_autosuspend(struct device *dev)
 	__pm_runtime_use_autosuspend(dev, false);
 }
 
Quoted 11 lines

include/linux/pm_runtime.h static inline void pm_runtime_dont_use_autosuspend(struct device *dev) · line 286

Quoted 7 lines
include/linux/pm_runtime.h +6 -0
+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!)

Quoted 2 lines

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

Quoted 8 lines
	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!

Signature · 1 line
~Vinod
#5 lore raw
Quoted 11 lines · Vinod Koul
Quoted 11 lines
Quoted 5 lines
Quoted 3 lines

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);
Quoted 6 lines
Quoted 5 lines

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

#6 lore raw
Quoted 15 lines · Alan Stern
Quoted 13 lines · Vinod Koul
Quoted 13 lines
Quoted 5 lines
Quoted 3 lines

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

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
	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.

Quoted 1 line

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

Quoted 1 line

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

Signature · 1 line
~Vinod