[U-Boot] [PATCH v2 4/7] dfu: MMC specific routines for DFU operation

Tom Rini trini at ti.com
Tue Jul 10 10:45:42 CEST 2012


On Wed, Jul 04, 2012 at 05:48:39PM +0200, Lukasz Majewski wrote:
> Support for MMC storage devices to work with DFU framework.
> 
> Signed-off-by: Lukasz Majewski <l.majewski at samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
> Cc: Marek Vasut <marex at denx.de>
[snip]
> +	case RAW_ADDR:
> +		sprintf(cmd_buf, "mmc write 0x%x %x %x", (unsigned int) buf,
> +			dfu->data.mmc.lba_start, dfu->data.mmc.lba_size);
> +		break;
> +	case FAT:
> +		sprintf(cmd_buf, "fatwrite mmc %d:%d 0x%x %s %lx",
> +			dfu->data.mmc.dev, dfu->data.mmc.part,
> +			(unsigned int) buf, dfu->name, *len);
> +		break;
> +	default:
> +		printf("%s: Wrong layout!\n", __func__);
> +	}
> +
> +	debug("%s: %s 0x%p\n", __func__, cmd_buf, cmd_buf);
> +	run_command(cmd_buf, 0);

If we try and take the long-view here, that fatwrite/mmc write don't
perform a lot of sanity checking on input isn't good.  Lots of commands
I believe don't, but we can start somewhere.  So, lets do what Marek was
suggesting of making common/cmd_mmc.c and common/cmd_fat.c call a
sub-function that takes compile-time typecheckable inputs, and call that
here.  That opens things up for later making the user commands perform
better checking and so forth.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120710/641ed618/attachment.pgp>


More information about the U-Boot mailing list