* Question about read only flag
@ 2011-01-31 14:01 Marc-André Hébert
2011-01-31 15:54 ` Chris Ball
0 siblings, 1 reply; 2+ messages in thread
From: Marc-André Hébert @ 2011-01-31 14:01 UTC (permalink / raw)
To: linux-mmc
Hello,
I have on an OMAPL138 board running 2.6.33-rc4 (I would liked to try a
more recent kernel but I do not have any boards which supports a more
recent version). I noticed that I was unable to detect from sysfs if
the inserted card was set to read only. The block device's
/sys/class/block/mmcblk0/ro entry always reported 0. The read only
gpio is correctly setup as opening the device for writing fails as
expected.
If I compare the behavior with a USB card reader (which of course
doesn't initialize the block device in the same way), the
/sys/class/block/xxx/ro entry is correct.
I am unsure if this is the desired behavior (if so I would really like
to understand why) but here's what I did to correct it.
Regards
Marc
--- a/drivers/mmc/card/block.c 2011-01-31 08:54:56.908952200 -0500
+++ b/drivers/mmc/card/block.c 2011-01-31 08:56:44.175950200 -0500
@@ -621,6 +621,7 @@
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:
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Question about read only flag
2011-01-31 14:01 Question about read only flag Marc-André Hébert
@ 2011-01-31 15:54 ` Chris Ball
0 siblings, 0 replies; 2+ messages in thread
From: Chris Ball @ 2011-01-31 15:54 UTC (permalink / raw)
To: Marc-André Hébert; +Cc: linux-mmc
Hi Marc-André,
On Mon, Jan 31, 2011 at 09:01:02AM -0500, Marc-André Hébert wrote:
> Hello,
>
> I have on an OMAPL138 board running 2.6.33-rc4 (I would liked to try a
> more recent kernel but I do not have any boards which supports a more
> recent version). I noticed that I was unable to detect from sysfs if
> the inserted card was set to read only. The block device's
> /sys/class/block/mmcblk0/ro entry always reported 0. The read only
> gpio is correctly setup as opening the device for writing fails as
> expected.
Interesting, thanks -- no, I don't imagine this is intentional, and I can
confirm the behavior on an x86 laptop/SDHCI running 2.6.38-rc2. Your
patch looks correct to me. I'm surprised no-one's noticed this before.
Could you re-send it as a Git patch with a Signed-off-by: line, please?
--
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 15:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-31 14:01 Question about read only flag Marc-André Hébert
2011-01-31 15:54 ` Chris Ball
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox