From patchwork Mon Aug 29 09:33:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 9303343 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 32A3F607F0 for ; Mon, 29 Aug 2016 09:33:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23D8328716 for ; Mon, 29 Aug 2016 09:33:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 188E72872E; Mon, 29 Aug 2016 09:33:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0166828716 for ; Mon, 29 Aug 2016 09:33:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756967AbcH2Jds (ORCPT ); Mon, 29 Aug 2016 05:33:48 -0400 Received: from mga01.intel.com ([192.55.52.88]:58114 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756950AbcH2Jdr (ORCPT ); Mon, 29 Aug 2016 05:33:47 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 29 Aug 2016 02:33:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,596,1464678000"; d="scan'208";a="1021679317" Received: from black.fi.intel.com ([10.237.72.56]) by orsmga001.jf.intel.com with ESMTP; 29 Aug 2016 02:33:44 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2699E3D2; Mon, 29 Aug 2016 12:33:42 +0300 (EEST) From: Andy Shevchenko To: Ulf Hansson , linux-mmc@vger.kernel.org, Adrian Hunter Cc: Andy Shevchenko Subject: [PATCH v1 1/3] sdhci-pci: refactor intel_mrfld_mmc_probe_slot() Date: Mon, 29 Aug 2016 12:33:39 +0300 Message-Id: <1472463221-11948-1-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.8.1 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Adrian Hunter --- 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; }