From patchwork Wed Apr 23 03:04:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Shen Lim X-Patchwork-Id: 28842 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 03DE4203AC for ; Wed, 23 Apr 2014 03:06:07 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id a41sf1488137yho.10 for ; Tue, 22 Apr 2014 20:06:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=ZEQTLSd9ozxcG2B1K7GYlVWrlTFldA4zrpFG+jRXzWs=; b=RqX3oev3YFkr/YrunKJPaqaMOiSjJ36E7m3kp7ee3oc1UbfX60VcpWXlo7m8taDCv1 r+jKW54iMg3eMiIFXOTtrMgFJJyzc+J07Xx59uEYw7clqhKK9plzLiUG72hoX99bQnJt 8xP6ZctF66CkpIa4qOnen5t8VEeG2oV+BALEpMo7Xzt9nQBb2KZU+7zX8X1tBzLXLL87 tqH26wnGokKy6OpfuJJNPheubYVxerJCz0GFOMFK7dTlGnSwctUbVdBfcf9DYiPq/Nak +sVMw0hwEInqg6FdbZ3amAnINxDnenOQ/9yPqbXlN9KM3U78TaaL1Lf7ENiNPMZ2NNpE kKzw== X-Gm-Message-State: ALoCoQmU5BVNnzqyJEr8zikDV0KgryhpkXBDffwSaHP1qMHF5RbrjjFcYPQh0c05K0dbTq8w90b4 X-Received: by 10.58.105.105 with SMTP id gl9mr23447722veb.17.1398222367477; Tue, 22 Apr 2014 20:06:07 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.87 with SMTP id v81ls395059qge.0.gmail; Tue, 22 Apr 2014 20:06:07 -0700 (PDT) X-Received: by 10.220.105.4 with SMTP id r4mr4742082vco.27.1398222367385; Tue, 22 Apr 2014 20:06:07 -0700 (PDT) Received: from mail-ve0-x22f.google.com (mail-ve0-x22f.google.com [2607:f8b0:400c:c01::22f]) by mx.google.com with ESMTPS id d20si7209173veu.97.2014.04.22.20.06.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Apr 2014 20:06:07 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22f is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22f; Received: by mail-ve0-f175.google.com with SMTP id oz11so419802veb.20 for ; Tue, 22 Apr 2014 20:06:07 -0700 (PDT) X-Received: by 10.221.55.133 with SMTP id vy5mr38959116vcb.17.1398222367315; Tue, 22 Apr 2014 20:06:07 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp71851vcb; Tue, 22 Apr 2014 20:06:06 -0700 (PDT) X-Received: by 10.68.178.162 with SMTP id cz2mr49369306pbc.51.1398222366550; Tue, 22 Apr 2014 20:06:06 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id py5si17775432pbc.314.2014.04.22.20.06.06; Tue, 22 Apr 2014 20:06:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753414AbaDWDE4 (ORCPT + 3 others); Tue, 22 Apr 2014 23:04:56 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:48486 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751248AbaDWDEz (ORCPT ); Tue, 22 Apr 2014 23:04:55 -0400 Received: by mail-pd0-f172.google.com with SMTP id w10so287187pde.31 for ; Tue, 22 Apr 2014 20:04:54 -0700 (PDT) X-Received: by 10.68.197.99 with SMTP id it3mr49283121pbc.37.1398222294743; Tue, 22 Apr 2014 20:04:54 -0700 (PDT) Received: from gup76.hsd1.ca.comcast.net ([98.234.176.204]) by mx.google.com with ESMTPSA id hw8sm88061211pbc.62.2014.04.22.20.04.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Apr 2014 20:04:54 -0700 (PDT) From: Zi Shen Lim To: Nicolas Pitre Cc: Zi Shen Lim , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Joe Perches Subject: [PATCH] smc91x: improve definition of debug macros Date: Tue, 22 Apr 2014 20:04:42 -0700 Message-Id: <1398222282-8926-1-git-send-email-zlim.lnx@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: netdev-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: netdev@vger.kernel.org X-Original-Sender: zlim.lnx@gmail.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22f is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@gmail.com; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Redefine some macros that were conditioned upon SMC_DEBUG level. By allowing compiler to verify parameters used by these macros unconditionally, we can flag compilation failures. Compiler will still optimize out the unused code path depending on SMC_DEBUG, so this is a net gain. Signed-off-by: Joe Perches Signed-off-by: Zi Shen Lim --- Note: This patch is based on suggestion by Joe Perches. I added his Signed-off-by as well since I didn't receive an objection. drivers/net/ethernet/smsc/smc91x.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c index 597909f..bcaa41a 100644 --- a/drivers/net/ethernet/smsc/smc91x.c +++ b/drivers/net/ethernet/smsc/smc91x.c @@ -147,18 +147,19 @@ MODULE_ALIAS("platform:smc91x"); */ #define MII_DELAY 1 -#if SMC_DEBUG > 0 -#define DBG(n, dev, args...) \ - do { \ - if (SMC_DEBUG >= (n)) \ - netdev_dbg(dev, args); \ +#define DBG(n, dev, fmt, ...) \ + do { \ + if (SMC_DEBUG >= (n)) \ + netdev_dbg(dev, fmt, ##__VA_ARGS__); \ } while (0) -#define PRINTK(dev, args...) netdev_info(dev, args) -#else -#define DBG(n, dev, args...) do { } while (0) -#define PRINTK(dev, args...) netdev_dbg(dev, args) -#endif +#define PRINTK(dev, fmt, ...) \ + do { \ + if (SMC_DEBUG > 0) \ + netdev_info(dev, fmt, ##__VA_ARGS__); \ + else \ + netdev_dbg(dev, fmt, ##__VA_ARGS__); \ + } while (0) #if SMC_DEBUG > 3 static void PRINT_PKT(u_char *buf, int length) @@ -191,7 +192,7 @@ static void PRINT_PKT(u_char *buf, int length) pr_cont("\n"); } #else -#define PRINT_PKT(x...) do { } while (0) +static inline void PRINT_PKT(u_char *buf, int length) { } #endif