Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 14656
b: refs/heads/master
c: 2b08c8d
h: refs/heads/master
v: v3
  • Loading branch information
Alan Stern authored and Linus Torvalds committed Nov 24, 2005
1 parent 5bb6e3e commit c8410b2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 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: 133747e8d1e912863edfb3869e36b97b9939d4fc
refs/heads/master: 2b08c8d0468866f86da97f836c6ac14338cb81a9
21 changes: 9 additions & 12 deletions trunk/drivers/base/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static struct kobj_type ktype_bus = {
decl_subsys(bus, &ktype_bus, NULL);


/* Manually detach a device from it's associated driver. */
/* Manually detach a device from its associated driver. */
static int driver_helper(struct device *dev, void *data)
{
const char *name = data;
Expand All @@ -151,14 +151,13 @@ static ssize_t driver_unbind(struct device_driver *drv,
int err = -ENODEV;

dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
if ((dev) &&
(dev->driver == drv)) {
if (dev && dev->driver == drv) {
device_release_driver(dev);
err = count;
}
if (err)
return err;
return count;
put_device(dev);
put_bus(bus);
return err;
}
static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind);

Expand All @@ -175,16 +174,14 @@ static ssize_t driver_bind(struct device_driver *drv,
int err = -ENODEV;

dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
if ((dev) &&
(dev->driver == NULL)) {
if (dev && dev->driver == NULL) {
down(&dev->sem);
err = driver_probe_device(drv, dev);
up(&dev->sem);
put_device(dev);
}
if (err)
return err;
return count;
put_device(dev);
put_bus(bus);
return err;
}
static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);

Expand Down
8 changes: 3 additions & 5 deletions trunk/drivers/base/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ void device_bind_driver(struct device * dev)
* because we don't know the format of the ID structures, nor what
* is to be considered a match and what is not.
*
*
* This function returns 1 if a match is found, an error if one
* occurs (that is not -ENODEV or -ENXIO), and 0 otherwise.
*
Expand Down Expand Up @@ -158,7 +157,6 @@ static int __driver_attach(struct device * dev, void * data)
driver_probe_device(drv, dev);
up(&dev->sem);


return 0;
}

Expand Down Expand Up @@ -225,15 +223,15 @@ void driver_detach(struct device_driver * drv)
struct device * dev;

for (;;) {
spin_lock_irq(&drv->klist_devices.k_lock);
spin_lock(&drv->klist_devices.k_lock);
if (list_empty(&drv->klist_devices.k_list)) {
spin_unlock_irq(&drv->klist_devices.k_lock);
spin_unlock(&drv->klist_devices.k_lock);
break;
}
dev = list_entry(drv->klist_devices.k_list.prev,
struct device, knode_driver.n_node);
get_device(dev);
spin_unlock_irq(&drv->klist_devices.k_lock);
spin_unlock(&drv->klist_devices.k_lock);

down(&dev->sem);
if (dev->driver == drv)
Expand Down

0 comments on commit c8410b2

Please sign in to comment.