aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-10 00:58:28 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-10 00:58:28 -0500
commit271368b69b9e8042063d6c713423e84503bbdaa0 (patch)
tree71d9c592d8b92bee80a03d2de74d1763b1282076 /drivers
parent117430b1fa3ae0b0bd981226bdb0c5412729c1db (diff)
parent9e993efb0da827634778554070f3c3ec4bdade33 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: kobject: new_device->kref wasn't putted after error in kobject_move() driver core: export device_rename Remove devfs from MAINTAINERS Driver core: add device symlink back to sysfs Revert "driver core: refcounting fix"
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/core.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 89ebe3682726..f191afe62b4d 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -584,17 +584,17 @@ int device_add(struct device *dev)
584 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 584 if (dev->kobj.parent != &dev->class->subsys.kset.kobj)
585 sysfs_create_link(&dev->class->subsys.kset.kobj, 585 sysfs_create_link(&dev->class->subsys.kset.kobj,
586 &dev->kobj, dev->bus_id); 586 &dev->kobj, dev->bus_id);
587#ifdef CONFIG_SYSFS_DEPRECATED
588 if (parent) { 587 if (parent) {
589 sysfs_create_link(&dev->kobj, &dev->parent->kobj, 588 sysfs_create_link(&dev->kobj, &dev->parent->kobj,
590 "device"); 589 "device");
590#ifdef CONFIG_SYSFS_DEPRECATED
591 class_name = make_class_name(dev->class->name, 591 class_name = make_class_name(dev->class->name,
592 &dev->kobj); 592 &dev->kobj);
593 if (class_name) 593 if (class_name)
594 sysfs_create_link(&dev->parent->kobj, 594 sysfs_create_link(&dev->parent->kobj,
595 &dev->kobj, class_name); 595 &dev->kobj, class_name);
596 }
597#endif 596#endif
597 }
598 } 598 }
599 599
600 if ((error = device_add_attrs(dev))) 600 if ((error = device_add_attrs(dev)))
@@ -651,17 +651,17 @@ int device_add(struct device *dev)
651 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 651 if (dev->kobj.parent != &dev->class->subsys.kset.kobj)
652 sysfs_remove_link(&dev->class->subsys.kset.kobj, 652 sysfs_remove_link(&dev->class->subsys.kset.kobj,
653 dev->bus_id); 653 dev->bus_id);
654#ifdef CONFIG_SYSFS_DEPRECATED
655 if (parent) { 654 if (parent) {
655#ifdef CONFIG_SYSFS_DEPRECATED
656 char *class_name = make_class_name(dev->class->name, 656 char *class_name = make_class_name(dev->class->name,
657 &dev->kobj); 657 &dev->kobj);
658 if (class_name) 658 if (class_name)
659 sysfs_remove_link(&dev->parent->kobj, 659 sysfs_remove_link(&dev->parent->kobj,
660 class_name); 660 class_name);
661 kfree(class_name); 661 kfree(class_name);
662#endif
662 sysfs_remove_link(&dev->kobj, "device"); 663 sysfs_remove_link(&dev->kobj, "device");
663 } 664 }
664#endif
665 665
666 down(&dev->class->sem); 666 down(&dev->class->sem);
667 /* notify any interfaces that the device is now gone */ 667 /* notify any interfaces that the device is now gone */
@@ -761,17 +761,17 @@ void device_del(struct device * dev)
761 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 761 if (dev->kobj.parent != &dev->class->subsys.kset.kobj)
762 sysfs_remove_link(&dev->class->subsys.kset.kobj, 762 sysfs_remove_link(&dev->class->subsys.kset.kobj,
763 dev->bus_id); 763 dev->bus_id);
764#ifdef CONFIG_SYSFS_DEPRECATED
765 if (parent) { 764 if (parent) {
765#ifdef CONFIG_SYSFS_DEPRECATED
766 char *class_name = make_class_name(dev->class->name, 766 char *class_name = make_class_name(dev->class->name,
767 &dev->kobj); 767 &dev->kobj);
768 if (class_name) 768 if (class_name)
769 sysfs_remove_link(&dev->parent->kobj, 769 sysfs_remove_link(&dev->parent->kobj,
770 class_name); 770 class_name);
771 kfree(class_name); 771 kfree(class_name);
772#endif
772 sysfs_remove_link(&dev->kobj, "device"); 773 sysfs_remove_link(&dev->kobj, "device");
773 } 774 }
774#endif
775 775
776 down(&dev->class->sem); 776 down(&dev->class->sem);
777 /* notify any interfaces that the device is now gone */ 777 /* notify any interfaces that the device is now gone */
@@ -1065,14 +1065,14 @@ int device_rename(struct device *dev, char *new_name)
1065 1065
1066 return error; 1066 return error;
1067} 1067}
1068 1068EXPORT_SYMBOL_GPL(device_rename);
1069 1069
1070static int device_move_class_links(struct device *dev, 1070static int device_move_class_links(struct device *dev,
1071 struct device *old_parent, 1071 struct device *old_parent,
1072 struct device *new_parent) 1072 struct device *new_parent)
1073{ 1073{
1074 int error = 0;
1074#ifdef CONFIG_SYSFS_DEPRECATED 1075#ifdef CONFIG_SYSFS_DEPRECATED
1075 int error;
1076 char *class_name; 1076 char *class_name;
1077 1077
1078 class_name = make_class_name(dev->class->name, &dev->kobj); 1078 class_name = make_class_name(dev->class->name, &dev->kobj);
@@ -1100,7 +1100,12 @@ out:
1100 kfree(class_name); 1100 kfree(class_name);
1101 return error; 1101 return error;
1102#else 1102#else
1103 return 0; 1103 if (old_parent)
1104 sysfs_remove_link(&dev->kobj, "device");
1105 if (new_parent)
1106 error = sysfs_create_link(&dev->kobj, &new_parent->kobj,
1107 "device");
1108 return error;
1104#endif 1109#endif
1105} 1110}
1106 1111