diff options
-rw-r--r-- | arch/microblaze/kernel/prom.c | 19 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom.c | 19 | ||||
-rw-r--r-- | drivers/of/fdt.c | 24 |
3 files changed, 24 insertions, 38 deletions
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c index d75c6253c0de..eb27bd3a39b4 100644 --- a/arch/microblaze/kernel/prom.c +++ b/arch/microblaze/kernel/prom.c | |||
@@ -50,25 +50,6 @@ typedef u32 cell_t; | |||
50 | /* export that to outside world */ | 50 | /* export that to outside world */ |
51 | struct device_node *of_chosen; | 51 | struct device_node *of_chosen; |
52 | 52 | ||
53 | int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) | ||
54 | { | ||
55 | const char *cp; | ||
56 | unsigned long cplen, l; | ||
57 | |||
58 | cp = of_get_flat_dt_prop(node, "compatible", &cplen); | ||
59 | if (cp == NULL) | ||
60 | return 0; | ||
61 | while (cplen > 0) { | ||
62 | if (strncasecmp(cp, compat, strlen(compat)) == 0) | ||
63 | return 1; | ||
64 | l = strlen(cp) + 1; | ||
65 | cp += l; | ||
66 | cplen -= l; | ||
67 | } | ||
68 | |||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, | 53 | static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, |
73 | unsigned long align) | 54 | unsigned long align) |
74 | { | 55 | { |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index cd0a2bfc978b..413e608863dd 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -80,25 +80,6 @@ extern rwlock_t devtree_lock; /* temporary while merging */ | |||
80 | /* export that to outside world */ | 80 | /* export that to outside world */ |
81 | struct device_node *of_chosen; | 81 | struct device_node *of_chosen; |
82 | 82 | ||
83 | int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) | ||
84 | { | ||
85 | const char* cp; | ||
86 | unsigned long cplen, l; | ||
87 | |||
88 | cp = of_get_flat_dt_prop(node, "compatible", &cplen); | ||
89 | if (cp == NULL) | ||
90 | return 0; | ||
91 | while (cplen > 0) { | ||
92 | if (strncasecmp(cp, compat, strlen(compat)) == 0) | ||
93 | return 1; | ||
94 | l = strlen(cp) + 1; | ||
95 | cp += l; | ||
96 | cplen -= l; | ||
97 | } | ||
98 | |||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, | 83 | static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, |
103 | unsigned long align) | 84 | unsigned long align) |
104 | { | 85 | { |
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index b17a9086cbfc..5cdd958db9af 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -142,3 +142,27 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, | |||
142 | } while (1); | 142 | } while (1); |
143 | } | 143 | } |
144 | 144 | ||
145 | /** | ||
146 | * of_flat_dt_is_compatible - Return true if given node has compat in compatible list | ||
147 | * @node: node to test | ||
148 | * @compat: compatible string to compare with compatible list. | ||
149 | */ | ||
150 | int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) | ||
151 | { | ||
152 | const char *cp; | ||
153 | unsigned long cplen, l; | ||
154 | |||
155 | cp = of_get_flat_dt_prop(node, "compatible", &cplen); | ||
156 | if (cp == NULL) | ||
157 | return 0; | ||
158 | while (cplen > 0) { | ||
159 | if (strncasecmp(cp, compat, strlen(compat)) == 0) | ||
160 | return 1; | ||
161 | l = strlen(cp) + 1; | ||
162 | cp += l; | ||
163 | cplen -= l; | ||
164 | } | ||
165 | |||
166 | return 0; | ||
167 | } | ||
168 | |||