]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
mmc: Convert mmc struct's name array to a pointer
authorPantelis Antoniou <panto@antoniou-consulting.com>
Mon, 10 Mar 2014 18:05:51 +0000 (20:05 +0200)
committerPantelis Antoniou <panto@antoniou-consulting.com>
Mon, 24 Mar 2014 09:32:10 +0000 (11:32 +0200)
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 <panto@antoniou-consulting.com>
16 files changed:
drivers/mmc/arm_pl180_mmci.c
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_spi.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/mmc.h

index 4490e9710b8d30be85169a4846d0acbd9a4bca42..5a30590673cde025ec635b31b20b837c22b019df 100644 (file)
@@ -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;
index f0871ece38616c039330800e6170353a004344db..5f6145b0c774e268564ec1adb3f41e8abc8a4907 100644 (file)
@@ -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;
 
index 29ca4a6ed11a70a80654eba6bf9662f72785e304..cae972a20f8e7954e2274973bc486339014f9168 100644 (file)
@@ -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;
index 2e6576e8dd3801760448cb38104e2840f4a39d7f..011efb14a98585d7b2d5992f482f98c094f41c33 100644 (file)
@@ -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;
index 861f536ac94ce6e79c886ce19b2d836612e57312..f66513ed1610d328b25c5d51bc284fe70d9f341b 100644 (file)
@@ -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 */
index ce43ae1b844a4466f6cdaeea4b2aff5f2408052c..b1673fc917aa374d8be198f47529dedd7d0c150b 100644 (file)
@@ -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(&regs->bwr) & FTSDC010_BWR_CAPS_MASK) {
index 456f8bfdd46aed10ea23770dd2884e444891b276..ce799f38eeeb9d227351fade3a46473190b116ea 100644 (file)
@@ -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;
 
index 0a0f894bcb99ab53814e75c4f3f3fedb0ebd5265..e94de37c8b44b99864b77a5afca34b9553353a99 100644 (file)
@@ -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;
 
index f3e1eed737eb3647641e32477ed99a55a55c1cd6..335755998180b8fb2f052b33fcb141174c056a02 100644 (file)
@@ -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;
 
index 97c9ee8fb6e4669bbc7494ecbaca7bd5dd08f4cc..3512a99de9f55392f51a6a78f4946c6950a65d70 100644 (file)
@@ -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;
 
index 6bf602fea59401559a1ee93a361b137a3807a483..fecac5698bf017c1fcf2370d2970680999c80f34 100644 (file)
@@ -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;
 
index 4694c8f42d265b23c5822e972cb3355cfa3ea47e..188e1d4c6b0163a84e8f50f5f278cc517318ce55 100644 (file)
@@ -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;
index c3425a6ce542903f764de380c06b386974234693..dc6f4e4972b9bb74f8d30085fe0f2b42334a83cf 100644 (file)
@@ -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);
index 6a4860bb354b941a43a9093eeb1d87ed07ba0d49..008617d5e6931ce17c60a72918dfbeb3184a8282 100644 (file)
@@ -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;
index 5f7b590b8fb59d915f383ef83524aacaaa24ee2a..e8fbb63f2988f7c470ee8bc1403e6b34bddebbdc 100644 (file)
@@ -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;
 
index 3d53ce113cff0d1dfb8fb92a02be68c920459236..6b08c62a51d2f684136ccf885ebec1870eda4aa7 100644 (file)
@@ -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;