diff options
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index aebb81036db2..847b763e40e9 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 | * |
@@ -62,7 +63,7 @@ struct bus_type { | |||
62 | int (*suspend)(struct device *dev, pm_message_t state); | 63 | int (*suspend)(struct device *dev, pm_message_t state); |
63 | int (*resume)(struct device *dev); | 64 | int (*resume)(struct device *dev); |
64 | 65 | ||
65 | struct dev_pm_ops *pm; | 66 | const struct dev_pm_ops *pm; |
66 | 67 | ||
67 | struct bus_type_private *p; | 68 | struct bus_type_private *p; |
68 | }; | 69 | }; |
@@ -130,9 +131,9 @@ struct device_driver { | |||
130 | void (*shutdown) (struct device *dev); | 131 | void (*shutdown) (struct device *dev); |
131 | int (*suspend) (struct device *dev, pm_message_t state); | 132 | int (*suspend) (struct device *dev, pm_message_t state); |
132 | int (*resume) (struct device *dev); | 133 | int (*resume) (struct device *dev); |
133 | struct attribute_group **groups; | 134 | const struct attribute_group **groups; |
134 | 135 | ||
135 | struct dev_pm_ops *pm; | 136 | const struct dev_pm_ops *pm; |
136 | 137 | ||
137 | struct driver_private *p; | 138 | struct driver_private *p; |
138 | }; | 139 | }; |
@@ -200,7 +201,8 @@ struct class { | |||
200 | int (*suspend)(struct device *dev, pm_message_t state); | 201 | int (*suspend)(struct device *dev, pm_message_t state); |
201 | int (*resume)(struct device *dev); | 202 | int (*resume)(struct device *dev); |
202 | 203 | ||
203 | struct dev_pm_ops *pm; | 204 | const struct dev_pm_ops *pm; |
205 | |||
204 | struct class_private *p; | 206 | struct class_private *p; |
205 | }; | 207 | }; |
206 | 208 | ||
@@ -223,6 +225,14 @@ extern void class_unregister(struct class *class); | |||
223 | __class_register(class, &__key); \ | 225 | __class_register(class, &__key); \ |
224 | }) | 226 | }) |
225 | 227 | ||
228 | struct class_compat; | ||
229 | struct class_compat *class_compat_register(const char *name); | ||
230 | void class_compat_unregister(struct class_compat *cls); | ||
231 | int class_compat_create_link(struct class_compat *cls, struct device *dev, | ||
232 | struct device *device_link); | ||
233 | void class_compat_remove_link(struct class_compat *cls, struct device *dev, | ||
234 | struct device *device_link); | ||
235 | |||
226 | extern void class_dev_iter_init(struct class_dev_iter *iter, | 236 | extern void class_dev_iter_init(struct class_dev_iter *iter, |
227 | struct class *class, | 237 | struct class *class, |
228 | struct device *start, | 238 | struct device *start, |
@@ -286,12 +296,12 @@ extern void class_destroy(struct class *cls); | |||
286 | */ | 296 | */ |
287 | struct device_type { | 297 | struct device_type { |
288 | const char *name; | 298 | const char *name; |
289 | struct attribute_group **groups; | 299 | const struct attribute_group **groups; |
290 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); | 300 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); |
291 | char *(*nodename)(struct device *dev); | 301 | char *(*nodename)(struct device *dev); |
292 | void (*release)(struct device *dev); | 302 | void (*release)(struct device *dev); |
293 | 303 | ||
294 | struct dev_pm_ops *pm; | 304 | const struct dev_pm_ops *pm; |
295 | }; | 305 | }; |
296 | 306 | ||
297 | /* interface for exporting device attributes */ | 307 | /* interface for exporting device attributes */ |
@@ -380,7 +390,6 @@ struct device { | |||
380 | struct bus_type *bus; /* type of bus device is on */ | 390 | struct bus_type *bus; /* type of bus device is on */ |
381 | struct device_driver *driver; /* which driver has allocated this | 391 | struct device_driver *driver; /* which driver has allocated this |
382 | device */ | 392 | device */ |
383 | void *driver_data; /* data private to the driver */ | ||
384 | void *platform_data; /* Platform specific data, device | 393 | void *platform_data; /* Platform specific data, device |
385 | core doesn't touch it */ | 394 | core doesn't touch it */ |
386 | struct dev_pm_info power; | 395 | struct dev_pm_info power; |
@@ -411,7 +420,7 @@ struct device { | |||
411 | 420 | ||
412 | struct klist_node knode_class; | 421 | struct klist_node knode_class; |
413 | struct class *class; | 422 | struct class *class; |
414 | struct attribute_group **groups; /* optional groups */ | 423 | const struct attribute_group **groups; /* optional groups */ |
415 | 424 | ||
416 | void (*release)(struct device *dev); | 425 | void (*release)(struct device *dev); |
417 | }; | 426 | }; |
@@ -446,16 +455,6 @@ static inline void set_dev_node(struct device *dev, int node) | |||
446 | } | 455 | } |
447 | #endif | 456 | #endif |
448 | 457 | ||
449 | static inline void *dev_get_drvdata(const struct device *dev) | ||
450 | { | ||
451 | return dev->driver_data; | ||
452 | } | ||
453 | |||
454 | static inline void dev_set_drvdata(struct device *dev, void *data) | ||
455 | { | ||
456 | dev->driver_data = data; | ||
457 | } | ||
458 | |||
459 | static inline unsigned int dev_get_uevent_suppress(const struct device *dev) | 458 | static inline unsigned int dev_get_uevent_suppress(const struct device *dev) |
460 | { | 459 | { |
461 | return dev->kobj.uevent_suppress; | 460 | return dev->kobj.uevent_suppress; |
@@ -489,6 +488,8 @@ extern int device_rename(struct device *dev, char *new_name); | |||
489 | extern int device_move(struct device *dev, struct device *new_parent, | 488 | extern int device_move(struct device *dev, struct device *new_parent, |
490 | enum dpm_order dpm_order); | 489 | enum dpm_order dpm_order); |
491 | extern const char *device_get_nodename(struct device *dev, const char **tmp); | 490 | extern const char *device_get_nodename(struct device *dev, const char **tmp); |
491 | extern void *dev_get_drvdata(const struct device *dev); | ||
492 | extern void dev_set_drvdata(struct device *dev, void *data); | ||
492 | 493 | ||
493 | /* | 494 | /* |
494 | * Root device objects for grouping under /sys/devices | 495 | * Root device objects for grouping under /sys/devices |
@@ -501,6 +502,11 @@ static inline struct device *root_device_register(const char *name) | |||
501 | } | 502 | } |
502 | extern void root_device_unregister(struct device *root); | 503 | extern void root_device_unregister(struct device *root); |
503 | 504 | ||
505 | static inline void *dev_get_platdata(const struct device *dev) | ||
506 | { | ||
507 | return dev->platform_data; | ||
508 | } | ||
509 | |||
504 | /* | 510 | /* |
505 | * Manual binding of a device to driver. See drivers/base/bus.c | 511 | * Manual binding of a device to driver. See drivers/base/bus.c |
506 | * for information on use. | 512 | * for information on use. |
@@ -546,6 +552,16 @@ extern void put_device(struct device *dev); | |||
546 | 552 | ||
547 | extern void wait_for_device_probe(void); | 553 | extern void wait_for_device_probe(void); |
548 | 554 | ||
555 | #ifdef CONFIG_DEVTMPFS | ||
556 | extern int devtmpfs_create_node(struct device *dev); | ||
557 | extern int devtmpfs_delete_node(struct device *dev); | ||
558 | extern int devtmpfs_mount(const char *mountpoint); | ||
559 | #else | ||
560 | static inline int devtmpfs_create_node(struct device *dev) { return 0; } | ||
561 | static inline int devtmpfs_delete_node(struct device *dev) { return 0; } | ||
562 | static inline int devtmpfs_mount(const char *mountpoint) { return 0; } | ||
563 | #endif | ||
564 | |||
549 | /* drivers/base/power/shutdown.c */ | 565 | /* drivers/base/power/shutdown.c */ |
550 | extern void device_shutdown(void); | 566 | extern void device_shutdown(void); |
551 | 567 | ||