Received: by 10.223.185.116 with SMTP id b49csp5499832wrg; Wed, 7 Mar 2018 12:53:00 -0800 (PST) X-Google-Smtp-Source: AG47ELv4mdIlvJCGtPLv8sq/142fbzzk6WssYrnZu5Px99CKD68cPqSkvUWOauSfOCbBqvZXNPbM X-Received: by 2002:a17:902:5819:: with SMTP id m25-v6mr21353753pli.248.1520455980780; Wed, 07 Mar 2018 12:53:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520455980; cv=none; d=google.com; s=arc-20160816; b=b1VJAi5RFQqMuWSwTB2onyarMb0M42EDceH9CEmbo++w9d69WJG8j17T0hW1dBIAtZ LX7QP0wm0dC+BaHrmYvNvtGAvAaKx26zRqlFrN8Q9PWeoEj1GLfaYF4QaJTA9unfUVpI dWA475IIvKZzBq7TcASEpjhkyMJmeszODeW2kyPu+5qtANFn9TbIpcsYvwdlLm72C8VX eAl1iNtixhpZIY2nbUunpa+FTFBa+c7LSm1HZIZ/91skIaWiO0skhX1suehNaIv7SNj+ 6q4WLUcPRhUOAmE0AeexovNvdgdwowD1hHa02LM0R7lsojs6Tvf4RX32roDuvI5/Dz+M LJUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=2gThD77z4Jf3yRC4oTMNCnrmdvILpZl55rZCFqcgOAM=; b=Ez9wbuwdBXftsxRRw+qNo8mg4autJEyTrujWvXyTP+jz2qIEzlxMXGm/m3tTQrM7Ec 7ic54g23lFukSSRuWSIYqm5cO1BChzLJDLS6/vnUY6UiaPSJH0xyIoeqhWEH3sm71xdq LM+Mrhw5o6CkYzaQMQwvChOtRD3yGZWwA3ouK9DXY6vjeJcqAblukh8HaN7Au8aqj0dv 31zQJjkspcmbvBO+x9399OT9l5rWExP0yPSfFbtqXuKggqQRK2eDKe33CiN/bvMyFUR5 49gTPdTKhit62QO57PTN8X6Qnxs3UjGSbDdoQZJlgUVQNGLIvzioLZc/A0poupTAT5K2 4cYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c23-v6si13235870plo.702.2018.03.07.12.52.45; Wed, 07 Mar 2018 12:53:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754792AbeCGTkS (ORCPT + 99 others); Wed, 7 Mar 2018 14:40:18 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:40506 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754778AbeCGTkP (ORCPT ); Wed, 7 Mar 2018 14:40:15 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1871CF47; Wed, 7 Mar 2018 19:40:14 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shawn Lin , Ulf Hansson Subject: [PATCH 4.15 021/122] mmc: dw_mmc: Factor out dw_mci_init_slot_caps Date: Wed, 7 Mar 2018 11:37:13 -0800 Message-Id: <20180307191732.401979026@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191729.190879024@linuxfoundation.org> References: <20180307191729.190879024@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shawn Lin commit a4faa4929ed3be15e2d500d2405f992f6dedc8eb upstream. Factor out dw_mci_init_slot_caps to consolidate parsing all differents types of capabilities from host contrllers. No functional change intended. Signed-off-by: Shawn Lin Fixes: 800d78bfccb3 ("mmc: dw_mmc: add support for implementation specific callbacks") Cc: Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/dw_mmc.c | 73 +++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 30 deletions(-) --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2782,12 +2782,50 @@ static irqreturn_t dw_mci_interrupt(int return IRQ_HANDLED; } +static int dw_mci_init_slot_caps(struct dw_mci_slot *slot) +{ + struct dw_mci *host = slot->host; + const struct dw_mci_drv_data *drv_data = host->drv_data; + struct mmc_host *mmc = slot->mmc; + int ctrl_id; + + if (host->pdata->caps) + mmc->caps = host->pdata->caps; + + /* + * Support MMC_CAP_ERASE by default. + * It needs to use trim/discard/erase commands. + */ + mmc->caps |= MMC_CAP_ERASE; + + if (host->pdata->pm_caps) + mmc->pm_caps = host->pdata->pm_caps; + + if (host->dev->of_node) { + ctrl_id = of_alias_get_id(host->dev->of_node, "mshc"); + if (ctrl_id < 0) + ctrl_id = 0; + } else { + ctrl_id = to_platform_device(host->dev)->id; + } + if (drv_data && drv_data->caps) + mmc->caps |= drv_data->caps[ctrl_id]; + + if (host->pdata->caps2) + mmc->caps2 = host->pdata->caps2; + + /* Process SDIO IRQs through the sdio_irq_work. */ + if (mmc->caps & MMC_CAP_SDIO_IRQ) + mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; + + return 0; +} + static int dw_mci_init_slot(struct dw_mci *host) { struct mmc_host *mmc; struct dw_mci_slot *slot; - const struct dw_mci_drv_data *drv_data = host->drv_data; - int ctrl_id, ret; + int ret; u32 freq[2]; mmc = mmc_alloc_host(sizeof(struct dw_mci_slot), host->dev); @@ -2821,38 +2859,13 @@ static int dw_mci_init_slot(struct dw_mc if (!mmc->ocr_avail) mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; - if (host->pdata->caps) - mmc->caps = host->pdata->caps; - - /* - * Support MMC_CAP_ERASE by default. - * It needs to use trim/discard/erase commands. - */ - mmc->caps |= MMC_CAP_ERASE; - - if (host->pdata->pm_caps) - mmc->pm_caps = host->pdata->pm_caps; - - if (host->dev->of_node) { - ctrl_id = of_alias_get_id(host->dev->of_node, "mshc"); - if (ctrl_id < 0) - ctrl_id = 0; - } else { - ctrl_id = to_platform_device(host->dev)->id; - } - if (drv_data && drv_data->caps) - mmc->caps |= drv_data->caps[ctrl_id]; - - if (host->pdata->caps2) - mmc->caps2 = host->pdata->caps2; - ret = mmc_of_parse(mmc); if (ret) goto err_host_allocated; - /* Process SDIO IRQs through the sdio_irq_work. */ - if (mmc->caps & MMC_CAP_SDIO_IRQ) - mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; + ret = dw_mci_init_slot_caps(slot); + if (ret) + goto err_host_allocated; /* Useful defaults if platform data is unset. */ if (host->use_dma == TRANS_MODE_IDMAC) {