[U-Boot] [Patch v4] powerpc/eeprom: cleanup mac command

Wolfgang Denk wd at denx.de
Fri Oct 14 23:32:58 CEST 2011


Dear York Sun,

In message <1313076710-12662-1-git-send-email-yorksun at freescale.com> you wrote:
> Change the help message to be more helpful. Print argument format.
> Fix MAX_NUM_PORTS to comply with v1 NXID format. Accept hexadecimal and
> decimal for port count and index.
...

>  	case 'p':	/* MAC table size */
> -		e.mac_count = simple_strtoul(argv[2], NULL, 16);
> +		e.mac_count = simple_strtoul(argv[2], NULL, 0);
>  		update_crc();
>  		break;
> -	case '0' ... '9':	/* "mac 0" through "mac 22" */
> -		set_mac_address(simple_strtoul(argv[1], NULL, 10), argv[2]);
> +	case '0' ... '9':	/* "mac 0" through "mac 31" */
> +		set_mac_address(simple_strtoul(argv[1], NULL, 0), argv[2]);

These changes silently change the behaviour of the command.  So far,
an argument line "24" would be parsed as hex number (i. e. result in
decimal value 36); with this change it suddenly becomes devcimal 24,
which is quite unexpected.

There are very few exceptions wher eU-Boot uses and expects decimal
numbers, and I strongly recommend not to add any new such
inconsistencies.

> +#ifdef CONFIG_SYS_I2C_EEPROM_NXID
> +	"    - program the MAC address for port n [n=0...30]"

0...30 ?  The code above says "mac 0" through "mac 31"?
Or is it 0 ... 22 ?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Always try to do things in chronological order; it's  less  confusing
that way.


More information about the U-Boot mailing list