[U-Boot] [PATCH v2] net: eth_common: Don't use %pM when USE_TINY_PRINTF is enabled

Vignesh R vigneshr at ti.com
Mon Apr 3 08:06:03 UTC 2017


Dear Wolfgang Denk,

On Monday 03 April 2017 12:03 PM, Wolfgang Denk wrote:
> Dear Vignesh,
> 
> In message <20170403054659.32553-1-vigneshr at ti.com> you wrote:
>> 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(+)
> 
> I wonder if this is sufficient.  There is a ton of other files which
> use the %pM format:
> 
> 	arch/arm/mach-davinci/misc.c
> 	board/BuR/common/common.c
> 	board/bct-brettl2/bct-brettl2.c
> 	board/keymile/common/ivm.c
> 	board/pdm360ng/pdm360ng.c
> 	board/spear/common/spr_misc.c
> 	drivers/net/dm9000x.c
> 	drivers/net/fec_mxc.c
> 	drivers/net/lan91c96.c
> 	drivers/net/ne2000_base.c
> 	drivers/net/sandbox.c
> 	drivers/net/smc91111.c
> 	drivers/net/smc911x.c
> 	drivers/usb/eth/asix.c
> 	drivers/usb/eth/asix88179.c
> 	drivers/usb/eth/mcs7830.c
> 	drivers/usb/eth/r8152.c
> 	drivers/usb/eth/smsc95xx.c
> 	drivers/usb/gadget/ether.c
> 	net/arp.c
> 	net/eth-uclass.c
> 	net/eth_common.c
> 	net/eth_legacy.c
> 	net/link_local.c
> 	net/net.c
> 
> Adding similar #ifdef's to all of these seems to be a really bad
> idea to me.
> 
> Also, it would result in a lot of code duplication which is exactly
> what the introduction of the %p? formats intends to avoid.
> 
> So hat we need here is a way to determin if the code for a given
> configuration uses a specific %p? format, and then enable this even
> with CONFIG_USE_TINY_PRINTF.
> 

I agree, networking widely uses %pM for printing mac addresses.
Are you suggesting to port %pM support from lib/vsprintf.c to
lib/tiny-printf.c and make it available based on CONFIG_CMD_NET?

> OTOH - what is the use case for CONFIG_USE_TINY_PRINTF in
> combination with network related code?  I would expect to 
> see this config option in memory restricted environments like SPL,
> but there you don't include support for networking - or do you?
> 

I am trying to use RNDIS boot on am437x/am335x boards with
CONFIG_USE_TINY_PRINTF(to reduce code size due to internal SRAM size
constraint) and therefore need networking support in SPL.



-- 
Regards
Vignesh


More information about the U-Boot mailing list