ia64: move ia64_done_with_exception out of asm/uaccess.h
authorPaul Gortmaker <paul.gortmaker@windriver.com>
Mon, 19 Sep 2016 22:28:25 +0000 (18:28 -0400)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Tue, 24 Jan 2017 17:41:45 +0000 (12:41 -0500)
Move ia64_done_with_exception out of asm/uaccess.h (which is widely
used) and into asm/exception.h (like ARM has) and then ensure the
few callers of it include this new header.

Most of the other C content in asm files is implemented in macro form.
So we do that conversion at the same time as the move.

There are two C exception prototypes that move along with the macro.
One of them will become redundant when we switch over to using the
<linux/extable.h> instead of <linux/module.h> header in a subsequent
commit.

Also relocate a couple of the automated asm --> linux uaccess
conversions to preserve the linux and asm independent grouping, since
we are in the file at that location anyway.

Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
arch/ia64/include/asm/exception.h [new file with mode: 0644]
arch/ia64/include/asm/uaccess.h
arch/ia64/kernel/kprobes.c
arch/ia64/kernel/traps.c
arch/ia64/kernel/unaligned.c
arch/ia64/mm/fault.c

diff --git a/arch/ia64/include/asm/exception.h b/arch/ia64/include/asm/exception.h
new file mode 100644 (file)
index 0000000..d902360
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __ASM_EXCEPTION_H
+#define __ASM_EXCEPTION_H
+
+struct pt_regs;
+struct exception_table_entry;
+
+extern void ia64_handle_exception(struct pt_regs *regs,
+                                 const struct exception_table_entry *e);
+extern const struct exception_table_entry *search_exception_tables(unsigned long addr);
+
+#define ia64_done_with_exception(regs)                                   \
+({                                                                       \
+       int __ex_ret = 0;                                                 \
+       const struct exception_table_entry *e;                            \
+       e = search_exception_tables((regs)->cr_iip + ia64_psr(regs)->ri); \
+       if (e) {                                                          \
+               ia64_handle_exception(regs, e);                           \
+               __ex_ret = 1;                                             \
+       }                                                                 \
+       __ex_ret;                                                         \
+})
+
+#endif /* __ASM_EXCEPTION_H */
index bfe1319..471044b 100644 (file)
@@ -353,21 +353,6 @@ struct exception_table_entry {
        int fixup;      /* location-relative continuation addr.; if bit 2 is set, r9 is set to 0 */
 };
 
-extern void ia64_handle_exception (struct pt_regs *regs, const struct exception_table_entry *e);
-extern const struct exception_table_entry *search_exception_tables (unsigned long addr);
-
-static inline int
-ia64_done_with_exception (struct pt_regs *regs)
-{
-       const struct exception_table_entry *e;
-       e = search_exception_tables(regs->cr_iip + ia64_psr(regs)->ri);
-       if (e) {
-               ia64_handle_exception(regs, e);
-               return 1;
-       }
-       return 0;
-}
-
 #define ARCH_HAS_TRANSLATE_MEM_PTR     1
 static __inline__ void *
 xlate_dev_mem_ptr(phys_addr_t p)
index 45ff27e..55b18e1 100644 (file)
@@ -33,7 +33,7 @@
 
 #include <asm/pgtable.h>
 #include <asm/sections.h>
-#include <linux/uaccess.h>
+#include <asm/exception.h>
 
 extern void jprobe_inst_return(void);
 
index 095bfaf..d3e1f1e 100644 (file)
 #include <linux/kprobes.h>
 #include <linux/delay.h>               /* for ssleep() */
 #include <linux/kdebug.h>
+#include <linux/uaccess.h>
 
 #include <asm/fpswa.h>
 #include <asm/intrinsics.h>
 #include <asm/processor.h>
-#include <linux/uaccess.h>
+#include <asm/exception.h>
 #include <asm/setup.h>
 
 fpswa_interface_t *fpswa_interface;
index 9cd01c2..e697403 100644 (file)
 #include <linux/sched.h>
 #include <linux/tty.h>
 #include <linux/ratelimit.h>
+#include <linux/uaccess.h>
 
 #include <asm/intrinsics.h>
 #include <asm/processor.h>
 #include <asm/rse.h>
-#include <linux/uaccess.h>
+#include <asm/exception.h>
 #include <asm/unaligned.h>
 
 extern int die_if_kernel(char *str, struct pt_regs *regs, long err);
index fa6ad95..52b41da 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <asm/pgtable.h>
 #include <asm/processor.h>
+#include <asm/exception.h>
 
 extern int die(char *, struct pt_regs *, long);