Skip to contentSkip to conversation

net: eth_common: Don't use %pM when USE_TINY_PRINTF is enabled

PATCH Superseded Vignesh R 2 participants 3 messages Mar 31, 2017 – Apr 3, 2017 Networking

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Vignesh R

author
#0 lore raw

PATCH 1/1 net: eth_common: Don't use %pM when USE_TINY_PRINTF is enabled

Tiny printf doesn't support %pM, so when CONFIG_USE_TINY_PRINTF is enabled use %x to manually print MAC address.

---
 net/eth_common.c | 7 +++++++
 1 file changed, 7 insertions(+)
net/eth_common.c +7 -0
index 58fa29577102..cd67a21585c6 100644
@@ -37,7 +37,14 @@ int eth_setenv_enetaddr(const char *name, const uchar *enetaddr)
 	if (eth_getenv_enetaddr(name, (uchar *)buf))
 		return -EEXIST;
 
+#ifndef CONFIG_USE_TINY_PRINTF
 	sprintf(buf, "%pM", enetaddr);
+#else
+	sprintf(buf, "%x:%x:%x:%x:%x:%x", (unsigned int)enetaddr[0],
+		(unsigned int)enetaddr[1], (unsigned int)enetaddr[2],
+		(unsigned int)enetaddr[3], (unsigned int)enetaddr[4],
+		(unsigned int)enetaddr[5]);
+#endif
 
 	return setenv(name, buf);
 }
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 net: eth_common: Don't use %pM when USE_TINY_PRINTF is enabled

Quoted 13 lines · Vignesh R

Tiny printf doesn't support %pM, so when CONFIG_USE_TINY_PRINTF is enabled use %x to manually print MAC address.

---
 net/eth_common.c | 7 +++++++
 1 file changed, 7 insertions(+)
net/eth_common.c +0 -0
index 58fa29577102..cd67a21585c6 100644

net/eth_common.c int eth_setenv_enetaddr(const char *name, const uchar *enetaddr) · line 40

Quoted 4 lines
net/eth_common.c +1 -0
@@ -37,7 +37,14 @@ int eth_setenv_enetaddr(const char *name, const uchar *enetaddr)
        if (eth_getenv_enetaddr(name, (uchar *)buf))
                return -EEXIST;
 
+#ifndef CONFIG_USE_TINY_PRINTF

Use positive logic. Switch these cases around.

Quoted 17 lines
net/eth_common.c +6 -1
        sprintf(buf, "%pM", enetaddr);
+#else
+       sprintf(buf, "%x:%x:%x:%x:%x:%x", (unsigned int)enetaddr[0],
+               (unsigned int)enetaddr[1], (unsigned int)enetaddr[2],
+               (unsigned int)enetaddr[3], (unsigned int)enetaddr[4],
+               (unsigned int)enetaddr[5]);
+#endif
 
        return setenv(name, buf);
 }
--

2.11.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

author
#2 lore raw

PATCH 1/1 net: eth_common: Don't use %pM when USE_TINY_PRINTF is enabled

Quoted 17 lines · Joe Hershberger
Quoted 16 lines · Vignesh R

Tiny printf doesn't support %pM, so when CONFIG_USE_TINY_PRINTF is enabled use %x to manually print MAC address.

---
 net/eth_common.c | 7 +++++++
 1 file changed, 7 insertions(+)
net/eth_common.c +0 -0
index 58fa29577102..cd67a21585c6 100644
@@ -37,7 +37,14 @@ int eth_setenv_enetaddr(const char *name, const uchar *enetaddr)
        if (eth_getenv_enetaddr(name, (uchar *)buf))
                return -EEXIST;
 
Quoted 3 lines

net/eth_common.c int eth_setenv_enetaddr(const char *name, const uchar *enetaddr) · line 40

Quoted 1 line
net/eth_common.c +1 -0
+#ifndef CONFIG_USE_TINY_PRINTF

Use positive logic. Switch these cases around.

Ok, posted version 2 with this change. Thanks!

Quoted 18 lines
Quoted 18 lines
net/eth_common.c +6 -1
        sprintf(buf, "%pM", enetaddr);
+#else
+       sprintf(buf, "%x:%x:%x:%x:%x:%x", (unsigned int)enetaddr[0],
+               (unsigned int)enetaddr[1], (unsigned int)enetaddr[2],
+               (unsigned int)enetaddr[3], (unsigned int)enetaddr[4],
+               (unsigned int)enetaddr[5]);
+#endif
 
        return setenv(name, buf);
 }
--

2.11.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 2 lines
Regards
Vignesh