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.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 182192892d45..0713e10571dd 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -22,7 +22,6 @@
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/semaphore.h>
26#include <asm/atomic.h> 25#include <asm/atomic.h>
27#include <asm/device.h> 26#include <asm/device.h>
28 27
@@ -34,6 +33,7 @@ struct class;
34struct class_private; 33struct class_private;
35struct bus_type; 34struct bus_type;
36struct bus_type_private; 35struct bus_type_private;
36struct device_node;
37 37
38struct bus_attribute { 38struct bus_attribute {
39 struct attribute attr; 39 struct attribute attr;
@@ -128,6 +128,10 @@ struct device_driver {
128 128
129 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ 129 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
130 130
131#if defined(CONFIG_OF)
132 const struct of_device_id *of_match_table;
133#endif
134
131 int (*probe) (struct device *dev); 135 int (*probe) (struct device *dev);
132 int (*remove) (struct device *dev); 136 int (*remove) (struct device *dev);
133 void (*shutdown) (struct device *dev); 137 void (*shutdown) (struct device *dev);
@@ -203,6 +207,9 @@ struct class {
203 int (*suspend)(struct device *dev, pm_message_t state); 207 int (*suspend)(struct device *dev, pm_message_t state);
204 int (*resume)(struct device *dev); 208 int (*resume)(struct device *dev);
205 209
210 const struct kobj_ns_type_operations *ns_type;
211 const void *(*namespace)(struct device *dev);
212
206 const struct dev_pm_ops *pm; 213 const struct dev_pm_ops *pm;
207 214
208 struct class_private *p; 215 struct class_private *p;
@@ -404,7 +411,7 @@ struct device {
404 const char *init_name; /* initial name of the device */ 411 const char *init_name; /* initial name of the device */
405 struct device_type *type; 412 struct device_type *type;
406 413
407 struct semaphore sem; /* semaphore to synchronize calls to 414 struct mutex mutex; /* mutex to synchronize calls to
408 * its driver. 415 * its driver.
409 */ 416 */
410 417
@@ -433,6 +440,9 @@ struct device {
433 override */ 440 override */
434 /* arch specific additions */ 441 /* arch specific additions */
435 struct dev_archdata archdata; 442 struct dev_archdata archdata;
443#ifdef CONFIG_OF
444 struct device_node *of_node;
445#endif
436 446
437 dev_t devt; /* dev_t, creates the sysfs "dev" */ 447 dev_t devt; /* dev_t, creates the sysfs "dev" */
438 448
@@ -451,6 +461,10 @@ struct device {
451 461
452static inline const char *dev_name(const struct device *dev) 462static inline const char *dev_name(const struct device *dev)
453{ 463{
464 /* Use the init name until the kobject becomes available */
465 if (dev->init_name)
466 return dev->init_name;
467
454 return kobject_name(&dev->kobj); 468 return kobject_name(&dev->kobj);
455} 469}
456 470
@@ -510,17 +524,17 @@ static inline bool device_async_suspend_enabled(struct device *dev)
510 524
511static inline void device_lock(struct device *dev) 525static inline void device_lock(struct device *dev)
512{ 526{
513 down(&dev->sem); 527 mutex_lock(&dev->mutex);
514} 528}
515 529
516static inline int device_trylock(struct device *dev) 530static inline int device_trylock(struct device *dev)
517{ 531{
518 return down_trylock(&dev->sem); 532 return mutex_trylock(&dev->mutex);
519} 533}
520 534
521static inline void device_unlock(struct device *dev) 535static inline void device_unlock(struct device *dev)
522{ 536{
523 up(&dev->sem); 537 mutex_unlock(&dev->mutex);
524} 538}
525 539
526void driver_init(void); 540void driver_init(void);