From 161e232b8823e230d4fdf8064e606bbdf26f47e2 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 9 Mar 2007 15:25:04 -0800 Subject: [PATCH 1/5] Revert "driver core: refcounting fix" This reverts commit 63ce18cfe685115ff8d341bae4c9204a79043cf0. It was the incorrect fix and causes a reference counting bug whenever any driver module is removed from the system. Mike Galbraith is looking for the real fix for his problem. Signed-off-by: Greg Kroah-Hartman --- kernel/module.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index f77e893e4620..fbc51de6444e 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -2419,12 +2419,6 @@ void module_remove_driver(struct device_driver *drv) kfree(driver_name); } } - /* - * Undo the additional reference we added in module_add_driver() - * via kset_find_obj() - */ - if (drv->mod_name) - kobject_put(&drv->kobj); } EXPORT_SYMBOL(module_remove_driver); #endif From f7f3461d87536bed52bb83bc8fbe6bfd28619fb1 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 6 Mar 2007 12:55:53 -0800 Subject: [PATCH 2/5] Driver core: add device symlink back to sysfs This moves the device symlink back to sysfs even if CONFIG_SYSFS_DEPRECATED is enabled as too many userspace programs (well, HAL), still rely on this link to be present. I will rework the ability for sysfs to change layouts like this in the future, but for now, this patch should fix people's network connections. Cc: Kay Sievers Cc: Matt Mackall Signed-off-by: Greg Kroah-Hartman --- drivers/base/core.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 89ebe3682726..fb16f293561d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -584,17 +584,17 @@ int device_add(struct device *dev) if (dev->kobj.parent != &dev->class->subsys.kset.kobj) sysfs_create_link(&dev->class->subsys.kset.kobj, &dev->kobj, dev->bus_id); -#ifdef CONFIG_SYSFS_DEPRECATED if (parent) { sysfs_create_link(&dev->kobj, &dev->parent->kobj, "device"); +#ifdef CONFIG_SYSFS_DEPRECATED class_name = make_class_name(dev->class->name, &dev->kobj); if (class_name) sysfs_create_link(&dev->parent->kobj, &dev->kobj, class_name); - } #endif + } } if ((error = device_add_attrs(dev))) @@ -651,17 +651,17 @@ int device_add(struct device *dev) if (dev->kobj.parent != &dev->class->subsys.kset.kobj) sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id); -#ifdef CONFIG_SYSFS_DEPRECATED if (parent) { +#ifdef CONFIG_SYSFS_DEPRECATED char *class_name = make_class_name(dev->class->name, &dev->kobj); if (class_name) sysfs_remove_link(&dev->parent->kobj, class_name); kfree(class_name); +#endif sysfs_remove_link(&dev->kobj, "device"); } -#endif down(&dev->class->sem); /* notify any interfaces that the device is now gone */ @@ -761,17 +761,17 @@ void device_del(struct device * dev) if (dev->kobj.parent != &dev->class->subsys.kset.kobj) sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id); -#ifdef CONFIG_SYSFS_DEPRECATED if (parent) { +#ifdef CONFIG_SYSFS_DEPRECATED char *class_name = make_class_name(dev->class->name, &dev->kobj); if (class_name) sysfs_remove_link(&dev->parent->kobj, class_name); kfree(class_name); +#endif sysfs_remove_link(&dev->kobj, "device"); } -#endif down(&dev->class->sem); /* notify any interfaces that the device is now gone */ @@ -1071,8 +1071,8 @@ static int device_move_class_links(struct device *dev, struct device *old_parent, struct device *new_parent) { + int error = 0; #ifdef CONFIG_SYSFS_DEPRECATED - int error; char *class_name; class_name = make_class_name(dev->class->name, &dev->kobj); @@ -1100,7 +1100,12 @@ out: kfree(class_name); return error; #else - return 0; + if (old_parent) + sysfs_remove_link(&dev->kobj, "device"); + if (new_parent) + error = sysfs_create_link(&dev->kobj, &new_parent->kobj, + "device"); + return error; #endif } From 6cc94ef5359453dafc4778f6e5c33b128a2705c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Engel?= Date: Tue, 27 Feb 2007 21:38:30 +0000 Subject: [PATCH 3/5] Remove devfs from MAINTAINERS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove last remaining trace of devfs. Signed-off-by: Jörn Engel Signed-off-by: Greg Kroah-Hartman --- MAINTAINERS | 3 --- 1 file changed, 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 9993b9009415..17555bba20af 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1103,9 +1103,6 @@ W: http://lanana.org/docs/device-list/index.html L: linux-kernel@vger.kernel.org S: Maintained -DEVICE FILESYSTEM -S: Obsolete - DIGI INTL. EPCA DRIVER P: Digi International, Inc M: Eng.Linux@digi.com From a2807dbcbd681e1f36e813fb26e2f24d15018b91 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Wed, 28 Feb 2007 12:38:31 +0100 Subject: [PATCH 4/5] driver core: export device_rename In wireless we'd like to allow renaming of the phy devices we surface in sysfs. The base wireless code, however, can be built modular and thus we need device_rename exported. Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- drivers/base/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index fb16f293561d..f191afe62b4d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1065,7 +1065,7 @@ int device_rename(struct device *dev, char *new_name) return error; } - +EXPORT_SYMBOL_GPL(device_rename); static int device_move_class_links(struct device *dev, struct device *old_parent, From 9e993efb0da827634778554070f3c3ec4bdade33 Mon Sep 17 00:00:00 2001 From: Dmitriy Monakhov Date: Sat, 3 Mar 2007 16:11:21 +0300 Subject: [PATCH 5/5] kobject: new_device->kref wasn't putted after error in kobject_move() If error happen we jump to "out" label, in this case new_device not yet became the parent but it wasn't putted. Signed-off-by: Monakhov Dmitriy Signed-off-by: Greg Kroah-Hartman --- lib/kobject.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/kobject.c b/lib/kobject.c index f4f6176dcd12..057921c5945a 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -385,9 +385,11 @@ int kobject_move(struct kobject *kobj, struct kobject *new_parent) goto out; old_parent = kobj->parent; kobj->parent = new_parent; + new_parent = NULL; kobject_put(old_parent); kobject_uevent_env(kobj, KOBJ_MOVE, envp); out: + kobject_put(new_parent); kobject_put(kobj); kfree(devpath_string); kfree(devpath);