public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH 7/9] Replace ace_readw/ace_writeb functions with macros
Date: Sat, 17 Feb 2007 12:34:52 -0700	[thread overview]
Message-ID: <11717409062112-git-send-email-grant.likely@secretlab.ca> (raw)
In-Reply-To: <1171740905585-git-send-email-grant.likely@secretlab.ca>

Register read/write does not need to be wrapped in a full function.  The
patch replaces them with macros.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
 drivers/systemace.c |   36 ++++++++++--------------------------
 1 files changed, 10 insertions(+), 26 deletions(-)

diff --git a/drivers/systemace.c b/drivers/systemace.c
index 8dd98d0..3f329f9 100644
--- a/drivers/systemace.c
+++ b/drivers/systemace.c
@@ -53,38 +53,22 @@ #ifdef CONFIG_SYSTEMACE
  * to be the base address for the chip, usually in the local
  * peripheral bus.
  */
-static unsigned ace_readw(unsigned offset)
-{
-#if (CFG_SYSTEMACE_WIDTH == 8)
-	u16 temp;
-
-#if !defined(__BIG_ENDIAN)
-	temp = ((u16) readb(CFG_SYSTEMACE_BASE + offset) << 8);
-	temp |= (u16) readb(CFG_SYSTEMACE_BASE + offset + 1);
-#else
-	temp = (u16) readb(CFG_SYSTEMACE_BASE + offset);
-	temp |= ((u16) readb(CFG_SYSTEMACE_BASE + offset + 1) << 8);
-#endif
-	return temp;
-#else
-	return readw(CFG_SYSTEMACE_BASE + offset);
-#endif
-}
-
-static void ace_writew(unsigned val, unsigned offset)
-{
 #if (CFG_SYSTEMACE_WIDTH == 8)
 #if !defined(__BIG_ENDIAN)
-	writeb((u8) (val >> 8), CFG_SYSTEMACE_BASE + offset);
-	writeb((u8) val, CFG_SYSTEMACE_BASE + offset + 1);
+#define ace_readw(off) ((readb(CFG_SYSTEMACE_BASE+off)<<8) | \
+                        (readb(CFG_SYSTEMACE_BASE+off+1)))
+#define ace_write(val, off) {writeb(val>>8, CFG_SYSTEMACE_BASE+off); \
+                             writeb(val, CFG_SYSTEMACE_BASE+off+1);}
 #else
-	writeb((u8) val, CFG_SYSTEMACE_BASE + offset);
-	writeb((u8) (val >> 8), CFG_SYSTEMACE_BASE + offset + 1);
+#define ace_readw(off) ((readb(CFG_SYSTEMACE_BASE+off)) | \
+                        (readb(CFG_SYSTEMACE_BASE+off+1)<<8))
+#define ace_write(val, off) {writeb(val, CFG_SYSTEMACE_BASE+off); \
+                             writeb(val>>8, CFG_SYSTEMACE_BASE+off+1);}
 #endif
 #else
-	writew(val, CFG_SYSTEMACE_BASE + offset);
+#define ace_readw(off) (readw(CFG_SYSTEMACE_BASE+off))
+#define ace_writew(val, off) (writew(val, CFG_SYSTEMACE_BASE+off))
 #endif
-}
 
 /* */
 
-- 
1.4.3.rc2.g0503

  reply	other threads:[~2007-02-17 19:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-17 19:34 [U-Boot-Users] Second set of miscellaneous patches Grant Likely
2007-02-17 19:34 ` [U-Boot-Users] [PATCH 3/9] Move buffer print code from md command to common function Grant Likely
2007-02-17 19:34   ` [U-Boot-Users] [PATCH 5/9] Whitespace fixup on common/cmd_ace.c (using Lindent) Grant Likely
2007-02-17 19:34     ` [U-Boot-Users] [PATCH 6/9] Move common/cmd_ace.c to drivers/systemace.c Grant Likely
2007-02-17 19:34       ` Grant Likely [this message]
2007-02-17 19:34         ` [U-Boot-Users] [PATCH 8/9] Add block_write hook to block_dev_desc_t Grant Likely
2007-02-17 19:34           ` [U-Boot-Users] [PATCH 9/9] Use "void *" not "unsigned long *" for block dev read/write buffer pointers Grant Likely
2007-02-26  6:34 ` [U-Boot-Users] Second set of miscellaneous patches Stefan Roese

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=11717409062112-git-send-email-grant.likely@secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --cc=u-boot@lists.denx.de \
    /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