Commit 364ac5b5836055c2a49f986769b2d925f230f093
Committed by
Tom Rini
1 parent
1fddd7b63c
Exists in
v2017.01-smarct4x
and in
37 other branches
image: Convert to use fdt_for_each_subnode macro
Use fdt_for_each_subnode macro to simplify the code a bit. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Simon Glass <sjg@chromium.org>
Showing 2 changed files with 5 additions and 15 deletions Side-by-side Diff
common/image-fit.c
... | ... | @@ -1010,9 +1010,7 @@ |
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | /* Process all hash subnodes of the component image node */ |
1013 | - for (noffset = fdt_first_subnode(fit, image_noffset); | |
1014 | - noffset >= 0; | |
1015 | - noffset = fdt_next_subnode(fit, noffset)) { | |
1013 | + fdt_for_each_subnode(fit, noffset, image_noffset) { | |
1016 | 1014 | const char *name = fit_get_name(fit, noffset, NULL); |
1017 | 1015 | |
1018 | 1016 | /* |
common/image-sig.c
... | ... | @@ -212,9 +212,7 @@ |
212 | 212 | int ret; |
213 | 213 | |
214 | 214 | /* Process all hash subnodes of the component image node */ |
215 | - for (noffset = fdt_first_subnode(fit, image_noffset); | |
216 | - noffset >= 0; | |
217 | - noffset = fdt_next_subnode(fit, noffset)) { | |
215 | + fdt_for_each_subnode(fit, noffset, image_noffset) { | |
218 | 216 | const char *name = fit_get_name(fit, noffset, NULL); |
219 | 217 | |
220 | 218 | if (!strncmp(name, FIT_SIG_NODENAME, |
... | ... | @@ -262,9 +260,7 @@ |
262 | 260 | return 0; |
263 | 261 | } |
264 | 262 | |
265 | - for (noffset = fdt_first_subnode(sig_blob, sig_node); | |
266 | - noffset >= 0; | |
267 | - noffset = fdt_next_subnode(sig_blob, noffset)) { | |
263 | + fdt_for_each_subnode(sig_blob, noffset, sig_node) { | |
268 | 264 | const char *required; |
269 | 265 | int ret; |
270 | 266 | |
... | ... | @@ -397,9 +393,7 @@ |
397 | 393 | int ret; |
398 | 394 | |
399 | 395 | /* Process all hash subnodes of the component conf node */ |
400 | - for (noffset = fdt_first_subnode(fit, conf_noffset); | |
401 | - noffset >= 0; | |
402 | - noffset = fdt_next_subnode(fit, noffset)) { | |
396 | + fdt_for_each_subnode(fit, noffset, conf_noffset) { | |
403 | 397 | const char *name = fit_get_name(fit, noffset, NULL); |
404 | 398 | |
405 | 399 | if (!strncmp(name, FIT_SIG_NODENAME, |
... | ... | @@ -444,9 +438,7 @@ |
444 | 438 | return 0; |
445 | 439 | } |
446 | 440 | |
447 | - for (noffset = fdt_first_subnode(sig_blob, sig_node); | |
448 | - noffset >= 0; | |
449 | - noffset = fdt_next_subnode(sig_blob, noffset)) { | |
441 | + fdt_for_each_subnode(sig_blob, noffset, sig_node) { | |
450 | 442 | const char *required; |
451 | 443 | int ret; |
452 | 444 |