aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2012-04-23 03:16:36 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-11 18:58:04 -0400
commitbdd4034df8b37841eeaf7b05f86e732ab8e0b08a (patch)
tree9f20c1b00803d17316f55930512f4fe39bef56d9 /drivers/base
parentcfaf025112d3856637ff34a767ef785ef5cf2ca9 (diff)
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 346be8b78b24..846d12b5d579 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,
1754 set_dev_node(dev, dev_to_node(new_parent)); 1754 set_dev_node(dev, dev_to_node(new_parent));
1755 } 1755 }
1756 1756
1757 if (!dev->class) 1757 if (dev->class) {
1758 goto out_put; 1758 error = device_move_class_links(dev, old_parent, new_parent);
1759 error = device_move_class_links(dev, old_parent, new_parent); 1759 if (error) {
1760 if (error) { 1760 /* We ignore errors on cleanup since we're hosed anyway... */
1761 /* We ignore errors on cleanup since we're hosed anyway... */ 1761 device_move_class_links(dev, new_parent, old_parent);
1762 device_move_class_links(dev, new_parent, old_parent); 1762 if (!kobject_move(&dev->kobj, &old_parent->kobj)) {
1763 if (!kobject_move(&dev->kobj, &old_parent->kobj)) { 1763 if (new_parent)
1764 if (new_parent) 1764 klist_remove(&dev->p->knode_parent);
1765 klist_remove(&dev->p->knode_parent); 1765 dev->parent = old_parent;
1766 dev->parent = old_parent; 1766 if (old_parent) {
1767 if (old_parent) { 1767 klist_add_tail(&dev->p->knode_parent,
1768 klist_add_tail(&dev->p->knode_parent, 1768 &old_parent->p->klist_children);
1769 &old_parent->p->klist_children); 1769 set_dev_node(dev, dev_to_node(old_parent));
1770 set_dev_node(dev, dev_to_node(old_parent)); 1770 }
1771 } 1771 }
1772 cleanup_glue_dir(dev, new_parent_kobj);
1773 put_device(new_parent);
1774 goto out;
1772 } 1775 }
1773 cleanup_glue_dir(dev, new_parent_kobj);
1774 put_device(new_parent);
1775 goto out;
1776 } 1776 }
1777 switch (dpm_order) { 1777 switch (dpm_order) {
1778 case DPM_ORDER_NONE: 1778 case DPM_ORDER_NONE:
@@ -1787,7 +1787,7 @@ int device_move(struct device *dev, struct device *new_parent,
1787 device_pm_move_last(dev); 1787 device_pm_move_last(dev);
1788 break; 1788 break;
1789 } 1789 }
1790out_put: 1790
1791 put_device(old_parent); 1791 put_device(old_parent);
1792out: 1792out:
1793 device_pm_unlock(); 1793 device_pm_unlock();