mmc: omap_hsmmc: remove unnecessary omap_hsmmc_slot_data indirection
[cascardo/linux.git] / arch / arm / mach-omap2 / hsmmc.c
index c65efc3..4e2896a 100644 (file)
@@ -39,8 +39,8 @@ static void omap_hsmmc1_before_set_reg(struct device *dev, int slot,
        u32 reg, prog_io;
        struct omap_hsmmc_platform_data *mmc = dev->platform_data;
 
-       if (mmc->slots[0].remux)
-               mmc->slots[0].remux(dev, slot, power_on);
+       if (mmc->remux)
+               mmc->remux(dev, slot, power_on);
 
        /*
         * Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the
@@ -62,7 +62,7 @@ static void omap_hsmmc1_before_set_reg(struct device *dev, int slot,
                        omap_ctrl_writel(reg, OMAP243X_CONTROL_DEVCONF1);
                }
 
-               if (mmc->slots[0].internal_clock) {
+               if (mmc->internal_clock) {
                        reg = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
                        reg |= OMAP2_MMCSDIO1ADPCLKISEL;
                        omap_ctrl_writel(reg, OMAP2_CONTROL_DEVCONF0);
@@ -115,7 +115,7 @@ static void hsmmc2_select_input_clk_src(struct omap_hsmmc_platform_data *mmc)
        u32 reg;
 
        reg = omap_ctrl_readl(control_devconf1_offset);
-       if (mmc->slots[0].internal_clock)
+       if (mmc->internal_clock)
                reg |= OMAP2_MMCSDIO2ADPCLKISEL;
        else
                reg &= ~OMAP2_MMCSDIO2ADPCLKISEL;
@@ -127,8 +127,8 @@ static void hsmmc2_before_set_reg(struct device *dev, int slot,
 {
        struct omap_hsmmc_platform_data *mmc = dev->platform_data;
 
-       if (mmc->slots[0].remux)
-               mmc->slots[0].remux(dev, slot, power_on);
+       if (mmc->remux)
+               mmc->remux(dev, slot, power_on);
 
        if (power_on)
                hsmmc2_select_input_clk_src(mmc);
@@ -154,14 +154,14 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
 static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data
                                  *mmc_controller, int controller_nr)
 {
-       if (gpio_is_valid(mmc_controller->slots[0].switch_pin) &&
-               (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
-               omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
-                                       OMAP_PIN_INPUT_PULLUP);
-       if (gpio_is_valid(mmc_controller->slots[0].gpio_wp) &&
-               (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
-               omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
-                                       OMAP_PIN_INPUT_PULLUP);
+       if (gpio_is_valid(mmc_controller->switch_pin) &&
+           (mmc_controller->switch_pin < OMAP_MAX_GPIO_LINES))
+               omap_mux_init_gpio(mmc_controller->switch_pin,
+                                  OMAP_PIN_INPUT_PULLUP);
+       if (gpio_is_valid(mmc_controller->gpio_wp) &&
+           (mmc_controller->gpio_wp < OMAP_MAX_GPIO_LINES))
+               omap_mux_init_gpio(mmc_controller->gpio_wp,
+                                  OMAP_PIN_INPUT_PULLUP);
        if (cpu_is_omap34xx()) {
                if (controller_nr == 0) {
                        omap_mux_init_signal("sdmmc1_clk",
@@ -170,7 +170,7 @@ static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data
                                OMAP_PIN_INPUT_PULLUP);
                        omap_mux_init_signal("sdmmc1_dat0",
                                OMAP_PIN_INPUT_PULLUP);
-                       if (mmc_controller->slots[0].caps &
+                       if (mmc_controller->caps &
                                (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
                                omap_mux_init_signal("sdmmc1_dat1",
                                        OMAP_PIN_INPUT_PULLUP);
@@ -179,7 +179,7 @@ static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data
                                omap_mux_init_signal("sdmmc1_dat3",
                                        OMAP_PIN_INPUT_PULLUP);
                        }
-                       if (mmc_controller->slots[0].caps &
+                       if (mmc_controller->caps &
                                                MMC_CAP_8_BIT_DATA) {
                                omap_mux_init_signal("sdmmc1_dat4",
                                        OMAP_PIN_INPUT_PULLUP);
@@ -204,7 +204,7 @@ static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data
                         * For 8 wire configurations, Lines DAT4, 5, 6 and 7
                         * need to be muxed in the board-*.c files
                         */
-                       if (mmc_controller->slots[0].caps &
+                       if (mmc_controller->caps &
                                (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
                                omap_mux_init_signal("sdmmc2_dat1",
                                        OMAP_PIN_INPUT_PULLUP);
@@ -213,7 +213,7 @@ static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data
                                omap_mux_init_signal("sdmmc2_dat3",
                                        OMAP_PIN_INPUT_PULLUP);
                        }
-                       if (mmc_controller->slots[0].caps &
+                       if (mmc_controller->caps &
                                                        MMC_CAP_8_BIT_DATA) {
                                omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
                                        OMAP_PIN_INPUT_PULLUP);
@@ -249,23 +249,23 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
        else
                snprintf(hc_name, (HSMMC_NAME_LEN + 1), "mmc%islot%i",
                                                                c->mmc, 1);
-       mmc->slots[0].name = hc_name;
+       mmc->name = hc_name;
        mmc->nr_slots = 1;
-       mmc->slots[0].caps = c->caps;
-       mmc->slots[0].internal_clock = !c->ext_clock;
+       mmc->caps = c->caps;
+       mmc->internal_clock = !c->ext_clock;
        mmc->reg_offset = 0;
 
-       mmc->slots[0].switch_pin = c->gpio_cd;
-       mmc->slots[0].gpio_wp = c->gpio_wp;
+       mmc->switch_pin = c->gpio_cd;
+       mmc->gpio_wp = c->gpio_wp;
 
-       mmc->slots[0].remux = c->remux;
-       mmc->slots[0].init_card = c->init_card;
+       mmc->remux = c->remux;
+       mmc->init_card = c->init_card;
 
        if (c->cover_only)
-               mmc->slots[0].cover = 1;
+               mmc->cover = 1;
 
        if (c->nonremovable)
-               mmc->slots[0].nonremovable = 1;
+               mmc->nonremovable = 1;
 
        /*
         * NOTE:  MMC slots should have a Vcc regulator set up.
@@ -275,42 +275,42 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
         * temporary HACK: ocr_mask instead of fixed supply
         */
        if (soc_is_am35xx())
-               mmc->slots[0].ocr_mask = MMC_VDD_165_195 |
+               mmc->ocr_mask = MMC_VDD_165_195 |
                                         MMC_VDD_26_27 |
                                         MMC_VDD_27_28 |
                                         MMC_VDD_29_30 |
                                         MMC_VDD_30_31 |
                                         MMC_VDD_31_32;
        else
-               mmc->slots[0].ocr_mask = c->ocr_mask;
+               mmc->ocr_mask = c->ocr_mask;
 
        if (!soc_is_am35xx())
-               mmc->slots[0].features |= HSMMC_HAS_PBIAS;
+               mmc->features |= HSMMC_HAS_PBIAS;
 
        switch (c->mmc) {
        case 1:
-               if (mmc->slots[0].features & HSMMC_HAS_PBIAS) {
+               if (mmc->features & HSMMC_HAS_PBIAS) {
                        /* on-chip level shifting via PBIAS0/PBIAS1 */
-                       mmc->slots[0].before_set_reg =
+                       mmc->before_set_reg =
                                        omap_hsmmc1_before_set_reg;
-                       mmc->slots[0].after_set_reg =
+                       mmc->after_set_reg =
                                        omap_hsmmc1_after_set_reg;
                }
 
                if (soc_is_am35xx())
-                       mmc->slots[0].set_power = nop_mmc_set_power;
+                       mmc->set_power = nop_mmc_set_power;
 
                /* OMAP3630 HSMMC1 supports only 4-bit */
                if (cpu_is_omap3630() &&
                                (c->caps & MMC_CAP_8_BIT_DATA)) {
                        c->caps &= ~MMC_CAP_8_BIT_DATA;
                        c->caps |= MMC_CAP_4_BIT_DATA;
-                       mmc->slots[0].caps = c->caps;
+                       mmc->caps = c->caps;
                }
                break;
        case 2:
                if (soc_is_am35xx())
-                       mmc->slots[0].set_power = am35x_hsmmc2_set_power;
+                       mmc->set_power = am35x_hsmmc2_set_power;
 
                if (c->ext_clock)
                        c->transceiver = 1;
@@ -318,17 +318,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
                        c->caps &= ~MMC_CAP_8_BIT_DATA;
                        c->caps |= MMC_CAP_4_BIT_DATA;
                }
-               if (mmc->slots[0].features & HSMMC_HAS_PBIAS) {
+               if (mmc->features & HSMMC_HAS_PBIAS) {
                        /* off-chip level shifting, or none */
-                       mmc->slots[0].before_set_reg = hsmmc2_before_set_reg;
-                       mmc->slots[0].after_set_reg = NULL;
+                       mmc->before_set_reg = hsmmc2_before_set_reg;
+                       mmc->after_set_reg = NULL;
                }
                break;
        case 3:
        case 4:
        case 5:
-               mmc->slots[0].before_set_reg = NULL;
-               mmc->slots[0].after_set_reg = NULL;
+               mmc->before_set_reg = NULL;
+               mmc->after_set_reg = NULL;
                break;
        default:
                pr_err("MMC%d configuration not supported!\n", c->mmc);
@@ -363,8 +363,8 @@ void omap_hsmmc_late_init(struct omap2_hsmmc_info *c)
                if (!mmc_pdata)
                        continue;
 
-               mmc_pdata->slots[0].switch_pin = c->gpio_cd;
-               mmc_pdata->slots[0].gpio_wp = c->gpio_wp;
+               mmc_pdata->switch_pin = c->gpio_cd;
+               mmc_pdata->gpio_wp = c->gpio_wp;
 
                res = omap_device_register(pdev);
                if (res)
@@ -464,7 +464,7 @@ put_pdev:
        platform_device_put(pdev);
 
 free_name:
-       kfree(mmc_data->slots[0].name);
+       kfree(mmc_data->name);
 
 free_mmc:
        kfree(mmc_data);