From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752325AbcBBGCu (ORCPT ); Tue, 2 Feb 2016 01:02:50 -0500 Received: from lucky1.263xmail.com ([211.157.147.132]:49779 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750865AbcBBGCt (ORCPT ); Tue, 2 Feb 2016 01:02:49 -0500 X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: <541c7c078a5a82ac8ebac32e439f198b> X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Subject: Re: [PATCH] mmc: dw_mmc: fix num_slots setting To: Jaehoon Chung , Ulf Hansson References: <1453448584-9854-1-git-send-email-shawn.lin@rock-chips.com> <56B033BE.5040102@samsung.com> Cc: shawn.lin@rock-chips.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org From: Shawn Lin Message-ID: <56B04681.9050801@rock-chips.com> Date: Tue, 2 Feb 2016 14:02:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56B033BE.5040102@samsung.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jaehoon, On 2016/2/2 12:42, Jaehoon Chung wrote: > Hi, Shawn. > > On 01/22/2016 04:43 PM, Shawn Lin wrote: >> This patch make num_slots to 1 if pdata->num_slot is not >> defined. Meanwhile, we need to make sure num_slots should >> not larger that the supported slots >> >> Signed-off-by: Shawn Lin >> --- >> >> drivers/mmc/host/dw_mmc.c | 16 +++++++++------- >> 1 file changed, 9 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c >> index 7128351..065a8f5 100644 >> --- a/drivers/mmc/host/dw_mmc.c >> +++ b/drivers/mmc/host/dw_mmc.c >> @@ -2949,12 +2949,6 @@ int dw_mci_probe(struct dw_mci *host) >> } >> } >> >> - if (host->pdata->num_slots < 1) { >> - dev_err(host->dev, >> - "Platform data must supply num_slots.\n"); >> - return -ENODEV; >> - } >> - >> host->biu_clk = devm_clk_get(host->dev, "biu"); >> if (IS_ERR(host->biu_clk)) { >> dev_dbg(host->dev, "biu clock not available\n"); >> @@ -3111,7 +3105,15 @@ int dw_mci_probe(struct dw_mci *host) >> if (host->pdata->num_slots) >> host->num_slots = host->pdata->num_slots; >> else >> - host->num_slots = SDMMC_GET_SLOT_NUM(mci_readl(host, HCON)); >> + host->num_slots = 1; > > If host->nums_slots is set to 1, it assumes that there is one slot. > Then the code in dw_mci_parse_dt() can be removed > > dev_info(dev, > "num-slots property not found, assuming 1 slot is available\n"); > pdata->num_slots = 1; > Good catch. I will respin v2 to move it. Thanks. > > Best Regards, > Jaehoon Chung > > >> + >> + if (host->num_slots < 1 || >> + host->num_slots > SDMMC_GET_SLOT_NUM(mci_readl(host, HCON))) { >> + dev_err(host->dev, >> + "Platform data must supply correct num_slots.\n"); >> + ret = -ENODEV; >> + goto err_clk_ciu; >> + } >> >> /* >> * Enable interrupts for command done, data over, data empty, >> > > > > -- Best Regards Shawn Lin