Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzi...
[wrt350n-kernel.git] / include / asm-avr32 / bug.h
blob331d45bab18f3b13e4eaf4faa4aaf6433883f924
1 /*
2 * Copyright (C) 2006 Atmel Corporation
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8 #ifndef __ASM_AVR32_BUG_H
9 #define __ASM_AVR32_BUG_H
11 #ifdef CONFIG_BUG
14 * According to our Chief Architect, this compact opcode is very
15 * unlikely to ever be implemented.
17 #define AVR32_BUG_OPCODE 0x5df0
19 #ifdef CONFIG_DEBUG_BUGVERBOSE
21 #define _BUG_OR_WARN(flags) \
22 asm volatile( \
23 "1: .hword %0\n" \
24 " .section __bug_table,\"a\",@progbits\n" \
25 "2: .long 1b\n" \
26 " .long %1\n" \
27 " .short %2\n" \
28 " .short %3\n" \
29 " .org 2b + %4\n" \
30 " .previous" \
31 : \
32 : "i"(AVR32_BUG_OPCODE), "i"(__FILE__), \
33 "i"(__LINE__), "i"(flags), \
34 "i"(sizeof(struct bug_entry)))
36 #else
38 #define _BUG_OR_WARN(flags) \
39 asm volatile( \
40 "1: .hword %0\n" \
41 " .section __bug_table,\"a\",@progbits\n" \
42 "2: .long 1b\n" \
43 " .short %1\n" \
44 " .org 2b + %2\n" \
45 " .previous" \
46 : \
47 : "i"(AVR32_BUG_OPCODE), "i"(flags), \
48 "i"(sizeof(struct bug_entry)))
50 #endif /* CONFIG_DEBUG_BUGVERBOSE */
52 #define BUG() \
53 do { \
54 _BUG_OR_WARN(0); \
55 for (;;); \
56 } while (0)
58 #define WARN_ON(condition) \
59 ({ \
60 int __ret_warn_on = !!(condition); \
61 if (unlikely(__ret_warn_on)) \
62 _BUG_OR_WARN(BUGFLAG_WARNING); \
63 unlikely(__ret_warn_on); \
66 #define HAVE_ARCH_BUG
67 #define HAVE_ARCH_WARN_ON
69 #endif /* CONFIG_BUG */
71 #include <asm-generic/bug.h>
73 #endif /* __ASM_AVR32_BUG_H */