aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/dd.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-16 11:27:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-16 11:27:10 -0400
commitab86e5765d41a5eb4239a1c04d613db87bea5ed8 (patch)
treea41224d4874c2f90e0b423786f00bedf6f3e8bfa /drivers/base/dd.c
parent7ea61767e41e2baedd6a968d13f56026522e1207 (diff)
parent2b2af54a5bb6f7e80ccf78f20084b93c398c3a8b (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: Driver Core: devtmpfs - kernel-maintained tmpfs-based /dev debugfs: Modify default debugfs directory for debugging pktcdvd. debugfs: Modified default dir of debugfs for debugging UHCI. debugfs: Change debugfs directory of IWMC3200 debugfs: Change debuhgfs directory of trace-events-sample.h debugfs: Fix mount directory of debugfs by default in events.txt hpilo: add poll f_op hpilo: add interrupt handler hpilo: staging for interrupt handling driver core: platform_device_add_data(): use kmemdup() Driver core: Add support for compatibility classes uio: add generic driver for PCI 2.3 devices driver-core: move dma-coherent.c from kernel to driver/base mem_class: fix bug mem_class: use minor as index instead of searching the array driver model: constify attribute groups UIO: remove 'default n' from Kconfig Driver core: Add accessor for device platform data Driver core: move dev_get/set_drvdata to drivers/base/dd.c Driver core: add new device to bus's list before probing
Diffstat (limited to 'drivers/base/dd.c')
-rw-r--r--drivers/base/dd.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 7b34b3a48f67..979d159b5cd1 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -11,8 +11,8 @@
11 * 11 *
12 * Copyright (c) 2002-5 Patrick Mochel 12 * Copyright (c) 2002-5 Patrick Mochel
13 * Copyright (c) 2002-3 Open Source Development Labs 13 * Copyright (c) 2002-3 Open Source Development Labs
14 * Copyright (c) 2007 Greg Kroah-Hartman <gregkh@suse.de> 14 * Copyright (c) 2007-2009 Greg Kroah-Hartman <gregkh@suse.de>
15 * Copyright (c) 2007 Novell Inc. 15 * Copyright (c) 2007-2009 Novell Inc.
16 * 16 *
17 * This file is released under the GPLv2 17 * This file is released under the GPLv2
18 */ 18 */
@@ -391,3 +391,30 @@ void driver_detach(struct device_driver *drv)
391 put_device(dev); 391 put_device(dev);
392 } 392 }
393} 393}
394
395/*
396 * These exports can't be _GPL due to .h files using this within them, and it
397 * might break something that was previously working...
398 */
399void *dev_get_drvdata(const struct device *dev)
400{
401 if (dev && dev->p)
402 return dev->p->driver_data;
403 return NULL;
404}
405EXPORT_SYMBOL(dev_get_drvdata);
406
407void dev_set_drvdata(struct device *dev, void *data)
408{
409 int error;
410
411 if (!dev)
412 return;
413 if (!dev->p) {
414 error = device_private_init(dev);
415 if (error)
416 return;
417 }
418 dev->p->driver_data = data;
419}
420EXPORT_SYMBOL(dev_set_drvdata);