Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28299
b: refs/heads/master
c: e9a7d30
h: refs/heads/master
i:
  28297: 0b59529
  28295: 514cbe9
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Jun 21, 2006
1 parent 8b38182 commit ca01e57
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b9d9c82b4d081feb464f62dfc786c8621d09ecd2
refs/heads/master: e9a7d305faec364ba973d6c22c9b1e802ef79204
11 changes: 11 additions & 0 deletions trunk/drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ void device_initialize(struct device *dev)
int device_add(struct device *dev)
{
struct device *parent = NULL;
char *class_name = NULL;
int error = -EINVAL;

dev = get_device(dev);
Expand Down Expand Up @@ -324,6 +325,10 @@ int device_add(struct device *dev)
"subsystem");
sysfs_create_link(&dev->class->subsys.kset.kobj, &dev->kobj,
dev->bus_id);

sysfs_create_link(&dev->kobj, &dev->parent->kobj, "device");
class_name = make_class_name(dev->class->name, &dev->kobj);
sysfs_create_link(&dev->parent->kobj, &dev->kobj, class_name);
}

if ((error = device_pm_add(dev)))
Expand All @@ -339,6 +344,7 @@ int device_add(struct device *dev)
if (platform_notify)
platform_notify(dev);
Done:
kfree(class_name);
put_device(dev);
return error;
BusError:
Expand Down Expand Up @@ -420,6 +426,7 @@ void put_device(struct device * dev)
void device_del(struct device * dev)
{
struct device * parent = dev->parent;
char *class_name = NULL;

if (parent)
klist_del(&dev->knode_parent);
Expand All @@ -428,6 +435,10 @@ void device_del(struct device * dev)
if (dev->class) {
sysfs_remove_link(&dev->kobj, "subsystem");
sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id);
class_name = make_class_name(dev->class->name, &dev->kobj);
sysfs_remove_link(&dev->kobj, "device");
sysfs_remove_link(&dev->parent->kobj, class_name);
kfree(class_name);
}
device_remove_file(dev, &dev->uevent_attr);

Expand Down

0 comments on commit ca01e57

Please sign in to comment.