[U-Boot] [PATCH 3/7] dfu: DFU backend implementation

Marek Vasut marex at denx.de
Tue Jul 3 23:28:19 CEST 2012


Dear Lukasz Majewski,

> New, separate driver at ./drivers/dfu has been added. It allows platform
> and storage independent operation of DFU.
> 
> 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>
> ---

[...]

> +#include <common.h>
> +#include <malloc.h>
> +#include <mmc.h>
> +#include <fat.h>
> +#include <dfu.h>
> +#include <linux/list.h>
> +#include <linux/compiler.h>
> +
> +static LIST_HEAD(dfu_list);
> +static int dfu_alt_num;
> +
> +static int dfu_find_alt_num(char *s)
> +{
> +	int i = 0;
> +
> +	for (; *s; s++)
> +		if (*s == ';')
> +			i++;
> +
> +	return ++i;
> +}
> +
> +static char *dfu_extract_entity(char** env)
> +{
> +	char *s = *env;
> +
> +	strsep(env, ";");
> +	return s;
> +}

Shall we not make these all generic? They seem to be quite helpful components.

> +
> +char *dfu_extract_token(char** e, int *n)
> +{
> +	char *st = *e;
> +
> +	debug("%s: %s\n", __func__, st);
> +
> +	strsep(e, " ");
> +	*n = *e - st;
> +
> +	return st;
> +}
> +
> +static unsigned char __aligned(CONFIG_SYS_CACHELINE_SIZE)
> +				     dfu_buf[DFU_DATA_BUF_SIZE];

Can we not stack-allocate it with ALLOC_CACHE_ALIGN_BUFFER()?

[...]

> diff --git a/include/dfu.h b/include/dfu.h
> new file mode 100644
> index 0000000..f7d823b
> --- /dev/null
> +++ b/include/dfu.h

[...]

> +struct dfu_entity {
> +	char			name[DFU_NAME_SIZE];
> +	int                     alt;
> +	void                    *dev_private;
> +	int                     dev_num;
> +	enum dfu_device_type    dev_type;
> +	enum dfu_layout         layout;
> +
> +	union {
> +		struct mmc_internal_data mmc;

This union seems redundant ;-)

[...]


More information about the U-Boot mailing list