mmc: core: Collect common code for card ocr validation
authorUlf Hansson <ulf.hansson@linaro.org>
Mon, 16 Sep 2013 10:06:15 +0000 (12:06 +0200)
committerChris Ball <cjb@laptop.org>
Thu, 31 Oct 2013 00:26:31 +0000 (20:26 -0400)
Since mmc_select_voltage now only gets called from the attach sequence,
it makes sense to move the out of spec validations of the card ocr into
this function.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/core/core.c
drivers/mmc/core/mmc.c
drivers/mmc/core/sd.c
drivers/mmc/core/sdio.c

index 63672aba0e98ec2e4d3174866678fb3713f4c37b..bcb507771eebe529c1ed331038813a00ef5c674a 100644 (file)
@@ -1357,6 +1357,16 @@ u32 mmc_select_voltage(struct mmc_host *host, u32 ocr)
 {
        int bit;
 
+       /*
+        * Sanity check the voltages that the card claims to
+        * support.
+        */
+       if (ocr & 0x7F) {
+               dev_warn(mmc_dev(host),
+               "card claims to support voltages below defined range\n");
+               ocr &= ~0x7F;
+       }
+
        ocr &= host->ocr_avail;
        if (!ocr) {
                dev_warn(mmc_dev(host), "no support for card's volts\n");
index 18ce81a85c9b8422a150a2bfd9c34c29c0acb9d4..0d060227cfc1bab543f32fdc78f5d6809f4b5315 100644 (file)
@@ -1666,17 +1666,6 @@ int mmc_attach_mmc(struct mmc_host *host)
                        goto err;
        }
 
-       /*
-        * Sanity check the voltages that the card claims to
-        * support.
-        */
-       if (ocr & 0x7F) {
-               pr_warning("%s: card claims to support voltages "
-                      "below the defined range. These will be ignored.\n",
-                      mmc_hostname(host));
-               ocr &= ~0x7F;
-       }
-
        rocr = mmc_select_voltage(host, ocr);
 
        /*
index 53db60a76dae0e03e5465c77255fec8ab23b7d9f..6ef84d0ca178a026fbbaf79fb46fc9bce6a228bd 100644 (file)
@@ -1231,25 +1231,6 @@ int mmc_attach_sd(struct mmc_host *host)
                        goto err;
        }
 
-       /*
-        * Sanity check the voltages that the card claims to
-        * support.
-        */
-       if (ocr & 0x7F) {
-               pr_warning("%s: card claims to support voltages "
-                      "below the defined range. These will be ignored.\n",
-                      mmc_hostname(host));
-               ocr &= ~0x7F;
-       }
-
-       if ((ocr & MMC_VDD_165_195) &&
-           !(host->ocr_avail_sd & MMC_VDD_165_195)) {
-               pr_warning("%s: SD card claims to support the "
-                      "incompletely defined 'low voltage range'. This "
-                      "will be ignored.\n", mmc_hostname(host));
-               ocr &= ~MMC_VDD_165_195;
-       }
-
        rocr = mmc_select_voltage(host, ocr);
 
        /*
index b7c19e894dd30cb158c81320a60a872fa82ec1f9..4d721c6e2af01026ea967dbd54bdaf17c8648aee 100644 (file)
@@ -1133,16 +1133,6 @@ int mmc_attach_sdio(struct mmc_host *host)
        if (host->ocr_avail_sdio)
                host->ocr_avail = host->ocr_avail_sdio;
 
-       /*
-        * Sanity check the voltages that the card claims to
-        * support.
-        */
-       if (ocr & 0x7F) {
-               pr_warning("%s: card claims to support voltages "
-                      "below the defined range. These will be ignored.\n",
-                      mmc_hostname(host));
-               ocr &= ~0x7F;
-       }
 
        rocr = mmc_select_voltage(host, ocr);
 
This page took 0.028156 seconds and 5 git commands to generate.