aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/dd.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-19 21:24:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-19 21:24:11 -0400
commit39ab05c8e0b519ff0a04a869f065746e6e8c3d95 (patch)
treee73f0ba74c4ea7a80dff9b2dd9445a3a74190e28 /drivers/base/dd.c
parent1477fcc290b3d5c2614bde98bf3b1154c538860d (diff)
parentc42d2237143fcf35cff642cefe2bcf7786aae312 (diff)
Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (44 commits) debugfs: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning sysfs: remove "last sysfs file:" line from the oops messages drivers/base/memory.c: fix warning due to "memory hotplug: Speed up add/remove when blocks are larger than PAGES_PER_SECTION" memory hotplug: Speed up add/remove when blocks are larger than PAGES_PER_SECTION SYSFS: Fix erroneous comments for sysfs_update_group(). driver core: remove the driver-model structures from the documentation driver core: Add the device driver-model structures to kerneldoc Translated Documentation/email-clients.txt RAW driver: Remove call to kobject_put(). reboot: disable usermodehelper to prevent fs access efivars: prevent oops on unload when efi is not enabled Allow setting of number of raw devices as a module parameter Introduce CONFIG_GOOGLE_FIRMWARE driver: Google Memory Console driver: Google EFI SMI x86: Better comments for get_bios_ebda() x86: get_bios_ebda_length() misc: fix ti-st build issues params.c: Use new strtobool function to process boolean inputs debugfs: move to new strtobool ... Fix up trivial conflicts in fs/debugfs/file.c due to the same patch being applied twice, and an unrelated cleanup nearby.
Diffstat (limited to 'drivers/base/dd.c')
-rw-r--r--drivers/base/dd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 29917c7506c..6658da743c3 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -245,6 +245,10 @@ int device_attach(struct device *dev)
245 245
246 device_lock(dev); 246 device_lock(dev);
247 if (dev->driver) { 247 if (dev->driver) {
248 if (klist_node_attached(&dev->p->knode_driver)) {
249 ret = 1;
250 goto out_unlock;
251 }
248 ret = device_bind_driver(dev); 252 ret = device_bind_driver(dev);
249 if (ret == 0) 253 if (ret == 0)
250 ret = 1; 254 ret = 1;
@@ -257,6 +261,7 @@ int device_attach(struct device *dev)
257 ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach); 261 ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
258 pm_runtime_put_sync(dev); 262 pm_runtime_put_sync(dev);
259 } 263 }
264out_unlock:
260 device_unlock(dev); 265 device_unlock(dev);
261 return ret; 266 return ret;
262} 267}
@@ -408,17 +413,16 @@ void *dev_get_drvdata(const struct device *dev)
408} 413}
409EXPORT_SYMBOL(dev_get_drvdata); 414EXPORT_SYMBOL(dev_get_drvdata);
410 415
411void dev_set_drvdata(struct device *dev, void *data) 416int dev_set_drvdata(struct device *dev, void *data)
412{ 417{
413 int error; 418 int error;
414 419
415 if (!dev)
416 return;
417 if (!dev->p) { 420 if (!dev->p) {
418 error = device_private_init(dev); 421 error = device_private_init(dev);
419 if (error) 422 if (error)
420 return; 423 return error;
421 } 424 }
422 dev->p->driver_data = data; 425 dev->p->driver_data = data;
426 return 0;
423} 427}
424EXPORT_SYMBOL(dev_set_drvdata); 428EXPORT_SYMBOL(dev_set_drvdata);