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"

+16 -18
-3
MAINTAINERS
··· 1103 1103 L: linux-kernel@vger.kernel.org 1104 1104 S: Maintained 1105 1105 1106 - DEVICE FILESYSTEM 1107 - S: Obsolete 1108 - 1109 1106 DIGI INTL. EPCA DRIVER 1110 1107 P: Digi International, Inc 1111 1108 M: Eng.Linux@digi.com
+14 -9
drivers/base/core.c
··· 584 584 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 585 585 sysfs_create_link(&dev->class->subsys.kset.kobj, 586 586 &dev->kobj, dev->bus_id); 587 - #ifdef CONFIG_SYSFS_DEPRECATED 588 587 if (parent) { 589 588 sysfs_create_link(&dev->kobj, &dev->parent->kobj, 590 589 "device"); 590 + #ifdef CONFIG_SYSFS_DEPRECATED 591 591 class_name = make_class_name(dev->class->name, 592 592 &dev->kobj); 593 593 if (class_name) 594 594 sysfs_create_link(&dev->parent->kobj, 595 595 &dev->kobj, class_name); 596 - } 597 596 #endif 597 + } 598 598 } 599 599 600 600 if ((error = device_add_attrs(dev))) ··· 651 651 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 652 652 sysfs_remove_link(&dev->class->subsys.kset.kobj, 653 653 dev->bus_id); 654 - #ifdef CONFIG_SYSFS_DEPRECATED 655 654 if (parent) { 655 + #ifdef CONFIG_SYSFS_DEPRECATED 656 656 char *class_name = make_class_name(dev->class->name, 657 657 &dev->kobj); 658 658 if (class_name) 659 659 sysfs_remove_link(&dev->parent->kobj, 660 660 class_name); 661 661 kfree(class_name); 662 + #endif 662 663 sysfs_remove_link(&dev->kobj, "device"); 663 664 } 664 - #endif 665 665 666 666 down(&dev->class->sem); 667 667 /* notify any interfaces that the device is now gone */ ··· 761 761 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 762 762 sysfs_remove_link(&dev->class->subsys.kset.kobj, 763 763 dev->bus_id); 764 - #ifdef CONFIG_SYSFS_DEPRECATED 765 764 if (parent) { 765 + #ifdef CONFIG_SYSFS_DEPRECATED 766 766 char *class_name = make_class_name(dev->class->name, 767 767 &dev->kobj); 768 768 if (class_name) 769 769 sysfs_remove_link(&dev->parent->kobj, 770 770 class_name); 771 771 kfree(class_name); 772 + #endif 772 773 sysfs_remove_link(&dev->kobj, "device"); 773 774 } 774 - #endif 775 775 776 776 down(&dev->class->sem); 777 777 /* notify any interfaces that the device is now gone */ ··· 1065 1065 1066 1066 return error; 1067 1067 } 1068 - 1068 + EXPORT_SYMBOL_GPL(device_rename); 1069 1069 1070 1070 static int device_move_class_links(struct device *dev, 1071 1071 struct device *old_parent, 1072 1072 struct device *new_parent) 1073 1073 { 1074 + int error = 0; 1074 1075 #ifdef CONFIG_SYSFS_DEPRECATED 1075 - int error; 1076 1076 char *class_name; 1077 1077 1078 1078 class_name = make_class_name(dev->class->name, &dev->kobj); ··· 1100 1100 kfree(class_name); 1101 1101 return error; 1102 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 1109 #endif 1105 1110 } 1106 1111
-6
kernel/module.c
··· 2419 2419 kfree(driver_name); 2420 2420 } 2421 2421 } 2422 - /* 2423 - * Undo the additional reference we added in module_add_driver() 2424 - * via kset_find_obj() 2425 - */ 2426 - if (drv->mod_name) 2427 - kobject_put(&drv->kobj); 2428 2422 } 2429 2423 EXPORT_SYMBOL(module_remove_driver); 2430 2424 #endif
+2
lib/kobject.c
··· 385 385 goto out; 386 386 old_parent = kobj->parent; 387 387 kobj->parent = new_parent; 388 + new_parent = NULL; 388 389 kobject_put(old_parent); 389 390 kobject_uevent_env(kobj, KOBJ_MOVE, envp); 390 391 out: 392 + kobject_put(new_parent); 391 393 kobject_put(kobj); 392 394 kfree(devpath_string); 393 395 kfree(devpath);