Re: [U-Boot] [PATCH v2 04/17] dm: fdt: Correct handling of aliases with embedded digits
On 17 November 2014 at 19:32, Tom Rini wrote: > On Mon, Nov 17, 2014 at 05:57:43AM +, Simon Glass wrote: >> Hi Tom, >> >> On 17 November 2014 00:46, Tom Rini wrote: >> > >> > On Tue, Nov 11, 2014 at 10:46:20AM -0700, Simon Glass wrote: >> > >> > > Since we scan from left to right looking for the first digit, "i2c0" >> > > returns >> > > 2 instead of 0 for the alias number. Adjust the code to scan from right >> > > to >> > > left instead. >> > > >> > > Signed-off-by: Simon Glass >> > >> > How about i2c10 ? I assume you see where I'm worried about here.. >> >> It goes back to the first non-digit, so will produce 10 in this case >> as expected. > > Oh good. > > Reviewed-by: Tom Rini Applied to u-boot-dm. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 04/17] dm: fdt: Correct handling of aliases with embedded digits
On Mon, Nov 17, 2014 at 05:57:43AM +, Simon Glass wrote: > Hi Tom, > > On 17 November 2014 00:46, Tom Rini wrote: > > > > On Tue, Nov 11, 2014 at 10:46:20AM -0700, Simon Glass wrote: > > > > > Since we scan from left to right looking for the first digit, "i2c0" > > > returns > > > 2 instead of 0 for the alias number. Adjust the code to scan from right to > > > left instead. > > > > > > Signed-off-by: Simon Glass > > > > How about i2c10 ? I assume you see where I'm worried about here.. > > It goes back to the first non-digit, so will produce 10 in this case > as expected. Oh good. Reviewed-by: Tom Rini -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 04/17] dm: fdt: Correct handling of aliases with embedded digits
Hello Simon, Am 11.11.2014 18:46, schrieb Simon Glass: Since we scan from left to right looking for the first digit, "i2c0" returns 2 instead of 0 for the alias number. Adjust the code to scan from right to left instead. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to correct handling of aliases with embedded digits lib/fdtdec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Acked-by: Heiko Schocher bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 04/17] dm: fdt: Correct handling of aliases with embedded digits
Hi Tom, On 17 November 2014 00:46, Tom Rini wrote: > > On Tue, Nov 11, 2014 at 10:46:20AM -0700, Simon Glass wrote: > > > Since we scan from left to right looking for the first digit, "i2c0" returns > > 2 instead of 0 for the alias number. Adjust the code to scan from right to > > left instead. > > > > Signed-off-by: Simon Glass > > How about i2c10 ? I assume you see where I'm worried about here.. It goes back to the first non-digit, so will produce 10 in this case as expected. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 04/17] dm: fdt: Correct handling of aliases with embedded digits
On Tue, Nov 11, 2014 at 10:46:20AM -0700, Simon Glass wrote: > Since we scan from left to right looking for the first digit, "i2c0" returns > 2 instead of 0 for the alias number. Adjust the code to scan from right to > left instead. > > Signed-off-by: Simon Glass How about i2c10 ? I assume you see where I'm worried about here.. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 04/17] dm: fdt: Correct handling of aliases with embedded digits
Since we scan from left to right looking for the first digit, "i2c0" returns 2 instead of 0 for the alias number. Adjust the code to scan from right to left instead. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to correct handling of aliases with embedded digits lib/fdtdec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 9714620..da6ef6b 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -355,9 +355,9 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int offset, slash = strrchr(prop, '/'); if (strcmp(slash + 1, find_name)) continue; - for (p = name; *p; p++) { - if (isdigit(*p)) { - *seqp = simple_strtoul(p, NULL, 10); + for (p = name + strlen(name) - 1; p > name; p--) { + if (!isdigit(*p)) { + *seqp = simple_strtoul(p + 1, NULL, 10); debug("Found seq %d\n", *seqp); return 0; } -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot