Message ID | 1472463221-11948-1-git-send-email-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 29/08/16 12:33, Andy Shevchenko wrote: > 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> > --- > drivers/mmc/host/sdhci-pci-core.c | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c > index 93bb0ff..40f4fe8 100644 > --- a/drivers/mmc/host/sdhci-pci-core.c > +++ b/drivers/mmc/host/sdhci-pci-core.c > @@ -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; > } > > -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 29 August 2016 at 11:33, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > 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> Thanks, applied for next! Kind regards Uffe > --- > drivers/mmc/host/sdhci-pci-core.c | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c > index 93bb0ff..40f4fe8 100644 > --- a/drivers/mmc/host/sdhci-pci-core.c > +++ b/drivers/mmc/host/sdhci-pci-core.c > @@ -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; > } > > -- > 2.8.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c index 93bb0ff..40f4fe8 100644 --- a/drivers/mmc/host/sdhci-pci-core.c +++ b/drivers/mmc/host/sdhci-pci-core.c @@ -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; }
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> --- drivers/mmc/host/sdhci-pci-core.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)