Re: [PATCH 1/4] PBL: fdt: implement fdt_device_get_match_data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux