public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MMC: Fix the block device read only flag
@ 2011-01-31 16:42 Marc-André Hébert
  2011-01-31 17:33 ` Chris Ball
  0 siblings, 1 reply; 2+ messages in thread
From: Marc-André Hébert @ 2011-01-31 16:42 UTC (permalink / raw)
  To: linux-mmc

While the MMC handled the card's read only flag correctly on open,
it did not setup the flag in the allocated disk structure. The
consequence being that probing the /sys/class/block/mmcblkX/ro
attribute always reported 0.

Signed-off-by: Marc-Andre Hebert <hebert.marcandre@gmail.com>
---
 drivers/mmc/card/block.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index bfc8a8a..61d233a 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -621,6 +621,7 @@ static struct mmc_blk_data *mmc_blk_alloc(struct
mmc_card *card)
 	md->disk->private_data = md;
 	md->disk->queue = md->queue.queue;
 	md->disk->driverfs_dev = &card->dev;
+	set_disk_ro(md->disk, md->read_only);

 	/*
 	 * As discussed on lkml, GENHD_FL_REMOVABLE should:
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MMC: Fix the block device read only flag
  2011-01-31 16:42 [PATCH] MMC: Fix the block device read only flag Marc-André Hébert
@ 2011-01-31 17:33 ` Chris Ball
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Ball @ 2011-01-31 17:33 UTC (permalink / raw)
  To: Marc-André Hébert; +Cc: linux-mmc

Hi,

On Mon, Jan 31, 2011 at 11:42:17AM -0500, Marc-André Hébert wrote:
> While the MMC handled the card's read only flag correctly on open,
> it did not setup the flag in the allocated disk structure. The
> consequence being that probing the /sys/class/block/mmcblkX/ro
> attribute always reported 0.
> 
> Signed-off-by: Marc-Andre Hebert <hebert.marcandre@gmail.com>
> ---
>  drivers/mmc/card/block.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index bfc8a8a..61d233a 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -621,6 +621,7 @@ static struct mmc_blk_data *mmc_blk_alloc(struct
> mmc_card *card)
>  	md->disk->private_data = md;
>  	md->disk->queue = md->queue.queue;
>  	md->disk->driverfs_dev = &card->dev;
> +	set_disk_ro(md->disk, md->read_only);
> 
>  	/*
>  	 * As discussed on lkml, GENHD_FL_REMOVABLE should:

Thanks very much, pushed to mmc-next and queued as a .38 fix.

(The patch was corrupt due to line-wrapping; something to fix for next
time.)
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-31 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-31 16:42 [PATCH] MMC: Fix the block device read only flag Marc-André Hébert
2011-01-31 17:33 ` Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox