mmc: host: use the defined function to check whether card is removable
authorJaehoon Chung <jh80.chung@samsung.com>
Tue, 21 Jun 2016 01:13:26 +0000 (10:13 +0900)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 25 Jul 2016 08:34:21 +0000 (10:34 +0200)
In linux/mmc/host.h, mmc_card_is_removable() is already defined.
It should be maintainted more easier than now.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/dw_mmc.c
drivers/mmc/host/mxcmmc.c
drivers/mmc/host/sdhci-bcm-kona.c
drivers/mmc/host/sdhci-of-at91.c
drivers/mmc/host/sdhci-st.c
drivers/mmc/host/sdhci.c
drivers/mmc/host/tmio_mmc_pio.c

index 2cc6123b1df98a0c188d3a7626fa8f72424e4f22..801285801664feec380a171a937d1f65fbebc24a 100644 (file)
@@ -1451,8 +1451,7 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
        int gpio_cd = mmc_gpio_get_cd(mmc);
 
        /* Use platform get_cd function, else try onboard card detect */
-       if ((mmc->caps & MMC_CAP_NEEDS_POLL) ||
-           (mmc->caps & MMC_CAP_NONREMOVABLE))
+       if ((mmc->caps & MMC_CAP_NEEDS_POLL) || !mmc_card_is_removable(mmc))
                present = 1;
        else if (gpio_cd >= 0)
                present = gpio_cd;
index 3d1ea5e0e54952821f730cc26e89a3aeeecb0c78..fb3ca8296273d5895118a95a85db94c5ab643dbc 100644 (file)
@@ -1065,7 +1065,7 @@ static int mxcmci_probe(struct platform_device *pdev)
 
        if (pdata)
                dat3_card_detect = pdata->dat3_card_detect;
-       else if (!(mmc->caps & MMC_CAP_NONREMOVABLE)
+       else if (mmc_card_is_removable(mmc)
                        && !of_property_read_bool(pdev->dev.of_node, "cd-gpios"))
                dat3_card_detect = true;
 
index 00a8a40a372954fdcbbb1d4cd92b3ab1cc953765..1d6471284ae42657fe2002f7a96bfd7844ac627b 100644 (file)
@@ -264,12 +264,12 @@ static int sdhci_bcm_kona_probe(struct platform_device *pdev)
        }
 
        dev_dbg(dev, "non-removable=%c\n",
-               (host->mmc->caps & MMC_CAP_NONREMOVABLE) ? 'Y' : 'N');
+               mmc_card_is_removable(host->mmc) ? 'N' : 'Y');
        dev_dbg(dev, "cd_gpio %c, wp_gpio %c\n",
                (mmc_gpio_get_cd(host->mmc) != -ENOSYS) ? 'Y' : 'N',
                (mmc_gpio_get_ro(host->mmc) != -ENOSYS) ? 'Y' : 'N');
 
-       if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
+       if (!mmc_card_is_removable(host->mmc))
                host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 
        dev_dbg(dev, "is_8bit=%c\n",
@@ -288,7 +288,7 @@ static int sdhci_bcm_kona_probe(struct platform_device *pdev)
        }
 
        /* if device is eMMC, emulate card insert right here */
-       if (host->mmc->caps & MMC_CAP_NONREMOVABLE) {
+       if (!mmc_card_is_removable(host->mmc)) {
                ret = sdhci_bcm_kona_sd_card_emulate(host, 1);
                if (ret) {
                        dev_err(dev,
index d4cef713d246451c9187af6f314f2183db2a9353..a9b7fc06c434326a05c77dfc2e4f6cce32317d30 100644 (file)
@@ -288,7 +288,7 @@ static int sdhci_at91_probe(struct platform_device *pdev)
         * Disable SDHCI_QUIRK_BROKEN_CARD_DETECTION to be sure nobody tries
         * to enable polling via device tree with broken-cd property.
         */
-       if (!(host->mmc->caps & MMC_CAP_NONREMOVABLE) &&
+       if (mmc_card_is_removable(host->mmc) &&
            mmc_gpio_get_cd(host->mmc) < 0) {
                host->mmc->caps |= MMC_CAP_NEEDS_POLL;
                host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
index 320e1c2f8853effc37d98eeec7f50510ebe6823a..c95ba83366a0f2d95b1b45a70824327069f6b79d 100644 (file)
@@ -183,7 +183,7 @@ static void st_mmcss_cconfig(struct device_node *np, struct sdhci_host *host)
 
        writel_relaxed(cconf2, host->ioaddr + ST_MMC_CCONFIG_REG_2);
 
-       if (mhost->caps & MMC_CAP_NONREMOVABLE)
+       if (!mmc_card_is_removable(mhost))
                cconf3 |= ST_MMC_CCONFIG_EMMC_SLOT_TYPE;
        else
                /* CARD _D ET_CTRL */
index 702a245ce2e6596f683f01302e263beefcfc15c2..cdcaba27c16321b5613b8f10427af0a8c5b1b1e9 100644 (file)
@@ -117,7 +117,7 @@ static void sdhci_set_card_detection(struct sdhci_host *host, bool enable)
        u32 present;
 
        if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
-           (host->mmc->caps & MMC_CAP_NONREMOVABLE))
+           !mmc_card_is_removable(host->mmc))
                return;
 
        if (enable) {
@@ -1617,7 +1617,7 @@ static int sdhci_get_cd(struct mmc_host *mmc)
                return 0;
 
        /* If nonremovable, assume that the card is always present. */
-       if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
+       if (!mmc_card_is_removable(host->mmc))
                return 1;
 
        /*
@@ -3089,7 +3089,7 @@ int sdhci_add_host(struct sdhci_host *host)
                mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
 
        if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) &&
-           !(mmc->caps & MMC_CAP_NONREMOVABLE) &&
+           mmc_card_is_removable(mmc) &&
            mmc_gpio_get_cd(host->mmc) < 0)
                mmc->caps |= MMC_CAP_NEEDS_POLL;
 
index f44e2ab7aea2bab15ade6e1104e4bc80eeb3d633..92467efc4e2c9e59676b74a3aee2e280bb0c30e3 100644 (file)
@@ -1086,7 +1086,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
 
        _host->native_hotplug = !(pdata->flags & TMIO_MMC_USE_GPIO_CD ||
                                  mmc->caps & MMC_CAP_NEEDS_POLL ||
-                                 mmc->caps & MMC_CAP_NONREMOVABLE ||
+                                 !mmc_card_is_removable(mmc) ||
                                  mmc->slot.cd_irq >= 0);
 
        if (tmio_mmc_clk_enable(_host) < 0) {