diff mbox

[U-Boot,12/14] sunxi: Use memcmp for mctl_mem_matches

Message ID 1418761900-14035-12-git-send-email-hdegoede@redhat.com
State Superseded
Delegated to: Ian Campbell
Headers show

Commit Message

Hans de Goede Dec. 16, 2014, 8:31 p.m. UTC
Use memcmp for mctl_mem_matches instead of DIY.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 arch/arm/include/asm/arch-sunxi/dram.h | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Comments

Ian Campbell Dec. 18, 2014, 7:13 p.m. UTC | #1
On Tue, 2014-12-16 at 21:31 +0100, Hans de Goede wrote:
> Use memcmp for mctl_mem_matches instead of DIY.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

Ian.
diff mbox

Patch

diff --git a/arch/arm/include/asm/arch-sunxi/dram.h b/arch/arm/include/asm/arch-sunxi/dram.h
index 0bf718c..a8a37d5 100644
--- a/arch/arm/include/asm/arch-sunxi/dram.h
+++ b/arch/arm/include/asm/arch-sunxi/dram.h
@@ -55,15 +55,9 @@  static inline void mctl_mem_fill(void)
  */
 static inline bool mctl_mem_matches(u32 offset)
 {
-	int i, matches = 0;
-
-	for (i = 0; i < MCTL_MEM_FILL_MATCH_COUNT; i++) {
-		if (readl(CONFIG_SYS_SDRAM_BASE + i * 4) ==
-		    readl(CONFIG_SYS_SDRAM_BASE + offset + i * 4))
-			matches++;
-	}
-
-	return matches == MCTL_MEM_FILL_MATCH_COUNT;
+	return memcmp((u32 *)CONFIG_SYS_SDRAM_BASE,
+		      (u32 *)(CONFIG_SYS_SDRAM_BASE + offset),
+		      MCTL_MEM_FILL_MATCH_COUNT * 4) == 0;
 }
 
 #endif /* _SUNXI_DRAM_H */