summaryrefslogtreecommitdiffstats
path: root/drivers/base/bus.c
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2007-02-05 16:15:26 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2007-04-27 10:57:29 -0700
commitc6a46696f97ff260a4ecce5e287f8de4b9d7fe14 (patch)
tree335de50c9868cd575f535677e430677d33cbaaa1 /drivers/base/bus.c
parenteed40d3ad2ba652c08422d62a5ff6f62ac0be16d (diff)
downloadop-kernel-dev-c6a46696f97ff260a4ecce5e287f8de4b9d7fe14.zip
op-kernel-dev-c6a46696f97ff260a4ecce5e287f8de4b9d7fe14.tar.gz
driver core: don't fail attaching the device if it cannot be bound
Don't fail bus_attach_device() if the device cannot be bound. If dev->driver has been specified, reset it to NULL if device_bind_driver() failed and add the device as an unbound device. As a result, bus_attach_device() now cannot fail, and we can remove some checking from device_add(). Also remove an unneeded check in bus_rescan_devices_helper(). Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r--drivers/base/bus.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 9df2e6d..20b6dc8 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -447,7 +447,7 @@ out_put:
* - Add device to bus's list of devices.
* - Try to attach to driver.
*/
-int bus_attach_device(struct device * dev)
+void bus_attach_device(struct device * dev)
{
struct bus_type *bus = dev->bus;
int ret = 0;
@@ -456,13 +456,12 @@ int bus_attach_device(struct device * dev)
dev->is_registered = 1;
if (bus->drivers_autoprobe)
ret = device_attach(dev);
- if (ret >= 0) {
+ WARN_ON(ret < 0);
+ if (ret >= 0)
klist_add_tail(&dev->knode_bus, &bus->klist_devices);
- ret = 0;
- } else
+ else
dev->is_registered = 0;
}
- return ret;
}
/**
@@ -669,8 +668,6 @@ static int __must_check bus_rescan_devices_helper(struct device *dev,
ret = device_attach(dev);
if (dev->parent)
up(&dev->parent->sem);
- if (ret > 0)
- ret = 0;
}
return ret < 0 ? ret : 0;
}
OpenPOWER on IntegriCloud