diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2016-06-25 08:47:34 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-07-06 19:30:48 +1000 |
commit | fb43f202ddd86131acf14542c34fbcb9adab45f2 (patch) | |
tree | 63e5fdc036e0a98efe90f27a52881fe7b0783e78 /core/device.c | |
parent | 5740d2eb91303715fd077cf2deb7347fb1173e69 (diff) | |
download | skiboot-fb43f202ddd86131acf14542c34fbcb9adab45f2.zip skiboot-fb43f202ddd86131acf14542c34fbcb9adab45f2.tar.gz skiboot-fb43f202ddd86131acf14542c34fbcb9adab45f2.tar.bz2 |
devicetree: Add dt_node_is_enabled()
This accessor tests the "status" property allowing us to represent
disabled devices in the device-tree. It will be used by PHB4 initially
but its usage could be made more widespread.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/device.c')
-rw-r--r-- | core/device.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/device.c b/core/device.c index 4818d40..9e7ef0d 100644 --- a/core/device.c +++ b/core/device.c @@ -910,3 +910,13 @@ u64 dt_translate_address(const struct dt_node *node, unsigned int index, /* XXX TODO */ return dt_get_address(node, index, out_size); } + +bool dt_node_is_enabled(struct dt_node *node) +{ + const struct dt_property *p = dt_find_property(node, "status"); + + if (!p) + return true; + + return p->len > 1 && p->prop[0] == 'o' && p->prop[1] == 'k'; +} |