Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754034AbZJAW6G (ORCPT ); Thu, 1 Oct 2009 18:58:06 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753797AbZJAW6F (ORCPT ); Thu, 1 Oct 2009 18:58:05 -0400 Received: from mail.perches.com ([173.55.12.10]:1605 "EHLO mail.perches.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753630AbZJAW6E (ORCPT ); Thu, 1 Oct 2009 18:58:04 -0400 Subject: [PATCH v2] dynamic_debug.h/kernel.h: Remove KBUILD_MODNAME from dynamic_pr_debug From: Joe Perches To: Andrew Morton Cc: jbaron@redhat.com, linux-kernel@vger.kernel.org In-Reply-To: <20091001145729.280ffe69.akpm@linux-foundation.org> References: <1254342977.2960.114.camel@Joe-Laptop.home> <20091001145729.280ffe69.akpm@linux-foundation.org> Content-Type: text/plain; charset="UTF-8" Date: Thu, 01 Oct 2009 15:58:07 -0700 Message-Id: <1254437887.1799.138.camel@Joe-Laptop.home> Mime-Version: 1.0 X-Mailer: Evolution 2.28.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3185 Lines: 93 On Thu, 2009-10-01 at 14:57 -0700, Andrew Morton wrote: > x86_64 allmodconfig: > crypto/zlib.c: In function 'zlib_compress_update': > crypto/zlib.c:148: warning: initialization makes integer from pointer without a cast Sigh... compiling just allyesconfig is not enough testing. Defective patch fixed by moving the expansion of pr_fmt(fmt) to the actual printk Compiled crypto/zlib.o allyesconfig, allnoconfig, allmodconfig --- If CONFIG_DYNAMIC_DEBUG is enabled and a source file has: #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include dynamic_debug.h will duplicate KBUILD_MODNAME in the output string. Remove the use of KBUILD_MODNAME from the output format string generated by dynamic_debug.h If CONFIG_DYNAMIC_DEBUG is not enabled, no compile-time check is done to printk/dev_printk arguments. Add it. Signed-off-by: Joe Perches diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index a0d9422..f8c2e17 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -57,8 +57,7 @@ extern int ddebug_remove_module(char *mod_name); { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ if (__dynamic_dbg_enabled(descriptor)) \ - printk(KERN_DEBUG KBUILD_MODNAME ":" pr_fmt(fmt), \ - ##__VA_ARGS__); \ + printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ } while (0) @@ -69,9 +68,7 @@ extern int ddebug_remove_module(char *mod_name); { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ if (__dynamic_dbg_enabled(descriptor)) \ - dev_printk(KERN_DEBUG, dev, \ - KBUILD_MODNAME ": " fmt, \ - ##__VA_ARGS__); \ + dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ } while (0) #else @@ -81,8 +78,10 @@ static inline int ddebug_remove_module(char *mod) return 0; } -#define dynamic_pr_debug(fmt, ...) do { } while (0) -#define dynamic_dev_dbg(dev, format, ...) do { } while (0) +#define dynamic_pr_debug(fmt, ...) \ + do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0) +#define dynamic_dev_dbg(dev, format, ...) \ + do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0) #endif #endif diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d3cd23f..b0affed 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -398,9 +398,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #elif defined(CONFIG_DYNAMIC_DEBUG) /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ -#define pr_debug(fmt, ...) do { \ - dynamic_pr_debug(fmt, ##__VA_ARGS__); \ - } while (0) +#define pr_debug(fmt, ...) \ + dynamic_pr_debug(fmt, ##__VA_ARGS__) #else #define pr_debug(fmt, ...) \ ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; }) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/