Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28886
b: refs/heads/master
c: 5d9fd16
h: refs/heads/master
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Jun 23, 2006
1 parent ede2123 commit 48ff754
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 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: 0517587e5896cef1d5f99d3b24f5f2ca15d952ad
refs/heads/master: 5d9fd169c9fbdaecdc430431e59bf94ff40b93d3
19 changes: 11 additions & 8 deletions trunk/drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,13 @@ int device_add(struct device *dev)
if (parent)
klist_add_tail(&dev->knode_parent, &parent->klist_children);

if (dev->class) {
/* tie the class to the device */
down(&dev->class->sem);
list_add_tail(&dev->node, &dev->class->devices);
up(&dev->class->sem);
}

/* notify platform of device entry */
if (platform_notify)
platform_notify(dev);
Expand Down Expand Up @@ -455,6 +462,9 @@ void device_del(struct device * dev)
sysfs_remove_link(&dev->kobj, "device");
sysfs_remove_link(&dev->parent->kobj, class_name);
kfree(class_name);
down(&dev->class->sem);
list_del_init(&dev->node);
up(&dev->class->sem);
}
device_remove_file(dev, &dev->uevent_attr);

Expand Down Expand Up @@ -601,11 +611,6 @@ struct device *device_create(struct class *class, struct device *parent,
if (retval)
goto error;

/* tie the class to the device */
down(&class->sem);
list_add_tail(&dev->node, &class->devices);
up(&class->sem);

return dev;

error:
Expand Down Expand Up @@ -636,9 +641,7 @@ void device_destroy(struct class *class, dev_t devt)
}
up(&class->sem);

if (dev) {
list_del_init(&dev->node);
if (dev)
device_unregister(dev);
}
}
EXPORT_SYMBOL_GPL(device_destroy);

0 comments on commit 48ff754

Please sign in to comment.