From patchwork Sun Apr 20 01:24:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zi Shen Lim X-Patchwork-Id: 28663 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C8F6820548 for ; Sun, 20 Apr 2014 01:24:43 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wn1sf5586313obc.5 for ; Sat, 19 Apr 2014 18:24:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :references:mime-version:in-reply-to:user-agent:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-description:content-disposition :content-transfer-encoding; bh=1m33PfCOmnw+gyygH+1UM3SHNrCTe0T4ZVI21AmemC8=; b=M46UNkluVq2f79aBKVz8hydt+NVfDZECPhff9QWn1N5+0wVgrjBdvgVlnG+QAQMIMm ccqEDbCQDmd54sq+7NHnQbb95x+4VaHor4iUEf1BI1QQ/T6TaI1L0rgq4DVyKAZMIlDB XUW8vZNJoAz+DdAlnfnmu7uTDdQ8l1fb6N0I3aiSxg8fhA571pp/G47ATsOIsmHjJsHo 3t9Mqi/cZ1qCjbgwhZrNccKnEiz07b+jUlDRgEXmpnB1SRiEyklVxc6/EV1RNF9zm+/a dFgjuYtoXEuozjkOHtTkEWx2GwNU8RgwqYX/PtFMMBVTMuVXfp34li8aBHe6GCfTd9sf 4tkA== X-Gm-Message-State: ALoCoQnpQwsAS4s/sAaRIaHhQBIZOBA3Bz2AtLeAl9ckQ/kWKtmoWoqO76TS0VlHwno4GhV44QgS X-Received: by 10.182.213.5 with SMTP id no5mr15001837obc.15.1397957083291; Sat, 19 Apr 2014 18:24:43 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.81.201 with SMTP id f67ls1980251qgd.91.gmail; Sat, 19 Apr 2014 18:24:43 -0700 (PDT) X-Received: by 10.58.185.145 with SMTP id fc17mr26878006vec.14.1397957083157; Sat, 19 Apr 2014 18:24:43 -0700 (PDT) Received: from mail-ve0-x22a.google.com (mail-ve0-x22a.google.com [2607:f8b0:400c:c01::22a]) by mx.google.com with ESMTPS id ys8si5651473veb.160.2014.04.19.18.24.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 19 Apr 2014 18:24:43 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22a 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::22a; Received: by mail-ve0-f170.google.com with SMTP id pa12so5543321veb.15 for ; Sat, 19 Apr 2014 18:24:43 -0700 (PDT) X-Received: by 10.58.187.9 with SMTP id fo9mr25558182vec.4.1397957083065; Sat, 19 Apr 2014 18:24:43 -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 ib8csp205426vcb; Sat, 19 Apr 2014 18:24:42 -0700 (PDT) X-Received: by 10.68.201.67 with SMTP id jy3mr30151446pbc.20.1397957082225; Sat, 19 Apr 2014 18:24:42 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ev1si13342183pbb.509.2014.04.19.18.24.41; Sat, 19 Apr 2014 18:24:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 S1755240AbaDTBYf (ORCPT + 26 others); Sat, 19 Apr 2014 21:24:35 -0400 Received: from mail-pd0-f180.google.com ([209.85.192.180]:46162 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754793AbaDTBY2 (ORCPT ); Sat, 19 Apr 2014 21:24:28 -0400 Received: by mail-pd0-f180.google.com with SMTP id v10so2548233pde.25 for ; Sat, 19 Apr 2014 18:24:27 -0700 (PDT) X-Received: by 10.66.141.144 with SMTP id ro16mr59059pab.131.1397957067690; Sat, 19 Apr 2014 18:24:27 -0700 (PDT) Received: from gup76 ([2601:9:5d00:2ab:185d:2c75:c126:dacb]) by mx.google.com with ESMTPSA id pr4sm68725693pbb.53.2014.04.19.18.24.26 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 19 Apr 2014 18:24:27 -0700 (PDT) Date: Sat, 19 Apr 2014 18:24:19 -0700 From: Zi Shen Lim To: Joe Perches Cc: Nicolas Pitre , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] smc91x: fix compile error when SMC_DEBUG >= 2 Message-ID: <20140420012419.GA12770@gup76> References: <1397879250-32041-1-git-send-email-zlim.lnx@gmail.com> <1397880413.3106.2.camel@joe-AO725> MIME-Version: 1.0 In-Reply-To: <1397880413.3106.2.camel@joe-AO725> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@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::22a 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: , Content-Description: Re: [PATCH] smc91x: fix compile error when SMC_DEBUG >= 2 Content-Disposition: inline Hi Joe, On Fri, Apr 18, 2014 at 09:06:53PM -0700, Joe Perches wrote: > On Fri, 2014-04-18 at 20:47 -0700, Zi Shen Lim wrote: > > When SMC_DEBUG >= 2, we hit the following compilation error: > > > > drivers/net/ethernet/smsc/smc91x.c:85:0: > > drivers/net/ethernet/smsc/smc91x.c: In function ‘smc_findirq’: > > drivers/net/ethernet/smsc/smc91x.c:1784:9: error: ‘dev’ undeclared (first use in this function) > > DBG(2, dev, "%s: %s\n", CARDNAME, __func__); > > ^ > > Fix it by passing in the appropriate netdev pointer. > > Perhaps verifying the format and args in all cases > would help avoid more of these in the future. Sounds good. I can add it as the second patch in the series. > --- > drivers/net/ethernet/smsc/smc91x.c | 25 +++++++++++++++---------- > 1 file changed, 15 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c > index d1b4dca..a8302f5 100644 > --- a/drivers/net/ethernet/smsc/smc91x.c > +++ b/drivers/net/ethernet/smsc/smc91x.c > @@ -148,16 +148,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); \ > - } while (0) > - > -#define PRINTK(dev, args...) netdev_info(dev, args) > +#define DBG(n, dev, fmt, ...) \ > +do { \ > + if (SMC_DEBUG >= (n)) \ > + netdev_dbg(dev, fmt, ##__VA_ARGS__); \ > +} while (0) > +#define PRINTK(dev, fmt, ...) netdev_info(dev, fmt, ##__VA_ARGS__) > #else > -#define DBG(n, dev, args...) do { } while (0) > -#define PRINTK(dev, args...) netdev_dbg(dev, args) > +#define DBG(n, dev, fmt, ...) \ > +do { \ > + if (0) \ > + netdev_dbg(dev, fmt, ##__VA_ARGS__); \ > +} while (0) > +#define PRINTK(dev, fmt, ...) netdev_dbg(dev, fmt, ##__VA_ARGS__) > #endif > > #if SMC_DEBUG > 3 > @@ -191,7 +194,9 @@ 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 > How about the following? Ok to add your Signed-off-by as well? Thanks. --- drivers/net/ethernet/smsc/smc91x.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) -- 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/ diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c index d1b4dca..796355a 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