summaryrefslogtreecommitdiffstats
path: root/drivers/base/driver.c
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2008-01-31 10:39:38 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-02 15:14:49 -0800
commit0c98b19fe571ede1f14bd95b855bcbe2cca99bcf (patch)
tree388875be014f29a9f68c89144925d68542c42a4a /drivers/base/driver.c
parent44414e14af3f18fc8c1b94e259cd760366f665ee (diff)
downloadlinux-0c98b19fe571ede1f14bd95b855bcbe2cca99bcf.tar.gz
linux-0c98b19fe571ede1f14bd95b855bcbe2cca99bcf.tar.bz2
linux-0c98b19fe571ede1f14bd95b855bcbe2cca99bcf.zip
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: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Dave Young <hidave.darkstar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/driver.c')
-rw-r--r--drivers/base/driver.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index a35f04121a00..ba75184c653c 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -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);