mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bryan Wu <cooloney@kernel.org>
To: drzeus-mmc@drzeus.cx
Cc: linux-kernel@vger.kernel.org, Cliff Cai <cliff.cai@analog.com>,
	Bryan Wu <cooloney@kernel.org>
Subject: [PATCH] mmc: align data size for host which only supports power-of-2 block
Date: Fri,  6 Mar 2009 11:15:21 +0800	[thread overview]
Message-ID: <1236309321-23955-1-git-send-email-cooloney@kernel.org> (raw)

From: Cliff Cai <cliff.cai@analog.com>

Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 drivers/mmc/core/core.c  |    8 +++++++-
 include/linux/mmc/host.h |    1 +
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index df6ce4a..15119df 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -321,7 +321,13 @@ unsigned int mmc_align_data_size(struct mmc_card *card, unsigned int sz)
 	 * the core about its problems yet, so for now we just 32-bit
 	 * align the size.
 	 */
-	sz = ((sz + 3) / 4) * 4;
+
+	/* Align size for host which only supports power-of-2 block */
+	if (card->host->powerof2_block) {
+		if (sz & (sz - 1))
+			sz = 1 << fls(sz);
+	} else
+		sz = ((sz + 3) / 4) * 4;
 
 	return sz;
 }
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 4e45725..7416ed1 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -162,6 +162,7 @@ struct mmc_host {
 	struct dentry		*debugfs_root;
 
 	unsigned long		private[0] ____cacheline_aligned;
+	unsigned int		powerof2_block;	/* host only supports power-of-2 block */
 };
 
 extern struct mmc_host *mmc_alloc_host(int extra, struct device *);
-- 
1.5.6.3

             reply	other threads:[~2009-03-06  3:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-06  3:15 Bryan Wu [this message]
2009-03-14 20:30 ` Pierre Ossman
2009-03-25  3:22   ` Cai, Cliff
2009-03-25 19:23     ` Pierre Ossman
2009-03-26  2:22       ` Cai, Cliff
2009-04-05 19:09         ` Pierre Ossman
2009-04-07  8:34           ` Cai, Cliff
2009-04-10 21:01             ` 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=1236309321-23955-1-git-send-email-cooloney@kernel.org \
    --to=cooloney@kernel.org \
    --cc=cliff.cai@analog.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®