From patchwork Mon Sep 10 04:13:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 11271 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id B115523F26 for ; Mon, 10 Sep 2012 04:16:00 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 654C0A19097 for ; Mon, 10 Sep 2012 04:16:00 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id k11so2310032iea.11 for ; Sun, 09 Sep 2012 21:16:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:date:from :to:cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent:x-gm-message-state; bh=p/kWpoIxbmOilCPgdtlfnLwScRjWGa1PsfxvN1ORpo0=; b=kvkZf41J5jJOnEyK/iBhWoGZ+XpycynavBz17iChmrxh5WRu7N30CrJ0P6ykT82Uqz IFLkMI4IT9lv3VLetqN/O5aZGwaPhw5kqhVkNAylNTAaf5H2LkliKCGx4nD6N3V32xgh +mdEXoAjp4z14O/uc08DnP2ArusJed8Q2gKBjWgXgEeY9FYHeOjxBcDN7Dq9ZwzwbJjn BbK0rL6hoE7X8VuH7q4us0S4vtKJsnlpZMz1T9vueLS8k0DgMamA/fuFFinFYSIGdj9l pkeAJI1l2bucpIa8IYEuleO2Lps0/gR9IcXfLZ+K4p6TaEYEKI8WAX4bXeo86X1ii7J9 YQRw== Received: by 10.50.180.129 with SMTP id do1mr9116140igc.28.1347250560059; Sun, 09 Sep 2012 21:16:00 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp72937igc; Sun, 9 Sep 2012 21:15:59 -0700 (PDT) Received: by 10.68.130.131 with SMTP id oe3mr3843831pbb.102.1347250559514; Sun, 09 Sep 2012 21:15:59 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id gh6si18550741pbc.177.2012.09.09.21.15.59 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 09 Sep 2012 21:15:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) smtp.mail=anton.vorontsov@linaro.org Received: by mail-pb0-f50.google.com with SMTP id md12so2061704pbc.37 for ; Sun, 09 Sep 2012 21:15:59 -0700 (PDT) Received: by 10.68.213.138 with SMTP id ns10mr3867504pbc.157.1347250559256; Sun, 09 Sep 2012 21:15:59 -0700 (PDT) Received: from localhost (ip-64-134-230-8.public.wayport.net. [64.134.230.8]) by mx.google.com with ESMTPS id sj5sm7434979pbc.30.2012.09.09.21.15.58 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 09 Sep 2012 21:15:58 -0700 (PDT) Date: Sun, 9 Sep 2012 21:13:26 -0700 From: Anton Vorontsov To: Andrew Morton , Russell King , Jason Wessel , Greg Kroah-Hartman , Alan Cox Cc: Arve =?utf-8?B?SGrDuG5uZXbDpWc=?= , Colin Cross , Brian Swetland , John Stultz , 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 05/14] kdb: Turn KGDB_KDB=n stubs into static inlines Message-ID: <20120910041326.GE29537@lizard> References: <20120910040802.GA1261@lizard> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120910040802.GA1261@lizard> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQmU8xhHg9cNKkaajXUsmyWYp4bF3hYRLpB06fBm8X7Vx42KO01JixhLxgSZfHaFvBcr5j/f 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 --- 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 */ +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 #include @@ -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,