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.h52
1 files changed, 34 insertions, 18 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index a28642975053..aca31bf7d8ed 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
@@ -192,7 +193,7 @@ struct class {
192 struct kobject *dev_kobj; 193 struct kobject *dev_kobj;
193 194
194 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 195 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
195 char *(*nodename)(struct device *dev); 196 char *(*devnode)(struct device *dev, mode_t *mode);
196 197
197 void (*class_release)(struct class *class); 198 void (*class_release)(struct class *class);
198 void (*dev_release)(struct device *dev); 199 void (*dev_release)(struct device *dev);
@@ -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,9 +296,9 @@ 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 *(*devnode)(struct device *dev, mode_t *mode);
293 void (*release)(struct device *dev); 302 void (*release)(struct device *dev);
294 303
295 const struct dev_pm_ops *pm; 304 const struct dev_pm_ops *pm;
@@ -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;
@@ -489,7 +487,10 @@ extern struct device *device_find_child(struct device *dev, void *data,
489extern int device_rename(struct device *dev, char *new_name); 487extern 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_devnode(struct device *dev,
491 mode_t *mode, const char **tmp);
492extern void *dev_get_drvdata(const struct device *dev);
493extern void dev_set_drvdata(struct device *dev, void *data);
493 494
494/* 495/*
495 * Root device objects for grouping under /sys/devices 496 * Root device objects for grouping under /sys/devices
@@ -502,6 +503,11 @@ static inline struct device *root_device_register(const char *name)
502} 503}
503extern void root_device_unregister(struct device *root); 504extern void root_device_unregister(struct device *root);
504 505
506static inline void *dev_get_platdata(const struct device *dev)
507{
508 return dev->platform_data;
509}
510
505/* 511/*
506 * Manual binding of a device to driver. See drivers/base/bus.c 512 * Manual binding of a device to driver. See drivers/base/bus.c
507 * for information on use. 513 * for information on use.
@@ -547,6 +553,16 @@ extern void put_device(struct device *dev);
547 553
548extern void wait_for_device_probe(void); 554extern void wait_for_device_probe(void);
549 555
556#ifdef CONFIG_DEVTMPFS
557extern int devtmpfs_create_node(struct device *dev);
558extern int devtmpfs_delete_node(struct device *dev);
559extern int devtmpfs_mount(const char *mountpoint);
560#else
561static inline int devtmpfs_create_node(struct device *dev) { return 0; }
562static inline int devtmpfs_delete_node(struct device *dev) { return 0; }
563static inline int devtmpfs_mount(const char *mountpoint) { return 0; }
564#endif
565
550/* drivers/base/power/shutdown.c */ 566/* drivers/base/power/shutdown.c */
551extern void device_shutdown(void); 567extern void device_shutdown(void);
552 568