From d706c1b050274b3bf97d7cb0542c0d070c9ccb8b Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 13 Apr 2010 16:12:28 -0700 Subject: driver-core: Add device node pointer to struct device Currently, platforms using CONFIG_OF add a 'struct device_node *of_node' to dev->archdata. However, with CONFIG_OF becoming generic for all architectures, it makes sense for commonality to move it out of archdata and into struct device proper. This patch adds a struct device_node *of_node member to struct device and updates all locations which currently write the device_node pointer into archdata to also update dev->of_node. Subsequent patches will modify callers to use the archdata location and ultimately remove the archdata member entirely. Signed-off-by: Grant Likely Acked-by: Greg Kroah-Hartman CC: Michal Simek CC: Greg Kroah-Hartman CC: Benjamin Herrenschmidt CC: "David S. Miller" CC: Stephen Rothwell CC: Jeremy Kerr CC: microblaze-uclinux@itee.uq.edu.au CC: linux-kernel@vger.kernel.org CC: linuxppc-dev@ozlabs.org CC: sparclinux@vger.kernel.org --- include/linux/device.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/linux/device.h') diff --git a/include/linux/device.h b/include/linux/device.h index 182192892d45..7a968bdb02e2 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -34,6 +34,7 @@ struct class; struct class_private; struct bus_type; struct bus_type_private; +struct device_node; struct bus_attribute { struct attribute attr; @@ -433,6 +434,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" */ -- cgit v1.2.3 From 3142788b7967ccfd2f1813ee9e11aeb1e1cf7de2 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Fri, 29 Jan 2010 20:39:02 +0000 Subject: drivers/base: Convert dev->sem to mutex The semaphore is semantically a mutex. Convert it to a real mutex and fix up a few places where code was relying on semaphore.h to be included by device.h, as well as the users of the trylock function, as that value is now reversed. Signed-off-by: Thomas Gleixner Signed-off-by: Greg Kroah-Hartman --- include/linux/device.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'include/linux/device.h') diff --git a/include/linux/device.h b/include/linux/device.h index 241b96bcd7ad..6f9619190aaf 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -404,7 +403,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. */ @@ -514,17 +513,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); -- cgit v1.2.3 From bc451f2058238013e1cdf4acd443c01734d332f0 Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Tue, 30 Mar 2010 11:31:25 -0700 Subject: kobj: Add basic infrastructure for dealing with namespaces. Move complete knowledge of namespaces into the kobject layer so we can use that information when reporting kobjects to userspace. Signed-off-by: Eric W. Biederman Signed-off-by: Greg Kroah-Hartman --- include/linux/device.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/linux/device.h') diff --git a/include/linux/device.h b/include/linux/device.h index 6f9619190aaf..7bb9f426f3e6 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -202,6 +202,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; -- cgit v1.2.3 From 597b9d1e44e9ba69f2454a5318bbe7a6d5e6930a Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 13 Apr 2010 16:13:01 -0700 Subject: drivercore: Add of_match_table to the common device drivers OF-style matching can be available to any device, on any type of bus. This patch allows any driver to provide an OF match table when CONFIG_OF is enabled so that drivers can be bound against devices described in the device tree. Signed-off-by: Grant Likely Acked-by: Greg Kroah-Hartman --- include/linux/device.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/linux/device.h') diff --git a/include/linux/device.h b/include/linux/device.h index 7a968bdb02e2..cd7534cc42ab 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -129,6 +129,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); -- cgit v1.2.3