sunxi: Use memcmp for mctl_mem_matches
authorHans de Goede <hdegoede@redhat.com>
Mon, 8 Dec 2014 13:17:08 +0000 (14:17 +0100)
committerHans de Goede <hdegoede@redhat.com>
Wed, 14 Jan 2015 13:56:37 +0000 (14:56 +0100)
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>
arch/arm/include/asm/arch-sunxi/dram.h

index 0bf718c3a4bbd6ee491727d72bafc8ce2dcfba4d..a8a37d57f8549b76a63fb47cebb31dad4f8009f5 100644 (file)
@@ -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 */