devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libfdt: simplify fdt_node_check_compatible()
@ 2016-02-12  5:45 Masahiro Yamada
       [not found] ` <1455255912-26241-1-git-send-email-yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2016-02-12  5:45 UTC (permalink / raw)
  To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA; +Cc: Masahiro Yamada

Because fdt_stringlist_contains() returns 1 or 0,
fdt_node_check_compatible() can just return the inverted value.

Signed-off-by: Masahiro Yamada <yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
---

 libfdt/fdt_ro.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c
index e5b3136..50cce86 100644
--- a/libfdt/fdt_ro.c
+++ b/libfdt/fdt_ro.c
@@ -647,10 +647,8 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset,
 	prop = fdt_getprop(fdt, nodeoffset, "compatible", &len);
 	if (!prop)
 		return len;
-	if (fdt_stringlist_contains(prop, len, compatible))
-		return 0;
-	else
-		return 1;
+
+	return !fdt_stringlist_contains(prop, len, compatible);
 }
 
 int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libfdt: simplify fdt_node_check_compatible()
       [not found] ` <1455255912-26241-1-git-send-email-yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
@ 2016-02-20  0:29   ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2016-02-20  0:29 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1162 bytes --]

On Fri, Feb 12, 2016 at 02:45:12PM +0900, Masahiro Yamada wrote:
> Because fdt_stringlist_contains() returns 1 or 0,
> fdt_node_check_compatible() can just return the inverted value.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>

Applied, thanks.

> ---
> 
>  libfdt/fdt_ro.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c
> index e5b3136..50cce86 100644
> --- a/libfdt/fdt_ro.c
> +++ b/libfdt/fdt_ro.c
> @@ -647,10 +647,8 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset,
>  	prop = fdt_getprop(fdt, nodeoffset, "compatible", &len);
>  	if (!prop)
>  		return len;
> -	if (fdt_stringlist_contains(prop, len, compatible))
> -		return 0;
> -	else
> -		return 1;
> +
> +	return !fdt_stringlist_contains(prop, len, compatible);
>  }
>  
>  int fdt_node_offset_by_compatible(const void *fdt, int startoffset,

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-20  0:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-12  5:45 [PATCH] libfdt: simplify fdt_node_check_compatible() Masahiro Yamada
     [not found] ` <1455255912-26241-1-git-send-email-yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
2016-02-20  0:29   ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).