]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/asm-generic/bug.h
[PATCH] drivers/char/pc8736x_gpio.c: remove unused static functions
[mirror_ubuntu-bionic-kernel.git] / include / asm-generic / bug.h
CommitLineData
1da177e4
LT
1#ifndef _ASM_GENERIC_BUG_H
2#define _ASM_GENERIC_BUG_H
3
4#include <linux/compiler.h>
1da177e4 5
c8538a7a 6#ifdef CONFIG_BUG
1da177e4
LT
7#ifndef HAVE_ARCH_BUG
8#define BUG() do { \
91368d73 9 printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
1da177e4
LT
10 panic("BUG!"); \
11} while (0)
12#endif
13
1da177e4
LT
14#ifndef HAVE_ARCH_BUG_ON
15#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
16#endif
17
18#ifndef HAVE_ARCH_WARN_ON
19#define WARN_ON(condition) do { \
20 if (unlikely((condition)!=0)) { \
91368d73 21 printk("BUG: warning at %s:%d/%s()\n", __FILE__, __LINE__, __FUNCTION__); \
1da177e4
LT
22 dump_stack(); \
23 } \
24} while (0)
25#endif
26
c8538a7a
MM
27#else /* !CONFIG_BUG */
28#ifndef HAVE_ARCH_BUG
29#define BUG()
30#endif
31
c8538a7a
MM
32#ifndef HAVE_ARCH_BUG_ON
33#define BUG_ON(condition) do { if (condition) ; } while(0)
34#endif
35
36#ifndef HAVE_ARCH_WARN_ON
37#define WARN_ON(condition) do { if (condition) ; } while(0)
38#endif
39#endif
40
74bb6a09
IM
41#define WARN_ON_ONCE(condition) \
42({ \
43 static int __warn_once = 1; \
44 int __ret = 0; \
45 \
46 if (unlikely((condition) && __warn_once)) { \
47 __warn_once = 0; \
48 WARN_ON(1); \
49 __ret = 1; \
50 } \
51 __ret; \
52})
53
8eb94f80
IM
54#ifdef CONFIG_SMP
55# define WARN_ON_SMP(x) WARN_ON(x)
56#else
57# define WARN_ON_SMP(x) do { } while (0)
58#endif
59
1da177e4 60#endif