All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM: fix irq enable/disable in runtime PM code
@ 2009-11-24 20:22 Alan Stern
  2009-11-24 22:30 ` Rafael J. Wysocki
  2009-11-25  0:18 ` Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: Alan Stern @ 2009-11-24 20:22 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux-pm mailing list

This patch (as1305) fixes a bug in the irq-enable settings and removes
some related overhead in the runtime PM code.

	In __pm_runtime_resume(), within the scope of the original
	spin_lock_irq(), we know that irqs are disabled.  There's no
	reason to go through a pair of enable/disable cycles when
	acquiring and releasing the parent's lock.

	In __pm_runtime_set_status(), irqs are already disabled when
	the parent's lock is acquired, and they must remain disabled
	when it is released.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

---

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
@@ -332,11 +332,11 @@ int __pm_runtime_resume(struct device *d
 		 * necessary.
 		 */
 		parent = dev->parent;
-		spin_unlock_irq(&dev->power.lock);
+		spin_unlock(&dev->power.lock);
 
 		pm_runtime_get_noresume(parent);
 
-		spin_lock_irq(&parent->power.lock);
+		spin_lock(&parent->power.lock);
 		/*
 		 * We can resume if the parent's run-time PM is disabled or it
 		 * is set to ignore children.
@@ -347,9 +347,9 @@ int __pm_runtime_resume(struct device *d
 			if (parent->power.runtime_status != RPM_ACTIVE)
 				retval = -EBUSY;
 		}
-		spin_unlock_irq(&parent->power.lock);
+		spin_unlock(&parent->power.lock);
 
-		spin_lock_irq(&dev->power.lock);
+		spin_lock(&dev->power.lock);
 		if (retval)
 			goto out;
 		goto repeat;
@@ -781,7 +781,7 @@ int __pm_runtime_set_status(struct devic
 	}
 
 	if (parent) {
-		spin_lock_irq(&parent->power.lock);
+		spin_lock(&parent->power.lock);
 
 		/*
 		 * It is invalid to put an active child under a parent that is
@@ -797,7 +797,7 @@ int __pm_runtime_set_status(struct devic
 				atomic_inc(&parent->power.child_count);
 		}
 
-		spin_unlock_irq(&parent->power.lock);
+		spin_unlock(&parent->power.lock);
 
 		if (error)
 			goto out;

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

* Re: [PATCH] PM: fix irq enable/disable in runtime PM code
  2009-11-24 20:22 [PATCH] PM: fix irq enable/disable in runtime PM code Alan Stern
@ 2009-11-24 22:30 ` Rafael J. Wysocki
  2009-11-25  0:18 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2009-11-24 22:30 UTC (permalink / raw)
  To: Alan Stern; +Cc: Linux-pm mailing list

On Tuesday 24 November 2009, Alan Stern wrote:
> This patch (as1305) fixes a bug in the irq-enable settings and removes
> some related overhead in the runtime PM code.
> 
> 	In __pm_runtime_resume(), within the scope of the original
> 	spin_lock_irq(), we know that irqs are disabled.  There's no
> 	reason to go through a pair of enable/disable cycles when
> 	acquiring and releasing the parent's lock.
> 
> 	In __pm_runtime_set_status(), irqs are already disabled when
> 	the parent's lock is acquired, and they must remain disabled
> 	when it is released.
> 
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

Thanks for the patch, I'll apply it shortly.

Rafael

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

* Re: [PATCH] PM: fix irq enable/disable in runtime PM code
  2009-11-24 20:22 [PATCH] PM: fix irq enable/disable in runtime PM code Alan Stern
  2009-11-24 22:30 ` Rafael J. Wysocki
@ 2009-11-25  0:18 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2009-11-25  0:18 UTC (permalink / raw)
  To: Alan Stern; +Cc: Linux-pm mailing list

On Tuesday 24 November 2009, Alan Stern wrote:
> This patch (as1305) fixes a bug in the irq-enable settings and removes
> some related overhead in the runtime PM code.
> 
> 	In __pm_runtime_resume(), within the scope of the original
> 	spin_lock_irq(), we know that irqs are disabled.  There's no
> 	reason to go through a pair of enable/disable cycles when
> 	acquiring and releasing the parent's lock.
> 
> 	In __pm_runtime_set_status(), irqs are already disabled when
> 	the parent's lock is acquired, and they must remain disabled
> 	when it is released.
> 
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

Applied to suspend-2.6/linux-next.

I'll try to push it to Linus before 2.6.32.

Thanks,
Rafael

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

end of thread, other threads:[~2009-11-25  0:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-24 20:22 [PATCH] PM: fix irq enable/disable in runtime PM code Alan Stern
2009-11-24 22:30 ` Rafael J. Wysocki
2009-11-25  0:18 ` Rafael J. Wysocki

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.