mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Jules Maselbas <jmaselbas@kalray.eu>, Ahmad Fatoum <ahmad@a3f.at>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/4] PBL: fdt: implement fdt_device_get_match_data
Date: Sun, 4 Apr 2021 13:22:44 +0200	[thread overview]
Message-ID: <742a08f0-5db9-7fed-023c-bddc0500e034@pengutronix.de> (raw)
In-Reply-To: <20210403120037.GA18977@tellis.lin.mbt.kalray.eu>

Hello Jules,

On 03.04.21 14:00, Jules Maselbas wrote:
>> +		for (id = ids; id->compatible; id++) {
>> +			if (strlen(id->compatible) == length &&
>> +			    !memcmp(list, id->compatible, length))
>> +				return id->data;
> Why not using strcmp, or even strcasecmp as done by of_compat_cmp ?
> If both string doesn't have the same length, strcmp will report a diff.

The code is based on fdt_stringlist_search. I assume it compared length
first, because it already computed it, so an early comparison
saves some cycles. Good point on case-insensitivity. I'll send out a v2.

Thanks,
Ahmad

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


      reply	other threads:[~2021-04-04 11:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-03  7:02 Ahmad Fatoum
2021-04-03  7:02 ` [PATCH 2/4] RISC-V: debug_ll: ns16550: split off debug_ll from generic parts Ahmad Fatoum
2021-04-03  7:02 ` [PATCH 3/4] RISC-V: board-dt-2nd: add PBL console support for virt Ahmad Fatoum
2021-04-03  7:02 ` [PATCH 4/4] RISC-V: delete unused mach-virt subdirectory Ahmad Fatoum
2021-04-03  9:49 ` [PATCH] fixup! PBL: fdt: implement fdt_device_get_match_data Ahmad Fatoum
2021-04-03 12:00 ` [PATCH 1/4] " Jules Maselbas
2021-04-04 11:22   ` Ahmad Fatoum [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=742a08f0-5db9-7fed-023c-bddc0500e034@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    --cc=jmaselbas@kalray.eu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox