aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h45
1 files changed, 30 insertions, 15 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index a28642975053..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 *
@@ -130,7 +131,7 @@ 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 const struct dev_pm_ops *pm; 136 const struct dev_pm_ops *pm;
136 137
@@ -224,6 +225,14 @@ extern void class_unregister(struct class *class);
224 __class_register(class, &__key); \ 225 __class_register(class, &__key); \
225}) 226})
226 227
228struct class_compat;
229struct class_compat *class_compat_register(const char *name);
230void class_compat_unregister(struct class_compat *cls);
231int class_compat_create_link(struct class_compat *cls, struct device *dev,
232 struct device *device_link);
233void class_compat_remove_link(struct class_compat *cls, struct device *dev,
234 struct device *device_link);
235
227extern void class_dev_iter_init(struct class_dev_iter *iter, 236extern void class_dev_iter_init(struct class_dev_iter *iter,
228 struct class *class, 237 struct class *class,
229 struct device *start, 238 struct device *start,
@@ -287,7 +296,7 @@ extern void class_destroy(struct class *cls);
287 */ 296 */
288struct device_type { 297struct device_type {
289 const char *name; 298 const char *name;
290 struct attribute_group **groups; 299 const struct attribute_group **groups;
291 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 300 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
292 char *(*nodename)(struct device *dev); 301 char *(*nodename)(struct device *dev);
293 void (*release)(struct device *dev); 302 void (*release)(struct device *dev);
@@ -381,7 +390,6 @@ struct device {
381 struct bus_type *bus; /* type of bus device is on */ 390 struct bus_type *bus; /* type of bus device is on */
382 struct device_driver *driver; /* which driver has allocated this 391 struct device_driver *driver; /* which driver has allocated this
383 device */ 392 device */
384 void *driver_data; /* data private to the driver */
385 void *platform_data; /* Platform specific data, device 393 void *platform_data; /* Platform specific data, device
386 core doesn't touch it */ 394 core doesn't touch it */
387 struct dev_pm_info power; 395 struct dev_pm_info power;
@@ -412,7 +420,7 @@ struct device {
412 420
413 struct klist_node knode_class; 421 struct klist_node knode_class;
414 struct class *class; 422 struct class *class;
415 struct attribute_group **groups; /* optional groups */ 423 const struct attribute_group **groups; /* optional groups */
416 424
417 void (*release)(struct device *dev); 425 void (*release)(struct device *dev);
418}; 426};
@@ -447,16 +455,6 @@ static inline void set_dev_node(struct device *dev, int node)
447} 455}
448#endif 456#endif
449 457
450static inline void *dev_get_drvdata(const struct device *dev)
451{
452 return dev->driver_data;
453}
454
455static inline void dev_set_drvdata(struct device *dev, void *data)
456{
457 dev->driver_data = data;
458}
459
460static inline unsigned int dev_get_uevent_suppress(const struct device *dev) 458static inline unsigned int dev_get_uevent_suppress(const struct device *dev)
461{ 459{
462 return dev->kobj.uevent_suppress; 460 return dev->kobj.uevent_suppress;
@@ -490,6 +488,8 @@ extern int device_rename(struct device *dev, char *new_name);
490extern int device_move(struct device *dev, struct device *new_parent, 488extern int device_move(struct device *dev, struct device *new_parent,
491 enum dpm_order dpm_order); 489 enum dpm_order dpm_order);
492extern const char *device_get_nodename(struct device *dev, const char **tmp); 490extern const char *device_get_nodename(struct device *dev, const char **tmp);
491extern void *dev_get_drvdata(const struct device *dev);
492extern void dev_set_drvdata(struct device *dev, void *data);
493 493
494/* 494/*
495 * Root device objects for grouping under /sys/devices 495 * Root device objects for grouping under /sys/devices
@@ -502,6 +502,11 @@ static inline struct device *root_device_register(const char *name)
502} 502}
503extern void root_device_unregister(struct device *root); 503extern void root_device_unregister(struct device *root);
504 504
505static inline void *dev_get_platdata(const struct device *dev)
506{
507 return dev->platform_data;
508}
509
505/* 510/*
506 * 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
507 * for information on use. 512 * for information on use.
@@ -547,6 +552,16 @@ extern void put_device(struct device *dev);
547 552
548extern void wait_for_device_probe(void); 553extern void wait_for_device_probe(void);
549 554
555#ifdef CONFIG_DEVTMPFS
556extern int devtmpfs_create_node(struct device *dev);
557extern int devtmpfs_delete_node(struct device *dev);
558extern int devtmpfs_mount(const char *mountpoint);
559#else
560static inline int devtmpfs_create_node(struct device *dev) { return 0; }
561static inline int devtmpfs_delete_node(struct device *dev) { return 0; }
562static inline int devtmpfs_mount(const char *mountpoint) { return 0; }
563#endif
564
550/* drivers/base/power/shutdown.c */ 565/* drivers/base/power/shutdown.c */
551extern void device_shutdown(void); 566extern void device_shutdown(void);
552 567