Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 2352
b: refs/heads/master
c: 2287c32
h: refs/heads/master
v: v3
  • Loading branch information
mochel@digitalimplant.org authored and Greg Kroah-Hartman committed Jun 20, 2005
1 parent adddd58 commit 45b273a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cb85b6f1cc811ecb9ed4b950206d8941ba710e68
refs/heads/master: 2287c322b61fced7e0c326a1a9606aa73147e3df
72 changes: 39 additions & 33 deletions trunk/drivers/base/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,28 @@ int driver_probe_device(struct device_driver * drv, struct device * dev)
return 0;
}

static int __device_attach(struct device_driver * drv, void * data)
{
struct device * dev = data;
int error;

error = driver_probe_device(drv, dev);

if (error == -ENODEV && error == -ENXIO) {
/* Driver matched, but didn't support device
* or device not found.
* Not an error; keep going.
*/
error = 0;
} else {
/* driver matched but the probe failed */
printk(KERN_WARNING
"%s: probe of %s failed with error %d\n",
drv->name, dev->bus_id, error);
}
return 0;
}

/**
* device_attach - try to attach device to a driver.
* @dev: device.
Expand All @@ -92,30 +114,31 @@ int driver_probe_device(struct device_driver * drv, struct device * dev)
*/
int device_attach(struct device * dev)
{
struct bus_type * bus = dev->bus;
struct list_head * entry;
int error;

if (dev->driver) {
device_bind_driver(dev);
return 1;
}

if (bus->match) {
list_for_each(entry, &bus->drivers.list) {
struct device_driver * drv = to_drv(entry);
error = driver_probe_device(drv, dev);
if (!error)
/* success, driver matched */
return 1;
if (error != -ENODEV && error != -ENXIO)
return bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
}

static int __driver_attach(struct device * dev, void * data)
{
struct device_driver * drv = data;
int error = 0;

if (!dev->driver) {
error = driver_probe_device(drv, dev);
if (error) {
if (error != -ENODEV) {
/* driver matched but the probe failed */
printk(KERN_WARNING
"%s: probe of %s failed with error %d\n",
drv->name, dev->bus_id, error);
"%s: probe of %s failed with error %d\n",
drv->name, dev->bus_id, error);
} else
error = 0;
}
}

return 0;
}

Expand All @@ -133,24 +156,7 @@ int device_attach(struct device * dev)
*/
void driver_attach(struct device_driver * drv)
{
struct bus_type * bus = drv->bus;
struct list_head * entry;
int error;

if (!bus->match)
return;

list_for_each(entry, &bus->devices.list) {
struct device * dev = container_of(entry, struct device, bus_list);
if (!dev->driver) {
error = driver_probe_device(drv, dev);
if (error && (error != -ENODEV))
/* driver matched but the probe failed */
printk(KERN_WARNING
"%s: probe of %s failed with error %d\n",
drv->name, dev->bus_id, error);
}
}
bus_for_each_dev(drv->bus, NULL, drv, __driver_attach);
}

/**
Expand Down

0 comments on commit 45b273a

Please sign in to comment.