aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device.h
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 /include/linux/device.h
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 '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