Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: core: Collect common code for card ocr validation

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>

authored by

Ulf Hansson and committed by
Chris Ball
726d6f23 ce69d37b

+10 -40
+10
drivers/mmc/core/core.c
··· 1357 1357 { 1358 1358 int bit; 1359 1359 1360 + /* 1361 + * Sanity check the voltages that the card claims to 1362 + * support. 1363 + */ 1364 + if (ocr & 0x7F) { 1365 + dev_warn(mmc_dev(host), 1366 + "card claims to support voltages below defined range\n"); 1367 + ocr &= ~0x7F; 1368 + } 1369 + 1360 1370 ocr &= host->ocr_avail; 1361 1371 if (!ocr) { 1362 1372 dev_warn(mmc_dev(host), "no support for card's volts\n");
-11
drivers/mmc/core/mmc.c
··· 1666 1666 goto err; 1667 1667 } 1668 1668 1669 - /* 1670 - * Sanity check the voltages that the card claims to 1671 - * support. 1672 - */ 1673 - if (ocr & 0x7F) { 1674 - pr_warning("%s: card claims to support voltages " 1675 - "below the defined range. These will be ignored.\n", 1676 - mmc_hostname(host)); 1677 - ocr &= ~0x7F; 1678 - } 1679 - 1680 1669 rocr = mmc_select_voltage(host, ocr); 1681 1670 1682 1671 /*
-19
drivers/mmc/core/sd.c
··· 1231 1231 goto err; 1232 1232 } 1233 1233 1234 - /* 1235 - * Sanity check the voltages that the card claims to 1236 - * support. 1237 - */ 1238 - if (ocr & 0x7F) { 1239 - pr_warning("%s: card claims to support voltages " 1240 - "below the defined range. These will be ignored.\n", 1241 - mmc_hostname(host)); 1242 - ocr &= ~0x7F; 1243 - } 1244 - 1245 - if ((ocr & MMC_VDD_165_195) && 1246 - !(host->ocr_avail_sd & MMC_VDD_165_195)) { 1247 - pr_warning("%s: SD card claims to support the " 1248 - "incompletely defined 'low voltage range'. This " 1249 - "will be ignored.\n", mmc_hostname(host)); 1250 - ocr &= ~MMC_VDD_165_195; 1251 - } 1252 - 1253 1234 rocr = mmc_select_voltage(host, ocr); 1254 1235 1255 1236 /*
-10
drivers/mmc/core/sdio.c
··· 1133 1133 if (host->ocr_avail_sdio) 1134 1134 host->ocr_avail = host->ocr_avail_sdio; 1135 1135 1136 - /* 1137 - * Sanity check the voltages that the card claims to 1138 - * support. 1139 - */ 1140 - if (ocr & 0x7F) { 1141 - pr_warning("%s: card claims to support voltages " 1142 - "below the defined range. These will be ignored.\n", 1143 - mmc_hostname(host)); 1144 - ocr &= ~0x7F; 1145 - } 1146 1136 1147 1137 rocr = mmc_select_voltage(host, ocr); 1148 1138