why does fdt_fixup_ethernet() need to worry about an edited FDT?
looking at the code for fdt_fixup_ethernet() in fdt_support.c, and
i'm puzzled by the extra work being done ostensibly to take an "edited" FDT into account:
void fdt_fixup_ethernet(void *fdt)
{
int i, j, prop;
char *tmp, *end;
char mac[16];
const char *path;
unsigned char mac_addr[6];
int offset; if (fdt_path_offset(fdt, "/aliases") < 0)
return;
/* Cycle through all aliases */
for (prop = 0; ; prop++) {
const char *name;
int len = strlen("ethernet");
/* FDT might have been edited, recompute the offset */
offset = fdt_first_property_offset(fdt,
fdt_path_offset(fdt, "/aliases"));
/* Select property number 'prop' */
for (i = 0; i < prop; i++)
offset = fdt_next_property_offset(fdt, offset);
... snip ... why is it that *this* routine has to worry about an edited FDT, but
nothing else i see in that entire source file has to? as a (hopefully) relevant example:
#if defined(OF_STDOUT_PATH)
static int fdt_fixup_stdout(void *fdt, int chosenoff)
{
return fdt_setprop(fdt, chosenoff, "linux,stdout-path",
OF_STDOUT_PATH, strlen(OF_STDOUT_PATH) + 1);
}that routine simply calls fdt_setprop() ... what is it about fdt_fixup_ethernet() that needs to take extra care compared to every other function in that file?
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================Quoted 41 lines · Robert P. J. Day
looking at the code for
fdt_fixup_ethernet()infdt_support.c, and
i'm puzzled by the extra work being done ostensibly to take an "edited" FDT into account:void fdt_fixup_ethernet(void *fdt) { int i, j, prop; char *tmp, *end; char mac[16]; const char *path; unsigned char mac_addr[6]; int offset;if (fdt_path_offset(fdt, "/aliases") < 0) return; /* Cycle through all aliases */ for (prop = 0; ; prop++) { const char *name; int len = strlen("ethernet"); /* FDT might have been edited, recompute the offset */ offset = fdt_first_property_offset(fdt, fdt_path_offset(fdt, "/aliases")); /* Select property number 'prop' */ for (i = 0; i < prop; i++) offset = fdt_next_property_offset(fdt, offset); ... snip ...why is it that *this* routine has to worry about an edited FDT, but
nothing else i see in that entire source file has to? as a (hopefully) relevant example:#if defined(OF_STDOUT_PATH) static int fdt_fixup_stdout(void *fdt, int chosenoff) { return fdt_setprop(fdt, chosenoff, "linux,stdout-path", OF_STDOUT_PATH, strlen(OF_STDOUT_PATH) + 1); }
Quoted 4 lines
that routine simply calls
fdt_setprop()... what is it aboutfdt_fixup_ethernet()that needs to take extra care compared to every other function in that file?
Commit a434fd1d282fd32d81296c6d4c2e0911f6e488b3 explains this.
Regards,
Bin