Question about read only flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux