All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@ti.com>
To: "Peter A. Bigot" <pab@pabigot.com>
Cc: meta-ti@yoctoproject.org,
	Pantelis Antoniou <panto@antoniou-consulting.com>
Subject: Re: [ti-uboot][PATCH] mmc: restore capacity when switching to partition 0
Date: Tue, 2 Sep 2014 12:44:51 -0400	[thread overview]
Message-ID: <20140902164451.GV19374@bill-the-cat> (raw)
In-Reply-To: <1409627490-28337-1-git-send-email-pab@pabigot.com>

On Mon, Sep 01, 2014 at 10:11:30PM -0500, Peter A. Bigot wrote:

> The capacity and lba for an MMC device with part_num 0 reflects the
> whole device.  When mmc_switch_part() successfully switches to a
> partition, the capacity is changed to that partition.  As partition 0
> does not physically exist, attempts to switch back to the whole device
> will indicate an error, but should still restore the capacity setting.

In other words:
# mmc dev 0:1
...
# mmc dev 0:0

Fails?  And the following patch fixes it.

> 
> Signed-off-by: Peter A. Bigot <pab@pabigot.com>
> ---
>  drivers/mmc/mmc.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index b5477b1..b05c6ee 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -596,10 +596,11 @@ int mmc_switch_part(int dev_num, unsigned int part_num)
>  	ret = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_PART_CONF,
>  			 (mmc->part_config & ~PART_ACCESS_MASK)
>  			 | (part_num & PART_ACCESS_MASK));
> -	if (ret)
> -		return ret;
>  
> -	return mmc_set_capacity(mmc, part_num);
> +	if ((0 == ret) || ((-ENODEV == ret) && (0 == part_num)))

This is backwards from how we usually code things:

if ((ret == 0) || ((ret == -ENODEV) && (part_num == 0)))

And should have a comment above it that's a short summary of the commit
message so this doesn't get lost later on.

> +		ret = mmc_set_capacity(mmc, part_num);
> +
> +	return ret;
>  }
>  
>  int mmc_getcd(struct mmc *mmc)
> -- 
> 1.8.5.5
> 
> -- 
> _______________________________________________
> meta-ti mailing list
> meta-ti@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/meta-ti

And speaking of getting lost, this isn't the U-Boot mailing list so the
change would get lost with the next release.  Please make sure to post
the next version to the u-boot ML as well and CC Pantelis.   Thanks!

-- 
Tom


  reply	other threads:[~2014-09-02 16:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-19  9:29 BBB + uboot 2014.07 - not booting Maciej Borzecki
2014-08-19 14:39 ` Diego Sueiro
2014-08-19 20:00   ` Diego Sueiro
2014-08-19 20:40     ` Cooper Jr., Franklin
2014-09-01 21:10 ` Peter A. Bigot
2014-09-01 21:53   ` Diego Sueiro
2014-09-01 23:28     ` Peter A. Bigot
2014-09-01 23:54       ` Robert Nelson
2014-09-02  7:56       ` Maciej Borzecki
2014-09-02 11:42         ` Peter A. Bigot
2014-09-03  7:43           ` Maciej Borzecki
2014-09-02  3:08 ` Peter A. Bigot
2014-09-02  3:11   ` [ti-uboot][PATCH] mmc: restore capacity when switching to partition 0 Peter A. Bigot
2014-09-02 16:44     ` Tom Rini [this message]
2014-09-02 17:00       ` Peter A. Bigot
2014-09-02 22:01         ` Tom Rini
2014-09-02 22:41           ` Peter A. Bigot

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=20140902164451.GV19374@bill-the-cat \
    --to=trini@ti.com \
    --cc=meta-ti@yoctoproject.org \
    --cc=pab@pabigot.com \
    --cc=panto@antoniou-consulting.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.