diff options
author | Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com> | 2013-07-18 11:22:04 +0100 |
---|---|---|
committer | Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com> | 2013-08-21 10:29:51 +0100 |
commit | bd00860e960e52658cebfd65eeb4748ed6ff039f (patch) | |
tree | e30d9b7a56311e9eed0bab4043c89d988e890a1d /include/linux/of_device.h | |
parent | f86e4718f24b83be0c42894d2b97accc993d65d3 (diff) | |
download | linux-stable-bd00860e960e52658cebfd65eeb4748ed6ff039f.tar.gz linux-stable-bd00860e960e52658cebfd65eeb4748ed6ff039f.tar.bz2 linux-stable-bd00860e960e52658cebfd65eeb4748ed6ff039f.zip |
of/device: add helper to get cpu device node from logical cpu index
Multiple drivers need to get the cpu device node from the cpu logical
index and then access the of_node.
This patch adds helper function to fetch the device node directly.
Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Diffstat (limited to 'include/linux/of_device.h')
-rw-r--r-- | include/linux/of_device.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 9d27475feec1..82ce324fdce7 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -1,6 +1,7 @@ #ifndef _LINUX_OF_DEVICE_H #define _LINUX_OF_DEVICE_H +#include <linux/cpu.h> #include <linux/platform_device.h> #include <linux/of_platform.h> /* temporary until merge */ @@ -43,6 +44,15 @@ static inline void of_device_node_put(struct device *dev) of_node_put(dev->of_node); } +static inline struct device_node *of_cpu_device_node_get(int cpu) +{ + struct device *cpu_dev; + cpu_dev = get_cpu_device(cpu); + if (!cpu_dev) + return NULL; + return of_node_get(cpu_dev->of_node); +} + #else /* CONFIG_OF */ static inline int of_driver_match_device(struct device *dev, @@ -67,6 +77,11 @@ static inline const struct of_device_id *of_match_device( { return NULL; } + +static inline struct device_node *of_cpu_device_node_get(int cpu) +{ + return NULL; +} #endif /* CONFIG_OF */ #endif /* _LINUX_OF_DEVICE_H */ |