[U-Boot] [PATCH V2 2/2] MMC: add erase function to both mmc and sd

Mike Frysinger vapier at gentoo.org
Wed Jun 22 18:57:55 CEST 2011


On Monday, June 20, 2011 10:10:16 Lei Wen wrote:
> +		if (state == MMC_ERASE) {
> +			blk = simple_strtoul(argv[2], NULL, 16);
> +			cnt = simple_strtoul(argv[3], NULL, 16);
> +		} else {
> +			addr = (void *)simple_strtoul(argv[2], NULL, 16);
> +			blk = simple_strtoul(argv[3], NULL, 16);
> +			cnt = simple_strtoul(argv[4], NULL, 16);
> +		}

you could do:
	char **args = &argv[2];
	if (state != MMC_ERASE) {
		addr = (void *)simple_strtoul(args[0], NULL, 16);
		++args;
	} else
		addr = 0;
	blk = simple_strtoul(args[0], NULL, 16);
	simple_strtoul(args[1], NULL, 16);

> +	"mmc erase addr blk# cnt\n"

i dont think the "erase" cmd takes an addr

> +err_out:
> +	printf("mmc erase failed\n\r");

dont use \r in strings, and use puts()
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110622/fc2895f6/attachment.pgp 


More information about the U-Boot mailing list