Skip to contentSkip to conversation

mmc: have mmc_align_data_size use ALIGN() macro

PATCH In review Andres Salomon 2 participants 2 messages Jul 7, 2008 – Jul 8, 2008 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 mmc: have mmc_align_data_size use ALIGN() macro

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);
}
---
 drivers/mmc/core/core.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/mmc/core/core.c +1 -3
index 3ee5b8c..e306061 100644
@@ -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);
 
Signature · 1 line
1.5.5.3
#1 lore raw
Quoted 2 lines · On Mon, 7 Jul 2008 17:26:46 -0400 Andres Salomon <[email protected]> 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. :/

Quoted 3 lines

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

Signature · 6 lines
     -- 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.