aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-core.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2012-01-24 13:34:41 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-24 16:00:35 -0800
commitcef9bc56e1e944afd11f96de569657117a138c6d (patch)
tree45923c4dec748e82a05313c9c7d443aa11e02a5f /drivers/hid/hid-core.c
parentDriver core: driver_find() drops reference before returning (diff)
downloadlinux-dev-cef9bc56e1e944afd11f96de569657117a138c6d.tar.xz
linux-dev-cef9bc56e1e944afd11f96de569657117a138c6d.zip
Dynamic ID addition doesn't need get_driver()
As part of the removal of get_driver()/put_driver(), this patch (as1511) changes all the places that add dynamic IDs for drivers. Since these additions are done by writing to the drivers' sysfs attribute files, and the attributes are removed when the drivers are unregistered, there is no reason to take an extra reference to the drivers. The one exception is the pci-stub driver, which calls pci_add_dynid() as part of its registration. But again, there's no reason to take an extra reference here, because the driver can't be unloaded while it is being registered. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: Dmitry Torokhov <dmitry.torokhov@gmail.com> CC: Jiri Kosina <jkosina@suse.cz> CC: Jesse Barnes <jbarnes@virtuousgeek.org> CC: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hid/hid-core.c')
-rw-r--r--drivers/hid/hid-core.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index af08ce7207d9..bce53fa0e166 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1619,11 +1619,7 @@ static ssize_t store_new_id(struct device_driver *drv, const char *buf,
list_add_tail(&dynid->list, &hdrv->dyn_list);
spin_unlock(&hdrv->dyn_lock);
- ret = 0;
- if (get_driver(&hdrv->driver)) {
- ret = driver_attach(&hdrv->driver);
- put_driver(&hdrv->driver);
- }
+ ret = driver_attach(&hdrv->driver);
return ret ? : count;
}