diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2011-12-07 22:36:55 +0000 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2011-12-08 09:08:24 -0800 |
commit | d1782ef04ceff3534ffa71675e1d636cbf682bc5 (patch) | |
tree | 3f59e3af7e0b919b45b15418a334c6bcf932f9b9 | |
parent | ef299dd83dfba5371a974edd26c862da214255cf (diff) |
fdt: Add function to read boolean property
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:5752
TEST=on Lumpy, test Ctrl+D behavior with and without usb-keyboard set
in the device tree.
Change-Id: I7bb2f6ea18f5edadea93f9e5d23ed49ed57a3b23
Reviewed-on: https://gerrit.chromium.org/gerrit/12589
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | common/fdt_decode.c | 14 | ||||
-rw-r--r-- | include/fdt_decode.h | 10 |
2 files changed, 24 insertions, 0 deletions
diff --git a/common/fdt_decode.c b/common/fdt_decode.c index cd69ce2dabe..b983710bcd2 100644 --- a/common/fdt_decode.c +++ b/common/fdt_decode.c @@ -640,6 +640,20 @@ int fdt_decode_get_config_int(const void *blob, const char *prop_name, return get_int(blob, config_node, prop_name, default_val); } +int fdt_decode_get_config_bool(const void *blob, const char *prop_name) +{ + int config_node; + const void *prop; + + debug("%s: %s\n", __func__, prop_name); + config_node = fdt_path_offset(blob, "/config"); + if (config_node < 0) + return 0; + prop = fdt_get_property(blob, config_node, prop_name, NULL); + + return prop != NULL; +} + int fdt_decode_kbc(const void *blob, int node, struct fdt_kbc *config) { int err; diff --git a/include/fdt_decode.h b/include/fdt_decode.h index da6a3c28553..7b9e94919cf 100644 --- a/include/fdt_decode.h +++ b/include/fdt_decode.h @@ -516,6 +516,16 @@ int fdt_decode_get_config_int(const void *blob, const char *prop_name, int default_val); /** + * Look in the FDT for a config item with the given name + * and return whether it exists. + * + * @param blob FDT blob + * @param prop_name property name to look up + * @return 1, if it exists, or 0 if not + */ +int fdt_decode_get_config_bool(const void *blob, const char *prop_name); + +/** * Returns information from the FDT about an i2c controller. This function * reads out the following attributes: * |