ARM: SWP emulation: only initialise on ARMv7 CPUs
authorRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 4 Jul 2014 13:49:05 +0000 (14:49 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 18 Jul 2014 11:29:49 +0000 (12:29 +0100)
Previous CPUs do not have the ability to trap SWP instructions, so
it's pointless initialising this code there.

Tested-by: Tony Lindgren <tony@atomide.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/kernel/swp_emulate.c

index b1b89882b113fb26ecc93a30888ec63c4b3fc84b..67ca8578c6d8fd9adf35cfebbe0d75cdda8d4786 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/perf_event.h>
 
 #include <asm/opcodes.h>
+#include <asm/system_info.h>
 #include <asm/traps.h>
 #include <asm/uaccess.h>
 
@@ -266,6 +267,9 @@ static struct undef_hook swp_hook = {
  */
 static int __init swp_emulation_init(void)
 {
+       if (cpu_architecture() < CPU_ARCH_ARMv7)
+               return 0;
+
 #ifdef CONFIG_PROC_FS
        if (!proc_create("cpu/swp_emulation", S_IRUGO, NULL, &proc_status_fops))
                return -ENOMEM;