Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91512
b: refs/heads/master
c: 834d97d
h: refs/heads/master
v: v3
  • Loading branch information
Josh Boyer authored and Paul Mackerras committed Apr 7, 2008
1 parent f874108 commit d82be47
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6ccf61f94fbac3e8715f2f938b27cdb3836c1f8c
refs/heads/master: 834d97d452208279edf11c57eca150360d2dd1d6
26 changes: 26 additions & 0 deletions trunk/drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,32 @@ int of_device_is_compatible(const struct device_node *device,
}
EXPORT_SYMBOL(of_device_is_compatible);

/**
* of_device_is_available - check if a device is available for use
*
* @device: Node to check for availability
*
* Returns 1 if the status property is absent or set to "okay" or "ok",
* 0 otherwise
*/
int of_device_is_available(const struct device_node *device)
{
const char *status;
int statlen;

status = of_get_property(device, "status", &statlen);
if (status == NULL)
return 1;

if (statlen > 0) {
if (!strcmp(status, "okay") || !strcmp(status, "ok"))
return 1;
}

return 0;
}
EXPORT_SYMBOL(of_device_is_available);

/**
* of_get_parent - Get a node's parent if any
* @node: Node to get parent
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ extern struct property *of_find_property(const struct device_node *np,
int *lenp);
extern int of_device_is_compatible(const struct device_node *device,
const char *);
extern int of_device_is_available(const struct device_node *device);
extern const void *of_get_property(const struct device_node *node,
const char *name,
int *lenp);
Expand Down

0 comments on commit d82be47

Please sign in to comment.