diff options
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 182192892d4..0713e10571d 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -22,7 +22,6 @@ #include <linux/types.h> #include <linux/module.h> #include <linux/pm.h> -#include <linux/semaphore.h> #include <asm/atomic.h> #include <asm/device.h> @@ -34,6 +33,7 @@ struct class; struct class_private; struct bus_type; struct bus_type_private; +struct device_node; struct bus_attribute { struct attribute attr; @@ -128,6 +128,10 @@ struct device_driver { bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ +#if defined(CONFIG_OF) + const struct of_device_id *of_match_table; +#endif + int (*probe) (struct device *dev); int (*remove) (struct device *dev); void (*shutdown) (struct device *dev); @@ -203,6 +207,9 @@ struct class { int (*suspend)(struct device *dev, pm_message_t state); int (*resume)(struct device *dev); + const struct kobj_ns_type_operations *ns_type; + const void *(*namespace)(struct device *dev); + const struct dev_pm_ops *pm; struct class_private *p; @@ -404,7 +411,7 @@ struct device { const char *init_name; /* initial name of the device */ struct device_type *type; - struct semaphore sem; /* semaphore to synchronize calls to + struct mutex mutex; /* mutex to synchronize calls to * its driver. */ @@ -433,6 +440,9 @@ struct device { override */ /* arch specific additions */ struct dev_archdata archdata; +#ifdef CONFIG_OF + struct device_node *of_node; +#endif dev_t devt; /* dev_t, creates the sysfs "dev" */ @@ -451,6 +461,10 @@ struct device { static inline const char *dev_name(const struct device *dev) { + /* Use the init name until the kobject becomes available */ + if (dev->init_name) + return dev->init_name; + return kobject_name(&dev->kobj); } @@ -510,17 +524,17 @@ static inline bool device_async_suspend_enabled(struct device *dev) static inline void device_lock(struct device *dev) { - down(&dev->sem); + mutex_lock(&dev->mutex); } static inline int device_trylock(struct device *dev) { - return down_trylock(&dev->sem); + return mutex_trylock(&dev->mutex); } static inline void device_unlock(struct device *dev) { - up(&dev->sem); + mutex_unlock(&dev->mutex); } void driver_init(void); |