aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Vorontsov <anton.vorontsov@linaro.org>2012-09-24 17:27:52 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-26 16:42:26 -0400
commit729043e82cdd403a131127254528afea8031ebab (patch)
tree4e9b3d2ba4dacef4ef3512146cb7dafe10fcfb93
parentad394f66fa57ae66014cb74f337e2820bac4c417 (diff)
kdb: Turn KGDB_KDB=n stubs into static inlines
This makes the stubs actually usable, since e.g. 'foo = kdb_register();' leads to build errors in !KGDB_KDB case. Plus, with static inlines we do type checking. Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org> Acked-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--include/linux/kdb.h29
1 files changed, 16 insertions, 13 deletions
diff --git a/include/linux/kdb.h b/include/linux/kdb.h
index 42d9e863a313..7f6fe6e015bc 100644
--- a/include/linux/kdb.h
+++ b/include/linux/kdb.h
@@ -13,6 +13,14 @@
13 * Copyright (C) 2009 Jason Wessel <jason.wessel@windriver.com> 13 * Copyright (C) 2009 Jason Wessel <jason.wessel@windriver.com>
14 */ 14 */
15 15
16typedef enum {
17 KDB_REPEAT_NONE = 0, /* Do not repeat this command */
18 KDB_REPEAT_NO_ARGS, /* Repeat the command without arguments */
19 KDB_REPEAT_WITH_ARGS, /* Repeat the command including its arguments */
20} kdb_repeat_t;
21
22typedef int (*kdb_func_t)(int, const char **);
23
16#ifdef CONFIG_KGDB_KDB 24#ifdef CONFIG_KGDB_KDB
17#include <linux/init.h> 25#include <linux/init.h>
18#include <linux/sched.h> 26#include <linux/sched.h>
@@ -32,14 +40,6 @@ extern atomic_t kdb_event;
32 40
33#define KDB_MAXARGS 16 /* Maximum number of arguments to a function */ 41#define KDB_MAXARGS 16 /* Maximum number of arguments to a function */
34 42
35typedef enum {
36 KDB_REPEAT_NONE = 0, /* Do not repeat this command */
37 KDB_REPEAT_NO_ARGS, /* Repeat the command without arguments */
38 KDB_REPEAT_WITH_ARGS, /* Repeat the command including its arguments */
39} kdb_repeat_t;
40
41typedef int (*kdb_func_t)(int, const char **);
42
43/* KDB return codes from a command or internal kdb function */ 43/* KDB return codes from a command or internal kdb function */
44#define KDB_NOTFOUND (-1) 44#define KDB_NOTFOUND (-1)
45#define KDB_ARGCOUNT (-2) 45#define KDB_ARGCOUNT (-2)
@@ -149,11 +149,14 @@ extern int kdb_register_repeat(char *, kdb_func_t, char *, char *,
149 short, kdb_repeat_t); 149 short, kdb_repeat_t);
150extern int kdb_unregister(char *); 150extern int kdb_unregister(char *);
151#else /* ! CONFIG_KGDB_KDB */ 151#else /* ! CONFIG_KGDB_KDB */
152#define kdb_printf(...) 152static inline __printf(1, 2) int kdb_printf(const char *fmt, ...) { return 0; }
153#define kdb_init(x) 153static inline void kdb_init(int level) {}
154#define kdb_register(...) 154static inline int kdb_register(char *cmd, kdb_func_t func, char *usage,
155#define kdb_register_repeat(...) 155 char *help, short minlen) { return 0; }
156#define kdb_uregister(x) 156static inline int kdb_register_repeat(char *cmd, kdb_func_t func, char *usage,
157 char *help, short minlen,
158 kdb_repeat_t repeat) { return 0; }
159static inline int kdb_unregister(char *cmd) { return 0; }
157#endif /* CONFIG_KGDB_KDB */ 160#endif /* CONFIG_KGDB_KDB */
158enum { 161enum {
159 KDB_NOT_INITIALIZED, 162 KDB_NOT_INITIALIZED,