* [PATCH ver. 3] PM: allow for usage_count > 0 in pm_runtime_get()
@ 2009-12-07 15:51 Alan Stern
2009-12-07 20:26 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Alan Stern @ 2009-12-07 15:51 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Linux-pm mailing list
This patch (as1308c) fixes __pm_runtime_get(). Currently the routine
will resume a device if the prior usage count was 0. But this isn't
right; thanks to pm_runtime_get_noresume() the usage count can be
positive even while the device is suspended.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
---
Rafael:
This patch contains the most important part of the patch you rejected
last week, leaving out the semantic changes you didn't like. It really
does fix a bug, and it should be sent to Linus before the merge window
closes.
Alan Stern
Index: usb-2.6/drivers/base/power/runtime.c
===================================================================
--- usb-2.6.orig/drivers/base/power/runtime.c
+++ usb-2.6/drivers/base/power/runtime.c
@@ -699,15 +699,15 @@ EXPORT_SYMBOL_GPL(pm_request_resume);
* @dev: Device to handle.
* @sync: If set and the device is suspended, resume it synchronously.
*
- * Increment the usage count of the device and if it was zero previously,
- * resume it or submit a resume request for it, depending on the value of @sync.
+ * Increment the usage count of the device and resume it or submit a resume
+ * request for it, depending on the value of @sync.
*/
int __pm_runtime_get(struct device *dev, bool sync)
{
- int retval = 1;
+ int retval;
- if (atomic_add_return(1, &dev->power.usage_count) == 1)
- retval = sync ? pm_runtime_resume(dev) : pm_request_resume(dev);
+ atomic_inc(&dev->power.usage_count);
+ retval = sync ? pm_runtime_resume(dev) : pm_request_resume(dev);
return retval;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH ver. 3] PM: allow for usage_count > 0 in pm_runtime_get()
2009-12-07 15:51 [PATCH ver. 3] PM: allow for usage_count > 0 in pm_runtime_get() Alan Stern
@ 2009-12-07 20:26 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2009-12-07 20:26 UTC (permalink / raw)
To: Alan Stern; +Cc: Linux-pm mailing list
On Monday 07 December 2009, Alan Stern wrote:
> This patch (as1308c) fixes __pm_runtime_get(). Currently the routine
> will resume a device if the prior usage count was 0. But this isn't
> right; thanks to pm_runtime_get_noresume() the usage count can be
> positive even while the device is suspended.
>
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
>
> ---
>
> Rafael:
>
> This patch contains the most important part of the patch you rejected
> last week, leaving out the semantic changes you didn't like. It really
> does fix a bug, and it should be sent to Linus before the merge window
> closes.
Thanks, I'll include it into the next pull request.
Rafael
> Index: usb-2.6/drivers/base/power/runtime.c
> ===================================================================
> --- usb-2.6.orig/drivers/base/power/runtime.c
> +++ usb-2.6/drivers/base/power/runtime.c
> @@ -699,15 +699,15 @@ EXPORT_SYMBOL_GPL(pm_request_resume);
> * @dev: Device to handle.
> * @sync: If set and the device is suspended, resume it synchronously.
> *
> - * Increment the usage count of the device and if it was zero previously,
> - * resume it or submit a resume request for it, depending on the value of @sync.
> + * Increment the usage count of the device and resume it or submit a resume
> + * request for it, depending on the value of @sync.
> */
> int __pm_runtime_get(struct device *dev, bool sync)
> {
> - int retval = 1;
> + int retval;
>
> - if (atomic_add_return(1, &dev->power.usage_count) == 1)
> - retval = sync ? pm_runtime_resume(dev) : pm_request_resume(dev);
> + atomic_inc(&dev->power.usage_count);
> + retval = sync ? pm_runtime_resume(dev) : pm_request_resume(dev);
>
> return retval;
> }
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-07 20:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-07 15:51 [PATCH ver. 3] PM: allow for usage_count > 0 in pm_runtime_get() Alan Stern
2009-12-07 20:26 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox