diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2008-01-31 04:39:38 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-02 18:14:49 -0500 |
commit | 0c98b19fe571ede1f14bd95b855bcbe2cca99bcf (patch) | |
tree | 388875be014f29a9f68c89144925d68542c42a4a /drivers/base/driver.c | |
parent | 44414e14af3f18fc8c1b94e259cd760366f665ee (diff) |
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.c | 9 |
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, | |||
97 | struct driver_attribute *attr) | 97 | struct driver_attribute *attr) |
98 | { | 98 | { |
99 | int error; | 99 | int error; |
100 | if (get_driver(drv)) { | 100 | if (drv) |
101 | error = sysfs_create_file(&drv->p->kobj, &attr->attr); | 101 | error = sysfs_create_file(&drv->p->kobj, &attr->attr); |
102 | put_driver(drv); | 102 | else |
103 | } else | ||
104 | error = -EINVAL; | 103 | error = -EINVAL; |
105 | return error; | 104 | return error; |
106 | } | 105 | } |
@@ -114,10 +113,8 @@ EXPORT_SYMBOL_GPL(driver_create_file); | |||
114 | void driver_remove_file(struct device_driver *drv, | 113 | void driver_remove_file(struct device_driver *drv, |
115 | struct driver_attribute *attr) | 114 | struct driver_attribute *attr) |
116 | { | 115 | { |
117 | if (get_driver(drv)) { | 116 | if (drv) |
118 | sysfs_remove_file(&drv->p->kobj, &attr->attr); | 117 | sysfs_remove_file(&drv->p->kobj, &attr->attr); |
119 | put_driver(drv); | ||
120 | } | ||
121 | } | 118 | } |
122 | EXPORT_SYMBOL_GPL(driver_remove_file); | 119 | EXPORT_SYMBOL_GPL(driver_remove_file); |
123 | 120 | ||