summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-12-29 10:27:28 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-12-29 10:27:28 -0800
commitbc781aa93e6dfa85aa251c8898f831031db55c49 (patch)
treea5e258c39e3013b24b1a6bb4d399159c11bfe020 /drivers
parent77f234f9d995c9b576b311a56f66db6837e598df (diff)
parentd2b18394259ef621fd2a6322aa9934198fd87a6a (diff)
downloadlinux-bc781aa93e6dfa85aa251c8898f831031db55c49.tar.gz
linux-bc781aa93e6dfa85aa251c8898f831031db55c49.tar.bz2
linux-bc781aa93e6dfa85aa251c8898f831031db55c49.zip
Merge master.kernel.org:/home/rmk/linux-2.6-mmc
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/mmc_block.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c
index d91fcf7c3178..abcf19116d70 100644
--- a/drivers/mmc/mmc_block.c
+++ b/drivers/mmc/mmc_block.c
@@ -359,7 +359,12 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
md->block_bits = card->csd.read_blkbits;
blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits);
- set_capacity(md->disk, card->csd.capacity);
+
+ /*
+ * The CSD capacity field is in units of read_blkbits.
+ * set_capacity takes units of 512 bytes.
+ */
+ set_capacity(md->disk, card->csd.capacity << (card->csd.read_blkbits - 9));
}
out:
return md;
@@ -373,7 +378,7 @@ mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
mmc_card_claim_host(card);
cmd.opcode = MMC_SET_BLOCKLEN;
- cmd.arg = 1 << card->csd.read_blkbits;
+ cmd.arg = 1 << md->block_bits;
cmd.flags = MMC_RSP_R1;
err = mmc_wait_for_cmd(card->host, &cmd, 5);
mmc_card_release_host(card);
@@ -412,10 +417,9 @@ static int mmc_blk_probe(struct mmc_card *card)
if (err)
goto out;
- printk(KERN_INFO "%s: %s %s %dKiB %s\n",
+ printk(KERN_INFO "%s: %s %s %luKiB %s\n",
md->disk->disk_name, mmc_card_id(card), mmc_card_name(card),
- (card->csd.capacity << card->csd.read_blkbits) / 1024,
- mmc_blk_readonly(card)?"(ro)":"");
+ get_capacity(md->disk) >> 1, mmc_blk_readonly(card)?"(ro)":"");
mmc_set_drvdata(card, md);
add_disk(md->disk);