Skip to content

Commit 56d16d4

Browse files
committed
Revert "driver core: separate function to shutdown one device"
This reverts commit 95dc756. The series is being reverted before -rc1 as there are still reports of lockups on shutdown, so it's not quite ready for "prime time." Reported-by: Andrey Skvortsov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: Christoph Hellwig <[email protected]> Cc: David Jeffery <[email protected]> Cc: Keith Busch <[email protected]> Cc: Laurence Oberman <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Sagi Grimberg <[email protected]> Cc: Stuart Hayes <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2efddb5 commit 56d16d4

File tree

1 file changed

+30
-36
lines changed

1 file changed

+30
-36
lines changed

drivers/base/core.c

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4779,41 +4779,6 @@ int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid)
47794779
}
47804780
EXPORT_SYMBOL_GPL(device_change_owner);
47814781

4782-
static void shutdown_one_device(struct device *dev)
4783-
{
4784-
/* hold lock to avoid race with probe/release */
4785-
if (dev->parent && dev->bus && dev->bus->need_parent_lock)
4786-
device_lock(dev->parent);
4787-
device_lock(dev);
4788-
4789-
/* Don't allow any more runtime suspends */
4790-
pm_runtime_get_noresume(dev);
4791-
pm_runtime_barrier(dev);
4792-
4793-
if (dev->class && dev->class->shutdown_pre) {
4794-
if (initcall_debug)
4795-
dev_info(dev, "shutdown_pre\n");
4796-
dev->class->shutdown_pre(dev);
4797-
}
4798-
if (dev->bus && dev->bus->shutdown) {
4799-
if (initcall_debug)
4800-
dev_info(dev, "shutdown\n");
4801-
dev->bus->shutdown(dev);
4802-
} else if (dev->driver && dev->driver->shutdown) {
4803-
if (initcall_debug)
4804-
dev_info(dev, "shutdown\n");
4805-
dev->driver->shutdown(dev);
4806-
}
4807-
4808-
device_unlock(dev);
4809-
if (dev->parent && dev->bus && dev->bus->need_parent_lock)
4810-
device_unlock(dev->parent);
4811-
4812-
put_device(dev);
4813-
if (dev->parent)
4814-
put_device(dev->parent);
4815-
}
4816-
48174782
/**
48184783
* device_shutdown - call ->shutdown() on each device to shutdown.
48194784
*/
@@ -4850,7 +4815,36 @@ void device_shutdown(void)
48504815
list_del_init(&dev->kobj.entry);
48514816
spin_unlock(&devices_kset->list_lock);
48524817

4853-
shutdown_one_device(dev);
4818+
/* hold lock to avoid race with probe/release */
4819+
if (parent && dev->bus && dev->bus->need_parent_lock)
4820+
device_lock(parent);
4821+
device_lock(dev);
4822+
4823+
/* Don't allow any more runtime suspends */
4824+
pm_runtime_get_noresume(dev);
4825+
pm_runtime_barrier(dev);
4826+
4827+
if (dev->class && dev->class->shutdown_pre) {
4828+
if (initcall_debug)
4829+
dev_info(dev, "shutdown_pre\n");
4830+
dev->class->shutdown_pre(dev);
4831+
}
4832+
if (dev->bus && dev->bus->shutdown) {
4833+
if (initcall_debug)
4834+
dev_info(dev, "shutdown\n");
4835+
dev->bus->shutdown(dev);
4836+
} else if (dev->driver && dev->driver->shutdown) {
4837+
if (initcall_debug)
4838+
dev_info(dev, "shutdown\n");
4839+
dev->driver->shutdown(dev);
4840+
}
4841+
4842+
device_unlock(dev);
4843+
if (parent && dev->bus && dev->bus->need_parent_lock)
4844+
device_unlock(parent);
4845+
4846+
put_device(dev);
4847+
put_device(parent);
48544848

48554849
spin_lock(&devices_kset->list_lock);
48564850
}

0 commit comments

Comments
 (0)