linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Vorontsov <anton.vorontsov@linaro.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	Russell King <linux@arm.linux.org.uk>,
	Jason Wessel <jason.wessel@windriver.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Cox <alan@linux.intel.com>
Cc: "Arve Hjønnevåg" <arve@android.com>,
	"Colin Cross" <ccross@android.com>,
	"Brian Swetland" <swetland@google.com>,
	"John Stultz" <john.stultz@linaro.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linaro-kernel@lists.linaro.org, patches@linaro.org,
	kernel-team@android.com, kgdb-bugreport@lists.sourceforge.net,
	linux-serial@vger.kernel.org
Subject: [PATCH 03/11] kdb: Turn KGDB_KDB=n stubs into static inlines
Date: Thu, 13 Sep 2012 08:03:27 -0700	[thread overview]
Message-ID: <1347548615-18227-3-git-send-email-anton.vorontsov@linaro.org> (raw)
In-Reply-To: <20120913150133.GA16238@lizard>

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>
---
 include/linux/kdb.h | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/include/linux/kdb.h b/include/linux/kdb.h
index 42d9e86..7f6fe6e 100644
--- a/include/linux/kdb.h
+++ b/include/linux/kdb.h
@@ -13,6 +13,14 @@
  * Copyright (C) 2009 Jason Wessel <jason.wessel@windriver.com>
  */
 
+typedef enum {
+	KDB_REPEAT_NONE = 0,	/* Do not repeat this command */
+	KDB_REPEAT_NO_ARGS,	/* Repeat the command without arguments */
+	KDB_REPEAT_WITH_ARGS,	/* Repeat the command including its arguments */
+} kdb_repeat_t;
+
+typedef int (*kdb_func_t)(int, const char **);
+
 #ifdef	CONFIG_KGDB_KDB
 #include <linux/init.h>
 #include <linux/sched.h>
@@ -32,14 +40,6 @@ extern atomic_t kdb_event;
 
 #define KDB_MAXARGS    16 /* Maximum number of arguments to a function  */
 
-typedef enum {
-	KDB_REPEAT_NONE = 0,	/* Do not repeat this command */
-	KDB_REPEAT_NO_ARGS,	/* Repeat the command without arguments */
-	KDB_REPEAT_WITH_ARGS,	/* Repeat the command including its arguments */
-} kdb_repeat_t;
-
-typedef int (*kdb_func_t)(int, const char **);
-
 /* KDB return codes from a command or internal kdb function */
 #define KDB_NOTFOUND	(-1)
 #define KDB_ARGCOUNT	(-2)
@@ -149,11 +149,14 @@ extern int kdb_register_repeat(char *, kdb_func_t, char *, char *,
 			       short, kdb_repeat_t);
 extern int kdb_unregister(char *);
 #else /* ! CONFIG_KGDB_KDB */
-#define kdb_printf(...)
-#define kdb_init(x)
-#define kdb_register(...)
-#define kdb_register_repeat(...)
-#define kdb_uregister(x)
+static inline __printf(1, 2) int kdb_printf(const char *fmt, ...) { return 0; }
+static inline void kdb_init(int level) {}
+static inline int kdb_register(char *cmd, kdb_func_t func, char *usage,
+			       char *help, short minlen) { return 0; }
+static inline int kdb_register_repeat(char *cmd, kdb_func_t func, char *usage,
+				      char *help, short minlen,
+				      kdb_repeat_t repeat) { return 0; }
+static inline int kdb_unregister(char *cmd) { return 0; }
 #endif	/* CONFIG_KGDB_KDB */
 enum {
 	KDB_NOT_INITIALIZED,
-- 
1.7.11.5


  parent reply	other threads:[~2012-09-13 15:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-13 15:01 [PATCH v7 0/11] KGDB/KDB FIQ (NMI) debugger Anton Vorontsov
2012-09-13 15:03 ` [PATCH 01/11] kernel/debug: Mask KGDB NMI upon entry Anton Vorontsov
2012-09-19 11:52   ` Jason Wessel
2012-09-13 15:03 ` [PATCH 02/11] kdb: Implement disable_nmi command Anton Vorontsov
2012-09-19 11:52   ` Jason Wessel
2012-09-13 15:03 ` Anton Vorontsov [this message]
2012-09-13 15:03 ` [PATCH 04/11] tty/serial/core: Introduce poll_init callback Anton Vorontsov
2012-09-13 15:03 ` [PATCH 05/11] tty/serial/amba-pl011: Implement " Anton Vorontsov
2012-09-13 15:03 ` [PATCH 06/11] tty/serial/amba-pl011: Quiesce interrupts in poll_get_char Anton Vorontsov
2012-09-13 15:03 ` [PATCH 07/11] tty/serial: Add kgdb_nmi driver Anton Vorontsov
2012-09-15 15:52   ` Francesco Lavra
2012-09-17  1:07     ` [PATCH updated " Anton Vorontsov
2012-09-19 11:52   ` [PATCH " Jason Wessel
2012-09-19 16:54     ` Anton Vorontsov
2012-09-13 15:03 ` [PATCH 08/11] ARM: Move some macros from entry-armv to entry-header Anton Vorontsov
2012-09-13 15:03 ` [PATCH 09/11] ARM: Add KGDB/KDB FIQ debugger generic code Anton Vorontsov
2012-09-13 15:03 ` [PATCH 10/11] ARM: VIC: Add a couple of low-level FIQ management helpers Anton Vorontsov
2012-09-13 15:03 ` [PATCH 11/11] ARM: versatile: Make able to use UART ports for KGDB FIQ debugger Anton Vorontsov
2012-09-13 17:04 ` [PATCH v7 0/11] KGDB/KDB FIQ (NMI) debugger Alan Cox
2012-09-13 16:55   ` Anton Vorontsov
2012-09-17 11:37 ` Greg Kroah-Hartman
2012-09-17 12:43   ` Jason Wessel
2012-09-17 12:54     ` Greg Kroah-Hartman
2012-09-17 15:39       ` Anton Vorontsov
2012-09-17 15:54         ` Greg Kroah-Hartman
2012-09-19 11:57           ` Jason Wessel
2012-09-19 16:57             ` Anton Vorontsov
2012-09-19 23:40 [PATCH v8 " Anton Vorontsov
2012-09-19 23:41 ` [PATCH 03/11] kdb: Turn KGDB_KDB=n stubs into static inlines Anton Vorontsov
2012-09-24 21:26 [PATCH v9 0/11] KGDB/KDB FIQ (NMI) debugger Anton Vorontsov
2012-09-24 21:27 ` [PATCH 03/11] kdb: Turn KGDB_KDB=n stubs into static inlines Anton Vorontsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1347548615-18227-3-git-send-email-anton.vorontsov@linaro.org \
    --to=anton.vorontsov@linaro.org \
    --cc=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --cc=arve@android.com \
    --cc=ccross@android.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jason.wessel@windriver.com \
    --cc=john.stultz@linaro.org \
    --cc=kernel-team@android.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=patches@linaro.org \
    --cc=swetland@google.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).