aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-06-20 16:59:20 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-21 15:40:49 -0400
commite9a7d305faec364ba973d6c22c9b1e802ef79204 (patch)
tree1bd38fb8f39d4895734885fd7b6f52c14222e481 /drivers/base
parentb9d9c82b4d081feb464f62dfc786c8621d09ecd2 (diff)
[PATCH] Driver core: add proper symlinks for devices
We need to create the "compatible" symlinks that class_devices used to create when they were in the class directories so that userspace does not know anything changed at all. Yeah, we have a lot of symlinks now, but we should be able to get rid of them in a year or two... (wishful thinking...) Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index cc8bb97427d..a979bc3f49a 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -273,6 +273,7 @@ void device_initialize(struct device *dev)
273int device_add(struct device *dev) 273int device_add(struct device *dev)
274{ 274{
275 struct device *parent = NULL; 275 struct device *parent = NULL;
276 char *class_name = NULL;
276 int error = -EINVAL; 277 int error = -EINVAL;
277 278
278 dev = get_device(dev); 279 dev = get_device(dev);
@@ -324,6 +325,10 @@ int device_add(struct device *dev)
324 "subsystem"); 325 "subsystem");
325 sysfs_create_link(&dev->class->subsys.kset.kobj, &dev->kobj, 326 sysfs_create_link(&dev->class->subsys.kset.kobj, &dev->kobj,
326 dev->bus_id); 327 dev->bus_id);
328
329 sysfs_create_link(&dev->kobj, &dev->parent->kobj, "device");
330 class_name = make_class_name(dev->class->name, &dev->kobj);
331 sysfs_create_link(&dev->parent->kobj, &dev->kobj, class_name);
327 } 332 }
328 333
329 if ((error = device_pm_add(dev))) 334 if ((error = device_pm_add(dev)))
@@ -339,6 +344,7 @@ int device_add(struct device *dev)
339 if (platform_notify) 344 if (platform_notify)
340 platform_notify(dev); 345 platform_notify(dev);
341 Done: 346 Done:
347 kfree(class_name);
342 put_device(dev); 348 put_device(dev);
343 return error; 349 return error;
344 BusError: 350 BusError:
@@ -420,6 +426,7 @@ void put_device(struct device * dev)
420void device_del(struct device * dev) 426void device_del(struct device * dev)
421{ 427{
422 struct device * parent = dev->parent; 428 struct device * parent = dev->parent;
429 char *class_name = NULL;
423 430
424 if (parent) 431 if (parent)
425 klist_del(&dev->knode_parent); 432 klist_del(&dev->knode_parent);
@@ -428,6 +435,10 @@ void device_del(struct device * dev)
428 if (dev->class) { 435 if (dev->class) {
429 sysfs_remove_link(&dev->kobj, "subsystem"); 436 sysfs_remove_link(&dev->kobj, "subsystem");
430 sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id); 437 sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id);
438 class_name = make_class_name(dev->class->name, &dev->kobj);
439 sysfs_remove_link(&dev->kobj, "device");
440 sysfs_remove_link(&dev->parent->kobj, class_name);
441 kfree(class_name);
431 } 442 }
432 device_remove_file(dev, &dev->uevent_attr); 443 device_remove_file(dev, &dev->uevent_attr);
433 444