All of lore.kernel.org
 help / color / mirror / Atom feed
From: merez@codeaurora.org
To: Joe Perches <joe@perches.com>
Cc: qca_merez <qca_merez@qca.qualcomm.com>,
	Kalle Valo <kvalo@codeaurora.org>,
	linux-wireless@vger.kernel.org,
	wil6210 <wil6210@qca.qualcomm.com>,
	linux-wireless-owner@vger.kernel.org
Subject: Re: [PATCH 4/7] wil6210: print debug message when transmitting while disconnected
Date: Mon, 25 Apr 2016 16:30:58 +0300	[thread overview]
Message-ID: <ae4d9c13a189b5939bdb40de800f6110@codeaurora.org> (raw)
In-Reply-To: <1460341847.1800.68.camel@perches.com>

On 2016-04-11 05:30, Joe Perches wrote:
> 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(-)
> 
> 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); \
> --
> 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

Thanks for your suggestion, I currently changed wil_dbg_ratelimited only 
and will
change the other functions in a separate patch.
-- 
Maya Erez
Qualcomm Israel, Inc. on behalf of Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a 
Linux Foundation Collaborative Project

  reply	other threads:[~2016-04-25 13:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-05 11:24 [PATCH 0/7] wil6210 patches Maya Erez
2016-04-05 11:24 ` [PATCH 1/7] wil6210: add function name to wil log macros Maya Erez
2016-04-06  7:19   ` Joe Perches
2016-04-07 15:04     ` Haim, Maya
2016-04-07 15:41       ` Kalle Valo
2016-04-12  7:45         ` Haim, Maya
2016-04-15 12:28           ` Kalle Valo
2016-04-25  9:08             ` merez
2016-04-07 16:05       ` Joe Perches
2016-04-05 11:24 ` [PATCH 2/7] wil6210: support regular scan on P2P_DEVICE interface Maya Erez
2016-04-05 11:24 ` [PATCH 3/7] wil6210: change RX_HTRSH interrupt print level to debug Maya Erez
2016-04-05 11:24 ` [PATCH 4/7] wil6210: print debug message when transmitting while disconnected Maya Erez
2016-04-06  7:22   ` Joe Perches
2016-04-10 19:17     ` qca_merez
2016-04-11  2:30       ` Joe Perches
2016-04-25 13:30         ` merez [this message]
2016-04-05 11:24 ` [PATCH 5/7] wil6210: unmask RX_HTRSH interrupt only when connected Maya Erez
2016-04-05 11:24 ` [PATCH 6/7] wil6210: prevent deep sleep of 60G device in critical paths Maya Erez
2016-04-05 11:24 ` [PATCH 7/7] wil6210: add support for device led configuration Maya Erez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ae4d9c13a189b5939bdb40de800f6110@codeaurora.org \
    --to=merez@codeaurora.org \
    --cc=joe@perches.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless-owner@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=qca_merez@qca.qualcomm.com \
    --cc=wil6210@qca.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.