diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-05-11 17:16:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-15 12:50:47 -0400 |
commit | b4028437876866aba4747a655ede00f892089e14 (patch) | |
tree | f6c34315c3e6d2899a894f028bd6f9899e80cd01 /include/linux/device.h | |
parent | 2023c610dc54a4f4130b0494309a9bd668ca3df8 (diff) |
Driver core: move dev_get/set_drvdata to drivers/base/dd.c
No one should directly access the driver_data field, so remove the field
and make it private. We dynamically create the private field now if it
is needed, to handle drivers that call get/set before they are
registered with the driver core.
Also update the copyright notices on these files while we are there.
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index a28642975053..c0bd23048be0 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -2,7 +2,8 @@ | |||
2 | * device.h - generic, centralized driver model | 2 | * device.h - generic, centralized driver model |
3 | * | 3 | * |
4 | * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org> | 4 | * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org> |
5 | * Copyright (c) 2004-2007 Greg Kroah-Hartman <gregkh@suse.de> | 5 | * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de> |
6 | * Copyright (c) 2008-2009 Novell Inc. | ||
6 | * | 7 | * |
7 | * This file is released under the GPLv2 | 8 | * This file is released under the GPLv2 |
8 | * | 9 | * |
@@ -381,7 +382,6 @@ struct device { | |||
381 | struct bus_type *bus; /* type of bus device is on */ | 382 | struct bus_type *bus; /* type of bus device is on */ |
382 | struct device_driver *driver; /* which driver has allocated this | 383 | struct device_driver *driver; /* which driver has allocated this |
383 | device */ | 384 | device */ |
384 | void *driver_data; /* data private to the driver */ | ||
385 | void *platform_data; /* Platform specific data, device | 385 | void *platform_data; /* Platform specific data, device |
386 | core doesn't touch it */ | 386 | core doesn't touch it */ |
387 | struct dev_pm_info power; | 387 | struct dev_pm_info power; |
@@ -447,16 +447,6 @@ static inline void set_dev_node(struct device *dev, int node) | |||
447 | } | 447 | } |
448 | #endif | 448 | #endif |
449 | 449 | ||
450 | static inline void *dev_get_drvdata(const struct device *dev) | ||
451 | { | ||
452 | return dev->driver_data; | ||
453 | } | ||
454 | |||
455 | static inline void dev_set_drvdata(struct device *dev, void *data) | ||
456 | { | ||
457 | dev->driver_data = data; | ||
458 | } | ||
459 | |||
460 | static inline unsigned int dev_get_uevent_suppress(const struct device *dev) | 450 | static inline unsigned int dev_get_uevent_suppress(const struct device *dev) |
461 | { | 451 | { |
462 | return dev->kobj.uevent_suppress; | 452 | return dev->kobj.uevent_suppress; |
@@ -490,6 +480,8 @@ extern int device_rename(struct device *dev, char *new_name); | |||
490 | extern int device_move(struct device *dev, struct device *new_parent, | 480 | extern int device_move(struct device *dev, struct device *new_parent, |
491 | enum dpm_order dpm_order); | 481 | enum dpm_order dpm_order); |
492 | extern const char *device_get_nodename(struct device *dev, const char **tmp); | 482 | extern const char *device_get_nodename(struct device *dev, const char **tmp); |
483 | extern void *dev_get_drvdata(const struct device *dev); | ||
484 | extern void dev_set_drvdata(struct device *dev, void *data); | ||
493 | 485 | ||
494 | /* | 486 | /* |
495 | * Root device objects for grouping under /sys/devices | 487 | * Root device objects for grouping under /sys/devices |