public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] driver core: always handle dpm_order
@ 2012-03-15  9:58 Linus Walleij
  2012-03-15 15:43 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 9+ messages in thread
From: Linus Walleij @ 2012-03-15  9:58 UTC (permalink / raw)
  To: linux-kernel, Greg Kroah-Hartman; +Cc: Rabin Vincent, Linus Walleij

From: Rabin Vincent <rabin.vincent@stericsson.com>

If !dev->class, device_move() does not respect the dpm_order.
Fix it to do so.

Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
[Fixed a small dangling label compile warning]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/base/core.c |   36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 74dda4f..be07591 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1746,25 +1746,25 @@ int device_move(struct device *dev, struct device *new_parent,
 		set_dev_node(dev, dev_to_node(new_parent));
 	}
 
-	if (!dev->class)
-		goto out_put;
-	error = device_move_class_links(dev, old_parent, new_parent);
-	if (error) {
-		/* We ignore errors on cleanup since we're hosed anyway... */
-		device_move_class_links(dev, new_parent, old_parent);
-		if (!kobject_move(&dev->kobj, &old_parent->kobj)) {
-			if (new_parent)
-				klist_remove(&dev->p->knode_parent);
-			dev->parent = old_parent;
-			if (old_parent) {
-				klist_add_tail(&dev->p->knode_parent,
-					       &old_parent->p->klist_children);
-				set_dev_node(dev, dev_to_node(old_parent));
+	if (dev->class) {
+		error = device_move_class_links(dev, old_parent, new_parent);
+		if (error) {
+			/* We ignore errors on cleanup since we're hosed anyway... */
+			device_move_class_links(dev, new_parent, old_parent);
+			if (!kobject_move(&dev->kobj, &old_parent->kobj)) {
+				if (new_parent)
+					klist_remove(&dev->p->knode_parent);
+				dev->parent = old_parent;
+				if (old_parent) {
+					klist_add_tail(&dev->p->knode_parent,
+						       &old_parent->p->klist_children);
+					set_dev_node(dev, dev_to_node(old_parent));
+				}
 			}
+			cleanup_glue_dir(dev, new_parent_kobj);
+			put_device(new_parent);
+			goto out;
 		}
-		cleanup_glue_dir(dev, new_parent_kobj);
-		put_device(new_parent);
-		goto out;
 	}
 	switch (dpm_order) {
 	case DPM_ORDER_NONE:
@@ -1779,7 +1779,7 @@ int device_move(struct device *dev, struct device *new_parent,
 		device_pm_move_last(dev);
 		break;
 	}
-out_put:
+
 	put_device(old_parent);
 out:
 	device_pm_unlock();
-- 
1.7.9.2


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

end of thread, other threads:[~2012-04-18 20:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-15  9:58 [PATCH] driver core: always handle dpm_order Linus Walleij
2012-03-15 15:43 ` Greg Kroah-Hartman
2012-03-19  8:30   ` Rabin Vincent
2012-04-10 10:51   ` Linus Walleij
2012-04-10 14:36     ` Greg Kroah-Hartman
2012-04-11  7:24       ` Linus Walleij
2012-04-10 22:21     ` Rafael J. Wysocki
2012-04-11  7:20       ` Linus Walleij
2012-04-18 20:01         ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox