linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] mmc: have mmc_align_data_size use ALIGN() macro
@ 2008-07-07 21:26 Andres Salomon
  2008-07-08 19:22 ` Pierre Ossman
  0 siblings, 1 reply; 2+ messages in thread
From: Andres Salomon @ 2008-07-07 21:26 UTC (permalink / raw)
  To: drzeus-sdhci; +Cc: sdhci-devel, linux-kernel


No sense manually doing the alignment dance, there's a macro for that.
Once the optimal alignment stuff is added, this could
probably turn into something like this (in core.h):

static inline u32 mmc_align_data_size(struct mmc_card *card, u32 sz)
{
	return ALIGN(sz, card->align_sz);
}

Signed-off-by: Andres Salomon <dilinger@debian.org>
---
 drivers/mmc/core/core.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 3ee5b8c..e306061 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -315,9 +315,7 @@ 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;
-
-	return sz;
+	return ALIGN(sz, 4);
 }
 EXPORT_SYMBOL(mmc_align_data_size);
 
-- 
1.5.5.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] mmc: have mmc_align_data_size use ALIGN() macro
  2008-07-07 21:26 [PATCH 2/2] mmc: have mmc_align_data_size use ALIGN() macro Andres Salomon
@ 2008-07-08 19:22 ` Pierre Ossman
  0 siblings, 0 replies; 2+ messages in thread
From: Pierre Ossman @ 2008-07-08 19:22 UTC (permalink / raw)
  To: Andres Salomon; +Cc: drzeus-sdhci, sdhci-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 837 bytes --]

On Mon, 7 Jul 2008 17:26:46 -0400
Andres Salomon <dilinger@queued.net> wrote:

> 
> No sense manually doing the alignment dance, there's a macro for that.

There are so many macros in those headers, it's impossible to keep
track of them all. :/

> Once the optimal alignment stuff is added, this could
> probably turn into something like this (in core.h):
> 

I'm afraid you missed the main discussion, but the idea is to expand
that function and make it depend on the particular bugs of the
controller associated with the given card. I.e. it will not stay
suitable for inlining very long.

Rgds
-- 
     -- Pierre Ossman

  WARNING: This correspondence is being monitored by the
  Swedish government. Make sure your server uses encryption
  for SMTP traffic and consider using PGP for end-to-end
  encryption.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-08 19:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-07 21:26 [PATCH 2/2] mmc: have mmc_align_data_size use ALIGN() macro Andres Salomon
2008-07-08 19:22 ` Pierre Ossman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).