From patchwork Mon Apr 11 02:30:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 8796021 X-Patchwork-Delegate: kvalo@adurom.com 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6483CC0553 for ; Mon, 11 Apr 2016 02:30:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72F0620256 for ; Mon, 11 Apr 2016 02:30:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 697BD20225 for ; Mon, 11 Apr 2016 02:30:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750932AbcDKCaw (ORCPT ); Sun, 10 Apr 2016 22:30:52 -0400 Received: from smtprelay0020.hostedemail.com ([216.40.44.20]:47507 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750879AbcDKCav (ORCPT ); Sun, 10 Apr 2016 22:30:51 -0400 Received: from filter.hostedemail.com (unknown [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id D54566ABD8; Mon, 11 Apr 2016 02:30:49 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2, 0, 0, , d41d8cd98f00b204, joe@perches.com, :::::::, RULES_HIT:41:69:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1535:1544:1593:1594:1605:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3622:3865:3867:3870:3874:4321:5007:6119:10004:10848:11026:11232:11657:11658:11783:11914:12043:12296:12438:12517:12519:12555:12683:12740:13255:13439:13894:14181:14659:14721:21080:21212:30054:30091, 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, LFtime:2, LUA_SUMMARY:none X-HE-Tag: sleep17_7b7d26d05673d X-Filterd-Recvd-Size: 5168 Received: from XPS-9350 (14.sub-70-197-74.myvzw.com [70.197.74.14]) (Authenticated sender: joe@perches.com) by omf03.hostedemail.com (Postfix) with ESMTPA; Mon, 11 Apr 2016 02:30:48 +0000 (UTC) Message-ID: <1460341847.1800.68.camel@perches.com> Subject: Re: [PATCH 4/7] wil6210: print debug message when transmitting while disconnected From: Joe Perches To: qca_merez , Kalle Valo Cc: "linux-wireless@vger.kernel.org" , wil6210 Date: Sun, 10 Apr 2016 19:30:47 -0700 In-Reply-To: <22bd7713a48b46e2bb2f1ec67ad6c409@euamsexm01a.eu.qualcomm.com> References: <1459855447-17413-1-git-send-email-qca_merez@qca.qualcomm.com> <1459855447-17413-5-git-send-email-qca_merez@qca.qualcomm.com> <1459927376.6715.37.camel@perches.com> <22bd7713a48b46e2bb2f1ec67ad6c409@euamsexm01a.eu.qualcomm.com> X-Mailer: Evolution 3.18.5.2-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=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Sun, 2016-04-10 at 19:17 +0000, qca_merez wrote: > On 4/6/2016 10:22 AM, Joe Perches wrote: > > > > On Tue, 2016-04-05 at 14:24 +0300, Maya Erez w > > > > > > +void __wil_dbg_ratelimited(struct wil6210_priv *wil, const char *fmt,  > > > +...) { > > > + if (net_ratelimit()) { > > > > Inverting the test would reduce indentation. > I preferred to have the same implementation as in wil_err_ratelimited. That's easy enough. Maybe: ---  drivers/net/wireless/ath/wil6210/debug.c   | 55 ++++++++++++++----------------  drivers/net/wireless/ath/wil6210/wil6210.h |  8 ++---  2 files changed, 30 insertions(+), 33 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/wil6210/debug.c b/drivers/net/wireless/ath/wil6210/debug.c index 3249562..de1e932 100644 --- a/drivers/net/wireless/ath/wil6210/debug.c +++ b/drivers/net/wireless/ath/wil6210/debug.c @@ -17,61 +17,58 @@  #include "wil6210.h"  #include "trace.h"   -void wil_err(struct wil6210_priv *wil, const char *fmt, ...) +void wil_err(const struct wil6210_priv *wil, const char *fmt, ...)  { - struct net_device *ndev = wil_to_ndev(wil); - struct va_format vaf = { - .fmt = fmt, - }; + struct va_format vaf;   va_list args;     va_start(args, fmt); + vaf.fmt = fmt;   vaf.va = &args; - netdev_err(ndev, "%pV", &vaf); + netdev_err(wil_to_ndev(wil), "%pV", &vaf);   trace_wil6210_log_err(&vaf);   va_end(args);  }   -void wil_err_ratelimited(struct wil6210_priv *wil, const char *fmt, ...) +void wil_err_ratelimited(const struct wil6210_priv *wil, const char *fmt, ...)  { - if (net_ratelimit()) { - struct net_device *ndev = wil_to_ndev(wil); - struct va_format vaf = { - .fmt = fmt, - }; - va_list args; + struct va_format vaf; + va_list args; + + if (!net_ratelimit()) + return;   - va_start(args, fmt); - vaf.va = &args; - netdev_err(ndev, "%pV", &vaf); - trace_wil6210_log_err(&vaf); - va_end(args); - } + va_start(args, fmt); + vaf.fmt = fmt; + vaf.va = &args; + netdev_err(wil_to_ndev(wil), "%pV", &vaf); + trace_wil6210_log_err(&vaf); + va_end(args);  }   -void wil_info(struct wil6210_priv *wil, const char *fmt, ...) +void wil_info(const struct wil6210_priv *wil, const char *fmt, ...)  { - struct net_device *ndev = wil_to_ndev(wil); - struct va_format vaf = { - .fmt = fmt, - }; + struct va_format vaf;   va_list args;   + if (!net_ratelimit()) + return; +   va_start(args, fmt); + vaf.fmt = fmt;   vaf.va = &args; - netdev_info(ndev, "%pV", &vaf); + netdev_info(wil_to_ndev(wil), "%pV", &vaf);   trace_wil6210_log_info(&vaf);   va_end(args);  }   -void wil_dbg_trace(struct wil6210_priv *wil, const char *fmt, ...) +void wil_dbg_trace(const struct wil6210_priv *wil, const char *fmt, ...)  { - struct va_format vaf = { - .fmt = fmt, - }; + struct va_format vaf;   va_list args;     va_start(args, fmt); + vaf.fmt = fmt;   vaf.va = &args;   trace_wil6210_log_dbg(&vaf);   va_end(args); diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h index 4d699ea4..e2b62b1 100644 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ b/drivers/net/wireless/ath/wil6210/wil6210.h @@ -633,13 +633,13 @@ struct wil6210_priv {  #define ndev_to_wil(n) (wdev_to_wil(n->ieee80211_ptr))    __printf(2, 3) -void wil_dbg_trace(struct wil6210_priv *wil, const char *fmt, ...); +void wil_dbg_trace(const struct wil6210_priv *wil, const char *fmt, ...);  __printf(2, 3) -void wil_err(struct wil6210_priv *wil, const char *fmt, ...); +void wil_err(const struct wil6210_priv *wil, const char *fmt, ...);  __printf(2, 3) -void wil_err_ratelimited(struct wil6210_priv *wil, const char *fmt, ...); +void wil_err_ratelimited(const struct wil6210_priv *wil, const char *fmt, ...);  __printf(2, 3) -void wil_info(struct wil6210_priv *wil, const char *fmt, ...); +void wil_info(const struct wil6210_priv *wil, const char *fmt, ...);  #define wil_dbg(wil, fmt, arg...) do { \   netdev_dbg(wil_to_ndev(wil), fmt, ##arg); \   wil_dbg_trace(wil, fmt, ##arg); \