From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753830AbdJSO4Y (ORCPT ); Thu, 19 Oct 2017 10:56:24 -0400 Received: from mga02.intel.com ([134.134.136.20]:4557 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753631AbdJSO4X (ORCPT ); Thu, 19 Oct 2017 10:56:23 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,402,1503385200"; d="scan'208";a="140052978" Subject: Re: [PATCH v2] driver core: Move device_links_purge() after bus_remove_device() To: Jeffy Chen Cc: linux-kernel@vger.kernel.org, briannorris@chromium.org, heiko@sntech.de, gregkh@linuxfoundation.org, dmitry.torokhov@gmail.com, rjw@rjwysocki.net, dianders@chromium.org, tfiga@chromium.org, broonie@kernel.org, seanpaul@chromium.org, thierry.reding@gmail.com References: <20171019013215.6559-1-jeffy.chen@rock-chips.com> From: "Rafael J. Wysocki" Organization: Intel Technology Poland Sp. z o. o., KRS 101882, ul. Slowackiego 173, 80-298 Gdansk Message-ID: Date: Thu, 19 Oct 2017 16:56:19 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171019013215.6559-1-jeffy.chen@rock-chips.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/19/2017 3:32 AM, Jeffy Chen wrote: > The current ordering of code in device_del() triggers a WARN_ON() > in device_links_purge(), because of an unexpected link status. > > The device_links_unbind_consumers() call in device_release_driver() > has to take place before device_links_purge() for the status of all > links to be correct, so move the device_links_purge() call in > device_del() after the invocation of bus_remove_device() which calls > device_release_driver(). > > Signed-off-by: Rafael J. Wysocki It has not been signed off by me, so you should not have added the line above. > Signed-off-by: Jeffy Chen For the patch itself and the changelog *except* for the S-o-b line: Reviewed-by: Rafael J. Wysocki > --- > > Changes in v2: > Update commit message provided by Rafael. > > drivers/base/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/base/core.c b/drivers/base/core.c > index 12ebd055724c..2e683cdf4a08 100644 > --- a/drivers/base/core.c > +++ b/drivers/base/core.c > @@ -1958,7 +1958,6 @@ void device_del(struct device *dev) > blocking_notifier_call_chain(&dev->bus->p->bus_notifier, > BUS_NOTIFY_DEL_DEVICE, dev); > > - device_links_purge(dev); > dpm_sysfs_remove(dev); > if (parent) > klist_del(&dev->p->knode_parent); > @@ -1986,6 +1985,7 @@ void device_del(struct device *dev) > device_pm_remove(dev); > driver_deferred_probe_del(dev); > device_remove_properties(dev); > + device_links_purge(dev); > > /* Notify the platform of the removal, in case they > * need to do anything...