]> Pileus Git - ~andy/linux/commitdiff
mmc: Fix the block device read only flag
authorMarc-André Hébert <hebert.marcandre@gmail.com>
Mon, 31 Jan 2011 17:31:24 +0000 (12:31 -0500)
committerChris Ball <cjb@laptop.org>
Tue, 15 Mar 2011 17:48:23 +0000 (13:48 -0400)
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>
Reviewed-by: Chris Ball <cjb@laptop.org>
Tested-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/card/block.c

index bfc8a8ae55df209458b52e0cb6bfcb1b6f79d989..61d233a7c1180e4b9fea129104ad60f631e60de2 100644 (file)
@@ -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: