From: Pantelis Antoniou Date: Mon, 10 Mar 2014 18:05:51 +0000 (+0200) Subject: mmc: Convert mmc struct's name array to a pointer X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=22cb7d334e296288e53057467dfee26858275516;p=project%2Fbcm63xx%2Fu-boot.git mmc: Convert mmc struct's name array to a pointer Using an array is pointless; even more pointless (and scary) is using sprintf to fill it without a format string. Signed-off-by: Pantelis Antoniou --- diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c index 4490e9710b..5a30590673 100644 --- a/drivers/mmc/arm_pl180_mmci.c +++ b/drivers/mmc/arm_pl180_mmci.c @@ -365,7 +365,7 @@ int arm_pl180_mmci_init(struct pl180_mmc_host *host) /* Disable mmc interrupts */ sdi_u32 = readl(&host->base->mask0) & ~SDI_MASK0_MASK; writel(sdi_u32, &host->base->mask0); - strncpy(dev->name, host->name, sizeof(dev->name)); + dev->name = host->name; dev->ops = &arm_pl180_mmci_ops; dev->host_caps = host->caps; dev->voltages = host->voltages; diff --git a/drivers/mmc/bfin_sdh.c b/drivers/mmc/bfin_sdh.c index f0871ece38..5f6145b0c7 100644 --- a/drivers/mmc/bfin_sdh.c +++ b/drivers/mmc/bfin_sdh.c @@ -288,7 +288,7 @@ int bfin_mmc_init(bd_t *bis) if (!mmc) return -ENOMEM; - sprintf(mmc->name, "Blackfin SDH"); + mmc->name = "Blackfin SDH"; mmc->ops = &bfin_mmc_ops; mmc->host_caps = MMC_MODE_4BIT; diff --git a/drivers/mmc/davinci_mmc.c b/drivers/mmc/davinci_mmc.c index 29ca4a6ed1..cae972a20f 100644 --- a/drivers/mmc/davinci_mmc.c +++ b/drivers/mmc/davinci_mmc.c @@ -379,7 +379,7 @@ int davinci_mmc_init(bd_t *bis, struct davinci_mmc *host) mmc = malloc(sizeof(struct mmc)); memset(mmc, 0, sizeof(struct mmc)); - sprintf(mmc->name, "davinci"); + mmc->name = "davinci"; mmc->priv = host; mmc->ops = &dmmc_ops; mmc->f_min = 200000; diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 2e6576e8dd..011efb14a9 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -363,7 +363,7 @@ int add_dwmci(struct dwmci_host *host, u32 max_clk, u32 min_clk) mmc->priv = host; host->mmc = mmc; - sprintf(mmc->name, "%s", host->name); + mmc->name = host->name; mmc->ops = &dwmci_ops; mmc->f_min = min_clk; mmc->f_max = max_clk; diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 861f536ac9..f66513ed16 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -545,7 +545,7 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg) return -ENOMEM; memset(mmc, 0, sizeof(struct mmc)); - sprintf(mmc->name, "FSL_SDHC"); + mmc->name = "FSL_SDHC"; regs = (struct fsl_esdhc *)cfg->esdhc_base; /* First reset the eSDHC controller */ diff --git a/drivers/mmc/ftsdc010_mci.c b/drivers/mmc/ftsdc010_mci.c index ce43ae1b84..b1673fc917 100644 --- a/drivers/mmc/ftsdc010_mci.c +++ b/drivers/mmc/ftsdc010_mci.c @@ -352,7 +352,7 @@ int ftsdc010_mmc_init(int devid) chip->regs = regs; mmc->priv = chip; - sprintf(mmc->name, "ftsdc010"); + mmc->name = "ftsdc010"; mmc->ops = &ftsdc010_ops; mmc->host_caps = MMC_MODE_HS | MMC_MODE_HS_52MHz; switch (readl(®s->bwr) & FTSDC010_BWR_CAPS_MASK) { diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c index 456f8bfdd4..ce799f38ee 100644 --- a/drivers/mmc/gen_atmel_mci.c +++ b/drivers/mmc/gen_atmel_mci.c @@ -364,7 +364,7 @@ int atmel_mci_init(void *regs) if (!mmc) return -1; - strcpy(mmc->name, "mci"); + mmc->name = "mci"; mmc->priv = regs; mmc->ops = &atmel_mci_ops; diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c index 0a0f894bcb..e94de37c8b 100644 --- a/drivers/mmc/mmc_spi.c +++ b/drivers/mmc/mmc_spi.c @@ -274,7 +274,7 @@ struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode) free(mmc); return NULL; } - sprintf(mmc->name, "MMC_SPI"); + mmc->name = "MMC_SPI"; mmc->ops = &mmc_spi_ops; mmc->host_caps = MMC_MODE_SPI; diff --git a/drivers/mmc/mxcmmc.c b/drivers/mmc/mxcmmc.c index f3e1eed737..3357559981 100644 --- a/drivers/mmc/mxcmmc.c +++ b/drivers/mmc/mxcmmc.c @@ -500,7 +500,7 @@ static int mxcmci_initialize(bd_t *bis) if (!mmc) return -ENOMEM; - sprintf(mmc->name, "MXC MCI"); + mmc->name = "MXC MCI"; mmc->ops = &mxcmci_ops; mmc->host_caps = MMC_MODE_4BIT; diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c index 97c9ee8fb6..3512a99de9 100644 --- a/drivers/mmc/mxsmmc.c +++ b/drivers/mmc/mxsmmc.c @@ -405,7 +405,7 @@ int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int), int (*cd)(int)) priv->id = id; priv->regs = mxs_ssp_regs_by_bus(id); - sprintf(mmc->name, "MXS MMC"); + mmc->name = "MXS MMC"; mmc->ops = &mxsmmc_ops; mmc->priv = priv; diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index 6bf602fea5..fecac5698b 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -641,7 +641,7 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio, uint host_caps_val = MMC_MODE_4BIT | MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_HC; - sprintf(mmc->name, "OMAP SD/MMC"); + mmc->name = "OMAP SD/MMC"; mmc->ops = &omap_hsmmc_ops; mmc->priv = priv_data; diff --git a/drivers/mmc/pxa_mmc_gen.c b/drivers/mmc/pxa_mmc_gen.c index 4694c8f42d..188e1d4c6b 100644 --- a/drivers/mmc/pxa_mmc_gen.c +++ b/drivers/mmc/pxa_mmc_gen.c @@ -402,7 +402,7 @@ int pxa_mmc_register(int card_index) mmc->priv = priv; - sprintf(mmc->name, "PXA MMC"); + mmc->name = "PXA MMC"; mmc->ops = &pxa_mmc_ops; mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34; diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index c3425a6ce5..dc6f4e4972 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -451,7 +451,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk) mmc->priv = host; host->mmc = mmc; - sprintf(mmc->name, "%s", host->name); + mmc->name = host->name; mmc->ops = &sdhci_ops; caps = sdhci_readl(host, SDHCI_CAPABILITIES); diff --git a/drivers/mmc/sh_mmcif.c b/drivers/mmc/sh_mmcif.c index 6a4860bb35..008617d5e6 100644 --- a/drivers/mmc/sh_mmcif.c +++ b/drivers/mmc/sh_mmcif.c @@ -600,7 +600,7 @@ int mmcif_mmc_init(void) mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34; mmc->host_caps = MMC_MODE_HS | MMC_MODE_HS_52MHz | MMC_MODE_4BIT | MMC_MODE_8BIT | MMC_MODE_HC; - memcpy(mmc->name, DRIVER_NAME, sizeof(DRIVER_NAME)); + mmc->name = DRIVER_NAME; mmc->ops = &sh_mmcif_ops; host->regs = (struct sh_mmcif_regs *)CONFIG_SH_MMCIF_ADDR; host->clk = CONFIG_SH_MMCIF_CLK; diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c index 5f7b590b8f..e8fbb63f29 100644 --- a/drivers/mmc/tegra_mmc.c +++ b/drivers/mmc/tegra_mmc.c @@ -563,7 +563,7 @@ static int do_mmc_init(int dev_index) mmc = &mmc_dev[dev_index]; - sprintf(mmc->name, "Tegra SD/MMC"); + mmc->name = "Tegra SD/MMC"; mmc->priv = host; mmc->ops = &tegra_mmc_ops; diff --git a/include/mmc.h b/include/mmc.h index 3d53ce113c..6b08c62a51 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -264,7 +264,7 @@ struct mmc_ops { struct mmc { struct list_head link; - char name[32]; + const char *name; /* no need for this to be an array */ void *priv; uint voltages; uint version;