Commit 0c98b19f authored by Cornelia Huck's avatar Cornelia Huck Committed by Greg Kroah-Hartman

Driver core: Remove unneeded get_{device,driver}() calls.

Driver core: Remove unneeded get_{device,driver}() calls.

Code trying to add/remove attributes must hold a reference to
the device resp. driver anyway, so let's remove those reference
count games.
Signed-off-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Cc: Dave Young <hidave.darkstar@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 44414e14
......@@ -423,10 +423,8 @@ struct kset *devices_kset;
int device_create_file(struct device *dev, struct device_attribute *attr)
{
int error = 0;
if (get_device(dev)) {
if (dev)
error = sysfs_create_file(&dev->kobj, &attr->attr);
put_device(dev);
}
return error;
}
......@@ -437,10 +435,8 @@ int device_create_file(struct device *dev, struct device_attribute *attr)
*/
void device_remove_file(struct device *dev, struct device_attribute *attr)
{
if (get_device(dev)) {
if (dev)
sysfs_remove_file(&dev->kobj, &attr->attr);
put_device(dev);
}
}
/**
......
......@@ -97,10 +97,9 @@ int driver_create_file(struct device_driver *drv,
struct driver_attribute *attr)
{
int error;
if (get_driver(drv)) {
if (drv)
error = sysfs_create_file(&drv->p->kobj, &attr->attr);
put_driver(drv);
} else
else
error = -EINVAL;
return error;
}
......@@ -114,10 +113,8 @@ EXPORT_SYMBOL_GPL(driver_create_file);
void driver_remove_file(struct device_driver *drv,
struct driver_attribute *attr)
{
if (get_driver(drv)) {
if (drv)
sysfs_remove_file(&drv->p->kobj, &attr->attr);
put_driver(drv);
}
}
EXPORT_SYMBOL_GPL(driver_remove_file);
......
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