summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2012-04-23 09:16:36 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-11 15:58:04 -0700
commitbdd4034df8b37841eeaf7b05f86e732ab8e0b08a (patch)
tree9f20c1b00803d17316f55930512f4fe39bef56d9 /drivers/base
parentcfaf025112d3856637ff34a767ef785ef5cf2ca9 (diff)
downloadop-kernel-dev-bdd4034df8b37841eeaf7b05f86e732ab8e0b08a.zip
op-kernel-dev-bdd4034df8b37841eeaf7b05f86e732ab8e0b08a.tar.gz
driver core: always handle dpm_order
If !dev->class, device_move() does not respect the dpm_order. Fix it to do so. Acked-by: Rafael J. Wysocki <rjw@sisk.pl> 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 346be8b..846d12b 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1754,25 +1754,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:
@@ -1787,7 +1787,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();
OpenPOWER on IntegriCloud