Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62183
b: refs/heads/master
c: 1ef4d42
h: refs/heads/master
i:
  62181: 7ef90b3
  62179: 65e6c19
  62175: 7a1d3b1
v: v3
  • Loading branch information
Stephen Rothwell committed Jul 20, 2007
1 parent b52d9ea commit b751302
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 235 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d1cd355a5e44dfe993efc0c0458ca9f99a28a9a3
refs/heads/master: 1ef4d4242d9c494c49ae1ae66dc938fce0272816
115 changes: 1 addition & 114 deletions trunk/arch/powerpc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static struct boot_param_header *initial_boot_params __initdata;
struct boot_param_header *initial_boot_params;
#endif

static struct device_node *allnodes = NULL;
extern struct device_node *allnodes; /* temporary while merging */

extern rwlock_t devtree_lock; /* temporary while merging */

Expand Down Expand Up @@ -1083,119 +1083,6 @@ EXPORT_SYMBOL(machine_is_compatible);
*
*******/

/**
* of_find_node_by_name - Find a node by its "name" property
* @from: The node to start searching from or NULL, the node
* you pass will not be searched, only the next one
* will; typically, you pass what the previous call
* returned. of_node_put() will be called on it
* @name: The name string to match against
*
* Returns a node pointer with refcount incremented, use
* of_node_put() on it when done.
*/
struct device_node *of_find_node_by_name(struct device_node *from,
const char *name)
{
struct device_node *np;

read_lock(&devtree_lock);
np = from ? from->allnext : allnodes;
for (; np != NULL; np = np->allnext)
if (np->name != NULL && strcasecmp(np->name, name) == 0
&& of_node_get(np))
break;
of_node_put(from);
read_unlock(&devtree_lock);
return np;
}
EXPORT_SYMBOL(of_find_node_by_name);

/**
* of_find_node_by_type - Find a node by its "device_type" property
* @from: The node to start searching from, or NULL to start searching
* the entire device tree. The node you pass will not be
* searched, only the next one will; typically, you pass
* what the previous call returned. of_node_put() will be
* called on from for you.
* @type: The type string to match against
*
* Returns a node pointer with refcount incremented, use
* of_node_put() on it when done.
*/
struct device_node *of_find_node_by_type(struct device_node *from,
const char *type)
{
struct device_node *np;

read_lock(&devtree_lock);
np = from ? from->allnext : allnodes;
for (; np != 0; np = np->allnext)
if (np->type != 0 && strcasecmp(np->type, type) == 0
&& of_node_get(np))
break;
of_node_put(from);
read_unlock(&devtree_lock);
return np;
}
EXPORT_SYMBOL(of_find_node_by_type);

/**
* of_find_compatible_node - Find a node based on type and one of the
* tokens in its "compatible" property
* @from: The node to start searching from or NULL, the node
* you pass will not be searched, only the next one
* will; typically, you pass what the previous call
* returned. of_node_put() will be called on it
* @type: The type string to match "device_type" or NULL to ignore
* @compatible: The string to match to one of the tokens in the device
* "compatible" list.
*
* Returns a node pointer with refcount incremented, use
* of_node_put() on it when done.
*/
struct device_node *of_find_compatible_node(struct device_node *from,
const char *type, const char *compatible)
{
struct device_node *np;

read_lock(&devtree_lock);
np = from ? from->allnext : allnodes;
for (; np != 0; np = np->allnext) {
if (type != NULL
&& !(np->type != 0 && strcasecmp(np->type, type) == 0))
continue;
if (of_device_is_compatible(np, compatible) && of_node_get(np))
break;
}
of_node_put(from);
read_unlock(&devtree_lock);
return np;
}
EXPORT_SYMBOL(of_find_compatible_node);

/**
* of_find_node_by_path - Find a node matching a full OF path
* @path: The full path to match
*
* Returns a node pointer with refcount incremented, use
* of_node_put() on it when done.
*/
struct device_node *of_find_node_by_path(const char *path)
{
struct device_node *np = allnodes;

read_lock(&devtree_lock);
for (; np != 0; np = np->allnext) {
if (np->full_name != 0 && strcasecmp(np->full_name, path) == 0
&& of_node_get(np))
break;
}
read_unlock(&devtree_lock);
return np;
}
EXPORT_SYMBOL(of_find_node_by_path);

/**
* of_find_node_by_phandle - Find a node given a phandle
* @handle: phandle of the node to find
Expand Down
61 changes: 1 addition & 60 deletions trunk/arch/sparc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,10 @@
#include <asm/prom.h>
#include <asm/oplib.h>

static struct device_node *allnodes;
extern struct device_node *allnodes; /* temporary while merging */

extern rwlock_t devtree_lock; /* temporary while merging */

struct device_node *of_find_node_by_path(const char *path)
{
struct device_node *np = allnodes;

for (; np != 0; np = np->allnext) {
if (np->full_name != 0 && strcmp(np->full_name, path) == 0)
break;
}

return np;
}
EXPORT_SYMBOL(of_find_node_by_path);

struct device_node *of_find_node_by_phandle(phandle handle)
{
struct device_node *np;
Expand All @@ -54,52 +41,6 @@ struct device_node *of_find_node_by_phandle(phandle handle)
}
EXPORT_SYMBOL(of_find_node_by_phandle);

struct device_node *of_find_node_by_name(struct device_node *from,
const char *name)
{
struct device_node *np;

np = from ? from->allnext : allnodes;
for (; np != NULL; np = np->allnext)
if (np->name != NULL && strcmp(np->name, name) == 0)
break;

return np;
}
EXPORT_SYMBOL(of_find_node_by_name);

struct device_node *of_find_node_by_type(struct device_node *from,
const char *type)
{
struct device_node *np;

np = from ? from->allnext : allnodes;
for (; np != 0; np = np->allnext)
if (np->type != 0 && strcmp(np->type, type) == 0)
break;

return np;
}
EXPORT_SYMBOL(of_find_node_by_type);

struct device_node *of_find_compatible_node(struct device_node *from,
const char *type, const char *compatible)
{
struct device_node *np;

np = from ? from->allnext : allnodes;
for (; np != 0; np = np->allnext) {
if (type != NULL
&& !(np->type != 0 && strcmp(np->type, type) == 0))
continue;
if (of_device_is_compatible(np, compatible))
break;
}

return np;
}
EXPORT_SYMBOL(of_find_compatible_node);

int of_getintprop_default(struct device_node *np, const char *name, int def)
{
struct property *prop;
Expand Down
61 changes: 1 addition & 60 deletions trunk/arch/sparc64/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,10 @@
#include <asm/upa.h>
#include <asm/smp.h>

static struct device_node *allnodes;
extern struct device_node *allnodes; /* temporary while merging */

extern rwlock_t devtree_lock; /* temporary while merging */

struct device_node *of_find_node_by_path(const char *path)
{
struct device_node *np = allnodes;

for (; np != 0; np = np->allnext) {
if (np->full_name != 0 && strcmp(np->full_name, path) == 0)
break;
}

return np;
}
EXPORT_SYMBOL(of_find_node_by_path);

struct device_node *of_find_node_by_phandle(phandle handle)
{
struct device_node *np;
Expand All @@ -59,52 +46,6 @@ struct device_node *of_find_node_by_phandle(phandle handle)
}
EXPORT_SYMBOL(of_find_node_by_phandle);

struct device_node *of_find_node_by_name(struct device_node *from,
const char *name)
{
struct device_node *np;

np = from ? from->allnext : allnodes;
for (; np != NULL; np = np->allnext)
if (np->name != NULL && strcmp(np->name, name) == 0)
break;

return np;
}
EXPORT_SYMBOL(of_find_node_by_name);

struct device_node *of_find_node_by_type(struct device_node *from,
const char *type)
{
struct device_node *np;

np = from ? from->allnext : allnodes;
for (; np != 0; np = np->allnext)
if (np->type != 0 && strcmp(np->type, type) == 0)
break;

return np;
}
EXPORT_SYMBOL(of_find_node_by_type);

struct device_node *of_find_compatible_node(struct device_node *from,
const char *type, const char *compatible)
{
struct device_node *np;

np = from ? from->allnext : allnodes;
for (; np != 0; np = np->allnext) {
if (type != NULL
&& !(np->type != 0 && strcmp(np->type, type) == 0))
continue;
if (of_device_is_compatible(np, compatible))
break;
}

return np;
}
EXPORT_SYMBOL(of_find_compatible_node);

int of_getintprop_default(struct device_node *np, const char *name, int def)
{
struct property *prop;
Expand Down
Loading

0 comments on commit b751302

Please sign in to comment.