public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* 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

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