提交 00e38efd 编写于 作者: G Grant Likely

of/flattree: Merge of_flat_dt_is_compatible

Merge common code between PowerPC and Microblaze
Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
Reviewed-by: NWolfram Sang <w.sang@pengutronix.de>
Tested-by: NMichal Simek <monstr@monstr.eu>
上级 ca900cfa
......@@ -50,25 +50,6 @@ typedef u32 cell_t;
/* export that to outside world */
struct device_node *of_chosen;
int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
{
const char *cp;
unsigned long cplen, l;
cp = of_get_flat_dt_prop(node, "compatible", &cplen);
if (cp == NULL)
return 0;
while (cplen > 0) {
if (strncasecmp(cp, compat, strlen(compat)) == 0)
return 1;
l = strlen(cp) + 1;
cp += l;
cplen -= l;
}
return 0;
}
static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
unsigned long align)
{
......
......@@ -80,25 +80,6 @@ extern rwlock_t devtree_lock; /* temporary while merging */
/* export that to outside world */
struct device_node *of_chosen;
int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
{
const char* cp;
unsigned long cplen, l;
cp = of_get_flat_dt_prop(node, "compatible", &cplen);
if (cp == NULL)
return 0;
while (cplen > 0) {
if (strncasecmp(cp, compat, strlen(compat)) == 0)
return 1;
l = strlen(cp) + 1;
cp += l;
cplen -= l;
}
return 0;
}
static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
unsigned long align)
{
......
......@@ -142,3 +142,27 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
} while (1);
}
/**
* of_flat_dt_is_compatible - Return true if given node has compat in compatible list
* @node: node to test
* @compat: compatible string to compare with compatible list.
*/
int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
{
const char *cp;
unsigned long cplen, l;
cp = of_get_flat_dt_prop(node, "compatible", &cplen);
if (cp == NULL)
return 0;
while (cplen > 0) {
if (strncasecmp(cp, compat, strlen(compat)) == 0)
return 1;
l = strlen(cp) + 1;
cp += l;
cplen -= l;
}
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册