public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3] mmc-uclass: correct the device number
Date: Thu, 21 Jul 2016 11:04:59 +0900	[thread overview]
Message-ID: <57902DCB.4080005@samsung.com> (raw)
In-Reply-To: <1468934937-6967-1-git-send-email-kever.yang@rock-chips.com>

Hi Kever,

On 07/19/2016 10:28 PM, Kever Yang wrote:
> Not like the mmc-legacy which the devnum starts from 1, it starts from 0
> in mmc-uclass, so the device number should be (devnum + 1) in get_mmc_num().

Looks good to me. I had already sent the similar patch for this.
(http://patchwork.ozlabs.org/patch/643921/)

But I think this patch is better than mine.

> 
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
(On Exynos4 SoCs with eMMC/SD interface.)

Best Regards,
Jaehoon Chung

> ---
> 
> Changes in v3:
> - apply comments from Jaehoon Chung
> 
> Changes in v2:
> - add comment for get_mmc_num() in mmc.h
> - update mmc_get_next_devnum()
> 
>  drivers/mmc/mmc-uclass.c | 4 ++--
>  include/mmc.h            | 6 ++++++
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index 38ced41..d0ca91b 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -111,7 +111,7 @@ struct mmc *find_mmc_device(int dev_num)
>  
>  int get_mmc_num(void)
>  {
> -	return max(blk_find_max_devnum(IF_TYPE_MMC), 0);
> +	return max((blk_find_max_devnum(IF_TYPE_MMC) + 1), 0);
>  }
>  
>  int mmc_get_next_devnum(void)
> @@ -122,7 +122,7 @@ int mmc_get_next_devnum(void)
>  	if (ret < 0)
>  		return ret;
>  
> -	return ret + 1;
> +	return ret;
>  }
>  
>  struct blk_desc *mmc_get_blk_desc(struct mmc *mmc)
> diff --git a/include/mmc.h b/include/mmc.h
> index 8f309f1..dd47f34 100644
> --- a/include/mmc.h
> +++ b/include/mmc.h
> @@ -503,6 +503,12 @@ void mmc_set_clock(struct mmc *mmc, uint clock);
>  struct mmc *find_mmc_device(int dev_num);
>  int mmc_set_dev(int dev_num);
>  void print_mmc_devices(char separator);
> +
> +/**
> + * get_mmc_num() - get the total MMC device number
> + *
> + * @return 0 if there is no MMC device, else the number of devices
> + */
>  int get_mmc_num(void);
>  int mmc_hwpart_config(struct mmc *mmc, const struct mmc_hwpart_conf *conf,
>  		      enum mmc_hwpart_conf_mode mode);
> 

  reply	other threads:[~2016-07-21  2:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20160719132909epcas1p11d39c6c29cb951947503ed580b1b61a0@epcas1p1.samsung.com>
2016-07-19 13:28 ` [U-Boot] [PATCH v3] mmc-uclass: correct the device number Kever Yang
2016-07-21  2:04   ` Jaehoon Chung [this message]
2016-07-22  3:21   ` Simon Glass
2016-07-22  4:14     ` Jaehoon Chung
2016-08-01  2:21       ` Simon Glass

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=57902DCB.4080005@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=u-boot@lists.denx.de \
    /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