From patchwork Mon Apr 23 07:16:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 8017 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id EB5B323E13 for ; Mon, 23 Apr 2012 07:17:50 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 95122A187EF for ; Mon, 23 Apr 2012 07:17:50 +0000 (UTC) Received: by iage36 with SMTP id e36so22286679iag.11 for ; Mon, 23 Apr 2012 00:17:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=/3ax932GvU7uoR3urzEWhlnSCrbkoW+mQfxzvlwPi5U=; b=SqeVAmaJpPQpSB471UO0LtT+KkjHQxc26QXD4gYNXm0exdY8W5s2D9Ax2P4Jag3cGf 7N81VHvxXhggsszIhyow/WxuEeX3VOo0AGZTrQN//m2WN2vi0OzPuAsXwYc99r0bHwtl 9+J37zeANhRweZL0lNGnFI+TJhwDeFWAI4bglXyHRp09TEOaa3pUnE7qxBRnKBcudXgW QfR4l+BmJqKV0udLxH4ioQ7Ey7j79LJT8cmzxb8YA1K+Bey6V0WKsQ2mP8teXJkIJSTU tUVcT2KGAbQzZHfhEP2p2MyoXkLQGz4h/jXQ2s534CLBLxz27Ir7e4Hrut/w/fRbXK3z OvOQ== Received: by 10.50.194.163 with SMTP id hx3mr5326137igc.49.1335165470017; Mon, 23 Apr 2012 00:17:50 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.137.198 with SMTP id x6csp91610ibt; Mon, 23 Apr 2012 00:17:49 -0700 (PDT) Received: by 10.14.95.141 with SMTP id p13mr905814eef.112.1335165468284; Mon, 23 Apr 2012 00:17:48 -0700 (PDT) Received: from eu1sys200aog101.obsmtp.com (eu1sys200aog101.obsmtp.com. [207.126.144.111]) by mx.google.com with SMTP id a2si4124097eeg.206.2012.04.23.00.17.44 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Apr 2012 00:17:48 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.111 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.111; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.111 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob101.postini.com ([207.126.147.11]) with SMTP ID DSNKT5UCGO2uoAwb1B4ejzrbSjWHL0EfyqUp@postini.com; Mon, 23 Apr 2012 07:17:48 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 5F10315F; Mon, 23 Apr 2012 07:16:50 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 68E931F12; Mon, 23 Apr 2012 07:16:50 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 442CE24C2F2; Mon, 23 Apr 2012 09:16:45 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 23 Apr 2012 09:16:49 +0200 From: Linus Walleij To: , Greg Kroah-Hartman , "Rafael J. Wysocki" Cc: Rabin Vincent , Linus Walleij Subject: [PATCH RESEND] driver core: always handle dpm_order Date: Mon, 23 Apr 2012 09:16:36 +0200 Message-ID: <1335165396-23604-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.9.2 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmVhNYlTm1mOp3qnOYbMWe9hm6e6qIiW8n91szQb/SSvotobNWWzGSuv5KDa182tNpV6EJe From: Rabin Vincent If !dev->class, device_move() does not respect the dpm_order. Fix it to do so. Cc: Rafael J. Wysocki Signed-off-by: Rabin Vincent Reviewed-by: Srinidhi Kasagar [Fixed a small dangling label compile warning] Signed-off-by: Linus Walleij --- 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 e28ce98..f428321 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1753,25 +1753,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: @@ -1786,7 +1786,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();