From: yi li <liyi.dev@gmail.com>
To: Pierre Ossman <drzeus-mmc@drzeus.cx>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [BUG] MMC/SD: SDHC card capacity not correct
Date: Tue, 13 Jan 2009 16:00:21 +0800 [thread overview]
Message-ID: <a0e7fce50901130000u36528132jc3a9ecbd9084b043@mail.gmail.com> (raw)
In-Reply-To: <20090112162044.2bc12cef@mjolnir.drzeus.cx>
On Mon, Jan 12, 2009 at 11:20 PM, Pierre Ossman <drzeus-mmc@drzeus.cx> wrote:
>
> Odd. Is the entire device accessible? (I.e. is it just a printk
> problem?)
>
It is a printk problem.
> Could you give me a dmesg dump with MMC_DEBUG turned on in Kconfig?
>
I did debug on my side (I think it is more easy to reproduce here :-)
). The issue is in mmc/card/block.c: mmc_block_probe().
"string_get_size(get_capacity(md->disk) << 9, STRING_UNITS_2,
cap_str, sizeof(cap_str));
"
get_capacity() returns a type "sector_t" value, since I am working on
a 32-bit processor (Analog Devices BF537),
and I did not enable CONFIG_LBD, "sector_t" is actually a 32-bit
"unsigned long". So "get_capacity(md->disk) << 9" loses the MSB.
I can think of two fixes:
1. Set CONFIG_LBD
2. Fix like this:
--- card/block.c 2009-01-13 15:56:05.000000000 +0800
+++ card/block.c.new 2009-01-13 15:53:45.000000000 +0800
@@ -514,7 +514,7 @@ static int mmc_blk_probe(struct mmc_card
if (err)
goto out;
- string_get_size(get_capacity(md->disk) << 9, STRING_UNITS_2,
+ string_get_size((u64)get_capacity(md->disk) << 9, STRING_UNITS_2,
cap_str, sizeof(cap_str));
printk(KERN_INFO "%s: %s %s %s %s\n",
md->disk->disk_name, mmc_card_id(card), mmc_card_name(card),
I prefer the second fix, what do you think?
Regards,
-Li Yi
next prev parent reply other threads:[~2009-01-13 8:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-09 3:53 yi li
[not found] ` <20090111204852.GA3869@compegg.wr.niftyegg.com>
2009-01-12 4:59 ` yi li
2009-01-12 15:20 ` Pierre Ossman
2009-01-13 8:00 ` yi li [this message]
2009-01-24 17:46 ` Pierre Ossman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a0e7fce50901130000u36528132jc3a9ecbd9084b043@mail.gmail.com \
--to=liyi.dev@gmail.com \
--cc=drzeus-mmc@drzeus.cx \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®