diff options
-rw-r--r-- | drivers/mmc/mmc_block.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c index fa83f15fdf16..9b629856c735 100644 --- a/drivers/mmc/mmc_block.c +++ b/drivers/mmc/mmc_block.c | |||
@@ -85,6 +85,12 @@ static void mmc_blk_put(struct mmc_blk_data *md) | |||
85 | up(&open_lock); | 85 | up(&open_lock); |
86 | } | 86 | } |
87 | 87 | ||
88 | static inline int mmc_blk_readonly(struct mmc_card *card) | ||
89 | { | ||
90 | return mmc_card_readonly(card) || | ||
91 | !(card->csd.cmdclass & CCC_BLOCK_WRITE); | ||
92 | } | ||
93 | |||
88 | static int mmc_blk_open(struct inode *inode, struct file *filp) | 94 | static int mmc_blk_open(struct inode *inode, struct file *filp) |
89 | { | 95 | { |
90 | struct mmc_blk_data *md; | 96 | struct mmc_blk_data *md; |
@@ -97,7 +103,7 @@ static int mmc_blk_open(struct inode *inode, struct file *filp) | |||
97 | ret = 0; | 103 | ret = 0; |
98 | 104 | ||
99 | if ((filp->f_mode & FMODE_WRITE) && | 105 | if ((filp->f_mode & FMODE_WRITE) && |
100 | mmc_card_readonly(md->queue.card)) | 106 | mmc_blk_readonly(md->queue.card)) |
101 | ret = -EROFS; | 107 | ret = -EROFS; |
102 | } | 108 | } |
103 | 109 | ||
@@ -410,7 +416,7 @@ static int mmc_blk_probe(struct mmc_card *card) | |||
410 | printk(KERN_INFO "%s: %s %s %dKiB %s\n", | 416 | printk(KERN_INFO "%s: %s %s %dKiB %s\n", |
411 | md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), | 417 | md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), |
412 | (card->csd.capacity << card->csd.read_blkbits) / 1024, | 418 | (card->csd.capacity << card->csd.read_blkbits) / 1024, |
413 | mmc_card_readonly(card)?"(ro)":""); | 419 | mmc_blk_readonly(card)?"(ro)":""); |
414 | 420 | ||
415 | mmc_set_drvdata(card, md); | 421 | mmc_set_drvdata(card, md); |
416 | add_disk(md->disk); | 422 | add_disk(md->disk); |