From patchwork Sun Mar 9 07:44:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 3799621 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F02FBBF540 for ; Sun, 9 Mar 2014 07:44:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C78D220255 for ; Sun, 9 Mar 2014 07:44:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8C3452024D for ; Sun, 9 Mar 2014 07:44:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752153AbaCIHo2 (ORCPT ); Sun, 9 Mar 2014 03:44:28 -0400 Received: from smtprelay0205.hostedemail.com ([216.40.44.205]:38752 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751897AbaCIHo1 (ORCPT ); Sun, 9 Mar 2014 03:44:27 -0400 Received: from filter.hostedemail.com (ff-bigip1 [10.5.19.254]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id A6D3D235A7; Sun, 9 Mar 2014 07:44:26 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2, 0, 0, , d41d8cd98f00b204, joe@perches.com, :::::, RULES_HIT:41:69:355:379:541:599:960:973:988:989:1260:1261:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1535:1544:1593:1594:1605:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3622:3865:3867:3868:3871:4321:5007:7652:7875:9592:10004:10848:11026:11232:11657:11658:11914:12043:12296:12438:12517:12519:12555:12683:12740:21060, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0 X-HE-Tag: scene66_991e02dbc30e X-Filterd-Recvd-Size: 5169 Received: from [192.168.1.157] (pool-96-251-49-11.lsanca.fios.verizon.net [96.251.49.11]) (Authenticated sender: joe@perches.com) by omf07.hostedemail.com (Postfix) with ESMTPA; Sun, 9 Mar 2014 07:44:25 +0000 (UTC) Message-ID: <1394351064.6972.41.camel@joe-AO722> Subject: Re: [PATCH 5/6] ath6kl: remove a warning on a macro From: Joe Perches To: Kalle Valo Cc: linux-wireless@vger.kernel.org, ath6kl@lists.infradead.org Date: Sat, 08 Mar 2014 23:44:24 -0800 In-Reply-To: <1394349609.6972.39.camel@joe-AO722> References: <20140309065606.10793.67068.stgit@x230> <20140309065735.10793.45835.stgit@x230> <87iornn8xx.fsf@kamboji.qca.qualcomm.com> <1394349609.6972.39.camel@joe-AO722> X-Mailer: Evolution 3.8.4-0ubuntu1 Mime-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Sat, 2014-03-08 at 23:20 -0800, Joe Perches wrote: > On Sun, 2014-03-09 at 09:10 +0200, Kalle Valo wrote: > > Hi Joe, > > Hi Kalle. > > > I would need help with this checkpatch warning: > > No idea what the warning is. > > > > --- a/drivers/net/wireless/ath/ath6kl/debug.c > > > +++ b/drivers/net/wireless/ath/ath6kl/debug.c > > > @@ -798,12 +798,10 @@ static ssize_t ath6kl_endpoint_stats_read(struct file *file, > > > return -ENOMEM; > > > > > > #define EPSTAT(name) \ > > > - do { \ > > > - len = print_endpoint_stat(target, buf, buf_len, len, \ > > > - offsetof(struct htc_endpoint_stats, \ > > > - name), \ > > > - #name); \ > > > - } while (0) > > > + (len = print_endpoint_stat(target, buf, buf_len, len, \ > > > + offsetof(struct htc_endpoint_stats, \ > > > + name), \ > > > + #name)) > > > > I wasn't quite able to figure out what is the preferred style here. I > > don't see how the () style is any better, but checkpatch didn't complain > > at least. > > No idea what the preferred style is, but > I'd probably change the #define to > > #define EPSTAT(name) \ > print_endpoint_stat(target, buf, buf_len, len, \ > offsetof(struct htc_endpoint_stats, name), \ > #name) > > and the uses to > > len = EPSTAT(whatever); Or maybe this: drivers/net/wireless/ath/ath6kl/debug.c | 62 ++++++++++++++++----------------- 1 file changed, 30 insertions(+), 32 deletions(-) --- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c index dbfd17d..7a6b476 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ b/drivers/net/wireless/ath/ath6kl/debug.c @@ -771,16 +771,17 @@ static unsigned int print_endpoint_stat(struct htc_target *target, char *buf, int i; struct htc_endpoint_stats *ep_st; u32 *counter; + unsigned int nlen = len; - len += scnprintf(buf + len, buf_len - len, "%s:", name); + nlen += scnprintf(buf + nlen, buf_len - nlen, "%s:", name); for (i = 0; i < ENDPOINT_MAX; i++) { ep_st = &target->endpoint[i].ep_st; counter = ((u32 *) ep_st) + (offset / 4); - len += scnprintf(buf + len, buf_len - len, " %u", *counter); + nlen += scnprintf(buf + nlen, buf_len - nlen, " %u", *counter); } - len += scnprintf(buf + len, buf_len - len, "\n"); + nlen += scnprintf(buf + nlen, buf_len - nlen, "\n"); - return len; + return nlen - len; } static ssize_t ath6kl_endpoint_stats_read(struct file *file, @@ -800,34 +801,31 @@ static ssize_t ath6kl_endpoint_stats_read(struct file *file, return -ENOMEM; #define EPSTAT(name) \ - do { \ - len = print_endpoint_stat(target, buf, buf_len, len, \ - offsetof(struct htc_endpoint_stats, \ - name), \ - #name); \ - } while (0) - - EPSTAT(cred_low_indicate); - EPSTAT(tx_issued); - EPSTAT(tx_pkt_bundled); - EPSTAT(tx_bundles); - EPSTAT(tx_dropped); - EPSTAT(tx_cred_rpt); - EPSTAT(cred_rpt_from_rx); - EPSTAT(cred_rpt_from_other); - EPSTAT(cred_rpt_ep0); - EPSTAT(cred_from_rx); - EPSTAT(cred_from_other); - EPSTAT(cred_from_ep0); - EPSTAT(cred_cosumd); - EPSTAT(cred_retnd); - EPSTAT(rx_pkts); - EPSTAT(rx_lkahds); - EPSTAT(rx_bundl); - EPSTAT(rx_bundle_lkahd); - EPSTAT(rx_bundle_from_hdr); - EPSTAT(rx_alloc_thresh_hit); - EPSTAT(rxalloc_thresh_byte); + print_endpoint_stat(target, buf, buf_len, len, \ + offsetof(struct htc_endpoint_stats, name), \ + #name) + + len += EPSTAT(cred_low_indicate); + len += EPSTAT(tx_issued); + len += EPSTAT(tx_pkt_bundled); + len += EPSTAT(tx_bundles); + len += EPSTAT(tx_dropped); + len += EPSTAT(tx_cred_rpt); + len += EPSTAT(cred_rpt_from_rx); + len += EPSTAT(cred_rpt_from_other); + len += EPSTAT(cred_rpt_ep0); + len += EPSTAT(cred_from_rx); + len += EPSTAT(cred_from_other); + len += EPSTAT(cred_from_ep0); + len += EPSTAT(cred_cosumd); + len += EPSTAT(cred_retnd); + len += EPSTAT(rx_pkts); + len += EPSTAT(rx_lkahds); + len += EPSTAT(rx_bundl); + len += EPSTAT(rx_bundle_lkahd); + len += EPSTAT(rx_bundle_from_hdr); + len += EPSTAT(rx_alloc_thresh_hit); + len += EPSTAT(rxalloc_thresh_byte); #undef EPSTAT if (len > buf_len)