Received: by 10.223.185.116 with SMTP id b49csp5459696wrg; Wed, 7 Mar 2018 12:07:47 -0800 (PST) X-Google-Smtp-Source: AG47ELsaP1CCayT9yLzumlbKxmbYgd+IptAP9gOG82aqQ8I/zLcLCO08v96pPEXz6zGaOCFXi3bb X-Received: by 2002:a17:902:d909:: with SMTP id c9-v6mr21453972plz.34.1520453267453; Wed, 07 Mar 2018 12:07:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520453267; cv=none; d=google.com; s=arc-20160816; b=AvTJq+pNkuv4purVzegZu9aqslwuJJo188RE+Ud4K4Ue8tcRKT5AO4NTaCGPOSFt63 rq4OUH1CmX+ulYNcBCQc9fvLC7CLFo46JD9DBnEN/MuwtgJauVqbOprGemt6G5wBlJ18 V8fJhYniEwD3xuXtDp1/FQmgXQ/Fx6STNmpfcLDbcFv6PdA7pdTPQjmShFoBXOfc9Ytn OjWOhhBm2+ROMJfpWLPTDGA2KmUdA15yED1k/TUEhGUT0Yhu8krDcl0H+qxBD55bYFeK xKIeLXtKSMY6meQm76mlFFhIhBDDzCb8Rh11MK+rQ0K8hGROkHQwsM4e5oAegBJ58wrK iydQ== 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=r7p+/zzfaycg6TCAzBvXZAaoma81Me0wi4H22wA8rPM=; b=ir494kbjrAkObmoT9ecRSHTK520/7RTohbvECC58K97sOJ4XOR+qZRXRlCDu7DQI3L Bs0WHDD/E1mt0T8AlrrH8C2WJPeNQIElGkXjiF5Xbe/WopnIlXPlyRrNnrMf7WiDowQ3 SFsgQAjteyitU1ddmyV4jsuXXmZB3ta9GdprDJkEtQoBZZED3PUDaogUT0mQNeQmFD6z yR7hrl6MKtMUnuwg+zKM69pFBJO9T6/Lp+Hn2ai0SYwQ1dzTDELApSbSYmvbmhykGPiB NEGJluiqLdy+jzz2dtfRcnVweA5JpUlRflhBOp5if6Sr5D06QGYQYsGOKDQ2Ian+TQzU DP4Q== 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 n11si11711859pgu.96.2018.03.07.12.07.32; Wed, 07 Mar 2018 12:07:47 -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 S935131AbeCGUGZ (ORCPT + 99 others); Wed, 7 Mar 2018 15:06:25 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44488 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965141AbeCGTqK (ORCPT ); Wed, 7 Mar 2018 14:46:10 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F3F031036; Wed, 7 Mar 2018 19:46:09 +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.14 018/110] mmc: dw_mmc: Factor out dw_mci_init_slot_caps Date: Wed, 7 Mar 2018 11:38:01 -0800 Message-Id: <20180307191042.048322596@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191039.748351103@linuxfoundation.org> References: <20180307191039.748351103@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.14-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 @@ -2762,12 +2762,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); @@ -2801,38 +2839,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) {