nvmem: layouts: u-boot-env: remove ethaddr check
Subsystems (2)
PATCH 1/1 nvmem: layouts: u-boot-env: remove ethaddr check
Manufacturers use various names for MAC addresses in u-boot.
Stuff like:
eth1addr
RADIOADDR0
RADIOADDR1
wmac1
wmac2
wanaddr
wlanmac
lanmac
wanmac
and many others. Don't restruct to just ethaddr in order to handle the various names.
--- drivers/nvmem/layouts/u-boot-env.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/nvmem/layouts/u-boot-env.c +3 -5
@@ -75,11 +75,9 @@ static int u_boot_env_parse_cells(struct device *dev, struct nvmem_device *nvmem info.offset = data_offset + value - data; info.bytes =strlen (value); info.np =of_get_child_by_name (dev->of_node, info.name); -if (!strcmp (var,"ethaddr" )) { - info.raw_len =strlen (value); - info.bytes =ETH_ALEN ; - info.read_post_process = u_boot_env_read_post_process_ethaddr; - } + info.raw_len =strlen (value); + info.bytes =ETH_ALEN ; + info.read_post_process = u_boot_env_read_post_process_ethaddr;nvmem_add_one_cell (nvmem, &info); }
Signature · 1 line
2.54.0
Hi Rosen,
drivers/nvmem/layouts/u-boot-env.c static int u_boot_env_parse_cells(struct device *dev, struct nvmem_device *nvmem · line 79
Quoted 13 lines
drivers/nvmem/layouts/u-boot-env.c +2
-5@@ -75,11 +75,9 @@ static int u_boot_env_parse_cells(struct device *dev, struct nvmem_device *nvmem info.offset = data_offset + value - data; info.bytes =strlen (value); info.np =of_get_child_by_name (dev->of_node, info.name); -if (!strcmp (var,"ethaddr" )) { - info.raw_len =strlen (value); - info.bytes =ETH_ALEN ; - info.read_post_process = u_boot_env_read_post_process_ethaddr; - } + info.raw_len =strlen (value); + info.bytes =ETH_ALEN ;
How do you know this is a MAC address?
Thanks,
Miquèl
Quoted 17 lines · Miquel Raynal
Hi Rosen,
drivers/nvmem/layouts/u-boot-env.c static int u_boot_env_parse_cells(struct device *dev, struct nvmem_device *nvmem · line 79
Quoted 13 lines
drivers/nvmem/layouts/u-boot-env.c +2
-5@@ -75,11 +75,9 @@ static int u_boot_env_parse_cells(struct device *dev, struct nvmem_device *nvmem info.offset = data_offset + value - data; info.bytes =strlen (value); info.np =of_get_child_by_name (dev->of_node, info.name); -if (!strcmp (var,"ethaddr" )) { - info.raw_len =strlen (value); - info.bytes =ETH_ALEN ; - info.read_post_process = u_boot_env_read_post_process_ethaddr; - } + info.raw_len =strlen (value); + info.bytes =ETH_ALEN ;How do you know this is a MAC address?
You are overwriting info.bytes above. I am sorry but this change has only been tested with your very own settings and does not look like something we could accept.
You cannot attach the "process ethaddr" subprocess to any node, that would not make any sense.
I guess we can extend a bit the condition with thinks like "eth%daddr", but that must remain limited.
Thanks,
Miquèl
Quoted 25 lines · Miquel Raynal
Quoted 17 lines · Miquel Raynal
Hi Rosen,
drivers/nvmem/layouts/u-boot-env.c static int u_boot_env_parse_cells(struct device *dev, struct nvmem_device *nvmem · line 79
Quoted 13 lines
drivers/nvmem/layouts/u-boot-env.c +2
-5@@ -75,11 +75,9 @@ static int u_boot_env_parse_cells(struct device *dev, struct nvmem_device *nvmem info.offset = data_offset + value - data; info.bytes =strlen (value); info.np =of_get_child_by_name (dev->of_node, info.name); -if (!strcmp (var,"ethaddr" )) { - info.raw_len =strlen (value); - info.bytes =ETH_ALEN ; - info.read_post_process = u_boot_env_read_post_process_ethaddr; - } + info.raw_len =strlen (value); + info.bytes =ETH_ALEN ;How do you know this is a MAC address?
You are overwriting info.bytes above. I am sorry but this change has only been tested with your very own settings and does not look like something we could accept.
Quoted 5 lines
You cannot attach the "process ethaddr" subprocess to any node, that would not make any sense.
I guess we can extend a bit the condition with thinks like "eth%daddr", but that must remain limited.
how about a static array of the names and strcmp over that?
Quoted 3 lines
Thanks,
Miquèl
Quoted 27 lines · Rosen Penev
Quoted 25 lines · Miquel Raynal
Quoted 17 lines · Miquel Raynal
Hi Rosen,
drivers/nvmem/layouts/u-boot-env.c static int u_boot_env_parse_cells(struct device *dev, struct nvmem_device *nvmem · line 79
Quoted 13 lines
drivers/nvmem/layouts/u-boot-env.c +2
-5@@ -75,11 +75,9 @@ static int u_boot_env_parse_cells(struct device *dev, struct nvmem_device *nvmem info.offset = data_offset + value - data; info.bytes =strlen (value); info.np =of_get_child_by_name (dev->of_node, info.name); -if (!strcmp (var,"ethaddr" )) { - info.raw_len =strlen (value); - info.bytes =ETH_ALEN ; - info.read_post_process = u_boot_env_read_post_process_ethaddr; - } + info.raw_len =strlen (value); + info.bytes =ETH_ALEN ;How do you know this is a MAC address?
You are overwriting info.bytes above. I am sorry but this change has only been tested with your very own settings and does not look like something we could accept.
Quoted 6 lines
Quoted 5 lines
You cannot attach the "process ethaddr" subprocess to any node, that would not make any sense.
I guess we can extend a bit the condition with thinks like "eth%daddr", but that must remain limited.
how about a static array of the names and strcmp over that?
You can check for eth on the first offsets, and then addr starting from offset 4, allowing up to 10 ethernet interfaces to by dynamically assigned, that should be enough. If not enough, you can also try at offset 5, which would bring that up to 100 possible interfaces. I belive you can directly give the strings to strcmp, no need for a global declaration.
Thanks,
Miquèl