From aacb92ad5a0b18840f89667b9e5bdab047b35b0e Mon Sep 17 00:00:00 2001 From: Andrii Anisov Date: Thu, 3 Jul 2014 12:55:26 +0300 Subject: [PATCH] xen/dt: add match for non-available nodes Signed-off-by: Andrii Anisov Acked-by: Julien Grall Acked-by: Ian Campbell --- xen/common/device_tree.c | 6 +++++- xen/include/xen/device_tree.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index f0b17a3115..310635ea7d 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -680,7 +680,8 @@ bool_t dt_match_node(const struct dt_device_match *matches, if ( !matches ) return 0; - while ( matches->path || matches->type || matches->compatible ) + while ( matches->path || matches->type || + matches->compatible || matches->not_available ) { bool_t match = 1; @@ -693,6 +694,9 @@ bool_t dt_match_node(const struct dt_device_match *matches, if ( matches->compatible ) match &= dt_device_is_compatible(node, matches->compatible); + if ( matches->not_available ) + match &= !dt_device_is_available(node); + if ( match ) return match; diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h index 25db076460..865e1ef0fe 100644 --- a/xen/include/xen/device_tree.h +++ b/xen/include/xen/device_tree.h @@ -65,11 +65,13 @@ struct dt_device_match { const char *path; const char *type; const char *compatible; + const bool_t not_available; }; #define DT_MATCH_PATH(p) { .path = p } #define DT_MATCH_TYPE(typ) { .type = typ } #define DT_MATCH_COMPATIBLE(compat) { .compatible = compat } +#define DT_MATCH_NOT_AVAILABLE() { .not_available = 1 } typedef u32 dt_phandle; -- 2.39.5