All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Masahiro Yamada
	<yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] libfdt: simplify fdt_node_check_compatible()
Date: Sat, 20 Feb 2016 11:29:31 +1100	[thread overview]
Message-ID: <20160220002931.GC15224@voom.fritz.box> (raw)
In-Reply-To: <1455255912-26241-1-git-send-email-yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>

[-- 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 --]

      parent reply	other threads:[~2016-02-20  0:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160220002931.GC15224@voom.fritz.box \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.