mmc: Split mmc struct, rework mmc initialization (v2)
authorPantelis Antoniou <panto@antoniou-consulting.com>
Tue, 11 Mar 2014 17:34:20 +0000 (19:34 +0200)
committerPantelis Antoniou <panto@antoniou-consulting.com>
Mon, 24 Mar 2014 10:58:56 +0000 (12:58 +0200)
commit93bfd6167713a5cc1a78bcf60fa63f990fd3f4b3
tree9450ca369c296374e9a376f6950c521c2a89cab8
parent22cb7d334e296288e53057467dfee26858275516
mmc: Split mmc struct, rework mmc initialization (v2)

The way that struct mmc was implemented was a bit of a mess;
configuration and internal state all jumbled up in a single structure.

On top of that the way initialization is done with mmc_register leads
to a lot of duplicated code in drivers.

Typically the initialization got something like this in every driver.

struct mmc *mmc = malloc(sizeof(struct mmc));
memset(mmc, 0, sizeof(struct mmc);
/* fill in fields of mmc struct */
/* store private data pointer */
mmc_register(mmc);

By using the new mmc_create call one just passes an mmc config struct
and an optional private data pointer like this:

struct mmc = mmc_create(&cfg, priv);

All in tree drivers have been updated to the new form, and expect
mmc_register to go away before long.

Changes since v1:

* Use calloc instead of manually calling memset.
* Mark mmc_register as deprecated.

Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
26 files changed:
arch/arm/include/asm/arch-davinci/sdmmc_defs.h
arch/arm/include/asm/arch-tegra/tegra_mmc.h
common/cmd_mmc.c
common/cmd_mmc_spi.c
drivers/mmc/arm_pl180_mmci.c
drivers/mmc/arm_pl180_mmci.h
drivers/mmc/bfin_sdh.c
drivers/mmc/davinci_mmc.c
drivers/mmc/dw_mmc.c
drivers/mmc/fsl_esdhc.c
drivers/mmc/ftsdc010_mci.c
drivers/mmc/gen_atmel_mci.c
drivers/mmc/mmc.c
drivers/mmc/mmc_spi.c
drivers/mmc/mmc_write.c
drivers/mmc/mxcmmc.c
drivers/mmc/mxsmmc.c
drivers/mmc/omap_hsmmc.c
drivers/mmc/pxa_mmc_gen.c
drivers/mmc/sdhci.c
drivers/mmc/sh_mmcif.c
drivers/mmc/tegra_mmc.c
include/dwmmc.h
include/fsl_esdhc.h
include/mmc.h
include/sdhci.h