public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: Shawn Lin <shawn.lin@rock-chips.com>,
	Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] mmc: dw_mmc: remove redundant num_slots check
Date: Fri, 22 Jan 2016 11:46:41 +0900	[thread overview]
Message-ID: <56A19811.9000101@samsung.com> (raw)
In-Reply-To: <1453362769-16223-1-git-send-email-shawn.lin@rock-chips.com>

Hi, Shawn.

On 01/21/2016 04:52 PM, Shawn Lin wrote:
> num_slots comes from pdata if existing, otherwise from
> dw_mci_parse_dt which make it at least one slot. If
> num_slots is less than 1 for the existing pdata case,
> current code return -ENODEV. But dw_mci_probe seems to
> treat this a optional case as it will call SDMMC_GET_SLOT_NUM
> if no slot assigned.

Well, we need to consider more thing..
Host can get the number of slot from SDMMC_GET_SLOT_NUM().
But i think this way also has the problem.

num_slot isn't defined anywhere, and num_slot should be set to value of SDMMC_GET_SLOT_NUM.
If that value is higher than 1, it should be blocking..(I didn't test all cases..)

Even though this patch is not correct, i could check the problem relevant to num_slot, because of this patch. :)

my suggestion is if pdata->num_slot is not defined anywhere, just set to 1 by default.
not take from SDMMC_GET_SLOT_NUM.

if (host->pdata->nums_slots < 1 || 
	host->pdata->nums_slots > SDMMC_GET_SLOT_NUM())

This is correct condition. num_slots can't be higher than number of supported slots.
how about?

Best Regards,
Jaehoon Chung

> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> 
> ---
> 
>  drivers/mmc/host/dw_mmc.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 7128351..a116ec6 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");
> 

  reply	other threads:[~2016-01-22  2:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-21  7:52 [RFC PATCH] mmc: dw_mmc: remove redundant num_slots check Shawn Lin
2016-01-22  2:46 ` Jaehoon Chung [this message]
2016-01-22  3:07   ` Shawn Lin
2016-01-22  5:04     ` Jaehoon Chung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56A19811.9000101@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=shawn.lin@rock-chips.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox