Commit 271368b6 authored by Linus Torvalds's avatar Linus Torvalds

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"
parents 117430b1 9e993efb
......@@ -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
......
......@@ -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 */
......@@ -1065,14 +1065,14 @@ 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,
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 @@ static int device_move_class_links(struct device *dev,
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
}
......
......@@ -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
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment