aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ibm_newemac/core.c1
-rw-r--r--drivers/of/base.c58
-rw-r--r--drivers/of/device.c29
-rw-r--r--drivers/serial/mpc52xx_uart.c3
4 files changed, 61 insertions, 30 deletions
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index cb06280dced5..fced441face6 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -37,6 +37,7 @@
37#include <linux/mii.h> 37#include <linux/mii.h>
38#include <linux/bitops.h> 38#include <linux/bitops.h>
39#include <linux/workqueue.h> 39#include <linux/workqueue.h>
40#include <linux/of.h>
40 41
41#include <asm/processor.h> 42#include <asm/processor.h>
42#include <asm/io.h> 43#include <asm/io.h>
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 9377f3bc410a..b306fef1ac41 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -273,3 +273,61 @@ struct device_node *of_find_compatible_node(struct device_node *from,
273 return np; 273 return np;
274} 274}
275EXPORT_SYMBOL(of_find_compatible_node); 275EXPORT_SYMBOL(of_find_compatible_node);
276
277/**
278 * of_match_node - Tell if an device_node has a matching of_match structure
279 * @matches: array of of device match structures to search in
280 * @node: the of device structure to match against
281 *
282 * Low level utility function used by device matching.
283 */
284const struct of_device_id *of_match_node(const struct of_device_id *matches,
285 const struct device_node *node)
286{
287 while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
288 int match = 1;
289 if (matches->name[0])
290 match &= node->name
291 && !strcmp(matches->name, node->name);
292 if (matches->type[0])
293 match &= node->type
294 && !strcmp(matches->type, node->type);
295 if (matches->compatible[0])
296 match &= of_device_is_compatible(node,
297 matches->compatible);
298 if (match)
299 return matches;
300 matches++;
301 }
302 return NULL;
303}
304EXPORT_SYMBOL(of_match_node);
305
306/**
307 * of_find_matching_node - Find a node based on an of_device_id match
308 * table.
309 * @from: The node to start searching from or NULL, the node
310 * you pass will not be searched, only the next one
311 * will; typically, you pass what the previous call
312 * returned. of_node_put() will be called on it
313 * @matches: array of of device match structures to search in
314 *
315 * Returns a node pointer with refcount incremented, use
316 * of_node_put() on it when done.
317 */
318struct device_node *of_find_matching_node(struct device_node *from,
319 const struct of_device_id *matches)
320{
321 struct device_node *np;
322
323 read_lock(&devtree_lock);
324 np = from ? from->allnext : allnodes;
325 for (; np; np = np->allnext) {
326 if (of_match_node(matches, np) && of_node_get(np))
327 break;
328 }
329 of_node_put(from);
330 read_unlock(&devtree_lock);
331 return np;
332}
333EXPORT_SYMBOL(of_find_matching_node);
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 6245f060fb77..29681c4b700b 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -10,35 +10,6 @@
10#include <asm/errno.h> 10#include <asm/errno.h>
11 11
12/** 12/**
13 * of_match_node - Tell if an device_node has a matching of_match structure
14 * @ids: array of of device match structures to search in
15 * @node: the of device structure to match against
16 *
17 * Low level utility function used by device matching.
18 */
19const struct of_device_id *of_match_node(const struct of_device_id *matches,
20 const struct device_node *node)
21{
22 while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
23 int match = 1;
24 if (matches->name[0])
25 match &= node->name
26 && !strcmp(matches->name, node->name);
27 if (matches->type[0])
28 match &= node->type
29 && !strcmp(matches->type, node->type);
30 if (matches->compatible[0])
31 match &= of_device_is_compatible(node,
32 matches->compatible);
33 if (match)
34 return matches;
35 matches++;
36 }
37 return NULL;
38}
39EXPORT_SYMBOL(of_match_node);
40
41/**
42 * of_match_device - Tell if an of_device structure has a matching 13 * of_match_device - Tell if an of_device structure has a matching
43 * of_match structure 14 * of_match structure
44 * @ids: array of of device match structures to search in 15 * @ids: array of of device match structures to search in
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index ec36ad78d2fe..7e3ba8b455a8 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -72,7 +72,8 @@
72#include <asm/io.h> 72#include <asm/io.h>
73 73
74#if defined(CONFIG_PPC_MERGE) 74#if defined(CONFIG_PPC_MERGE)
75#include <asm/of_platform.h> 75#include <linux/of.h>
76#include <linux/of_platform.h>
76#else 77#else
77#include <linux/platform_device.h> 78#include <linux/platform_device.h>
78#endif 79#endif