Commit 2ec16150 authored by Jeffy Chen's avatar Jeffy Chen Committed by Greg Kroah-Hartman

driver core: Move device_links_purge() after bus_remove_device()

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().

Fixes: 9ed98953 (driver core: Functional dependencies tracking support)
Signed-off-by: default avatarJeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 82d8ba71
...@@ -1958,7 +1958,6 @@ void device_del(struct device *dev) ...@@ -1958,7 +1958,6 @@ void device_del(struct device *dev)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier, blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
BUS_NOTIFY_DEL_DEVICE, dev); BUS_NOTIFY_DEL_DEVICE, dev);
device_links_purge(dev);
dpm_sysfs_remove(dev); dpm_sysfs_remove(dev);
if (parent) if (parent)
klist_del(&dev->p->knode_parent); klist_del(&dev->p->knode_parent);
...@@ -1986,6 +1985,7 @@ void device_del(struct device *dev) ...@@ -1986,6 +1985,7 @@ void device_del(struct device *dev)
device_pm_remove(dev); device_pm_remove(dev);
driver_deferred_probe_del(dev); driver_deferred_probe_del(dev);
device_remove_properties(dev); device_remove_properties(dev);
device_links_purge(dev);
/* Notify the platform of the removal, in case they /* Notify the platform of the removal, in case they
* need to do anything... * need to do anything...
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment