sdhci-pci: refactor intel_mrfld_mmc_probe_slot()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 29 Aug 2016 09:33:39 +0000 (12:33 +0300)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 26 Sep 2016 19:31:21 +0000 (21:31 +0200)
Refactor intel_mrfld_mmc_probe_slot() to use switch case. The change allows to
add a support for SD and SDIO interfaces without any pain.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-pci-core.c

index 93bb0ff82f24162b8971c27e9530daf807e70dd8..40f4fe833abac547a0678cf30bad61ff7f222f35 100644 (file)
@@ -422,14 +422,19 @@ static const struct sdhci_pci_fixes sdhci_intel_byt_sd = {
 
 static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
 {
-       if ((PCI_FUNC(slot->chip->pdev->devfn) != INTEL_MRFLD_EMMC_0) &&
-           (PCI_FUNC(slot->chip->pdev->devfn) != INTEL_MRFLD_EMMC_1))
+       unsigned int func = PCI_FUNC(slot->chip->pdev->devfn);
+
+       switch (func) {
+       case INTEL_MRFLD_EMMC_0:
+       case INTEL_MRFLD_EMMC_1:
+               slot->host->mmc->caps |= MMC_CAP_NONREMOVABLE |
+                                        MMC_CAP_8_BIT_DATA |
+                                        MMC_CAP_1_8V_DDR;
+               break;
+       default:
                /* SD support is not ready yet */
                return -ENODEV;
-
-       slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
-                                MMC_CAP_1_8V_DDR;
-
+       }
        return 0;
 }