[PATCH] Add bus_type probe, remove, shutdown methods.
Add bus_type probe, remove and shutdown methods to replace the corresponding methods in struct device_driver. This matches the way we handle the suspend/resume methods. Since the bus methods override the device_driver methods, warn if a device driver is registered whose methods will not be called. The long-term idea is to remove the device_driver methods entirely. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
bd37e5a951
commit
594c8281f9
@@ -78,7 +78,13 @@ int driver_probe_device(struct device_driver * drv, struct device * dev)
|
||||
pr_debug("%s: Matched Device %s with Driver %s\n",
|
||||
drv->bus->name, dev->bus_id, drv->name);
|
||||
dev->driver = drv;
|
||||
if (drv->probe) {
|
||||
if (dev->bus->probe) {
|
||||
ret = dev->bus->probe(dev);
|
||||
if (ret) {
|
||||
dev->driver = NULL;
|
||||
goto ProbeFailed;
|
||||
}
|
||||
} else if (drv->probe) {
|
||||
ret = drv->probe(dev);
|
||||
if (ret) {
|
||||
dev->driver = NULL;
|
||||
@@ -203,7 +209,9 @@ static void __device_release_driver(struct device * dev)
|
||||
sysfs_remove_link(&dev->kobj, "driver");
|
||||
klist_remove(&dev->knode_driver);
|
||||
|
||||
if (drv->remove)
|
||||
if (dev->bus->remove)
|
||||
dev->bus->remove(dev);
|
||||
else if (drv->remove)
|
||||
drv->remove(dev);
|
||||
dev->driver = NULL;
|
||||
put_driver(drv);
|
||||
|
Reference in New Issue
Block a user