All of lore.kernel.org
 help / color / mirror / Atom feed
* [ath9k-devel] [PATCH] ath9k:  Add wiphy name to log messages.
@ 2012-03-08  0:05 ` greearb
  0 siblings, 0 replies; 6+ messages in thread
From: greearb at candelatech.com @ 2012-03-08  0:05 UTC (permalink / raw)
  To: ath9k-devel

From: Ben Greear <greearb@candelatech.com>

On systems with multiple NICs, it's nice to know which
one is producing warnings.  Here is an example of the
new ouput:

ath: wiphy0: Failed to stop TX DMA, queues=0x005!

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 efc0111... 54f255d... M	drivers/net/wireless/ath/ath.h
:100644 100644 d9218fe... ea2c737... M	drivers/net/wireless/ath/main.c
 drivers/net/wireless/ath/ath.h  |    7 ++++---
 drivers/net/wireless/ath/main.c |    9 +++++++--
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index efc0111..54f255d 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -174,12 +174,13 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry);
 void ath_hw_cycle_counters_update(struct ath_common *common);
 int32_t ath_hw_get_listen_time(struct ath_common *common);
 
-extern __printf(2, 3) void ath_printk(const char *level, const char *fmt, ...);
+extern __printf(3, 4) void ath_printk(const char *level,
+				      const struct ath_common *common,
+				      const char *fmt, ...);
 
 #define _ath_printk(level, common, fmt, ...)			\
 do {								\
-	__always_unused struct ath_common *unused = common;	\
-	ath_printk(level, fmt, ##__VA_ARGS__);			\
+	ath_printk(level, common, fmt, ##__VA_ARGS__);		\
 } while (0)
 
 #define ath_emerg(common, fmt, ...)				\
diff --git a/drivers/net/wireless/ath/main.c b/drivers/net/wireless/ath/main.c
index d9218fe..ea2c737 100644
--- a/drivers/net/wireless/ath/main.c
+++ b/drivers/net/wireless/ath/main.c
@@ -57,7 +57,8 @@ struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
 }
 EXPORT_SYMBOL(ath_rxbuf_alloc);
 
-void ath_printk(const char *level, const char *fmt, ...)
+void ath_printk(const char *level, const struct ath_common* common,
+		const char *fmt, ...)
 {
 	struct va_format vaf;
 	va_list args;
@@ -67,7 +68,11 @@ void ath_printk(const char *level, const char *fmt, ...)
 	vaf.fmt = fmt;
 	vaf.va = &args;
 
-	printk("%sath: %pV", level, &vaf);
+	if (common && common->hw && common->hw->wiphy)
+		printk("%sath: %s: %pV",
+		       level, wiphy_name(common->hw->wiphy), &vaf);
+	else
+		printk("%sath: %pV", level, &vaf);
 
 	va_end(args);
 }
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] ath9k:  Add wiphy name to log messages.
@ 2012-03-08  0:05 ` greearb
  0 siblings, 0 replies; 6+ messages in thread
From: greearb @ 2012-03-08  0:05 UTC (permalink / raw)
  To: ath9k-devel; +Cc: netdev, Ben Greear

From: Ben Greear <greearb@candelatech.com>

On systems with multiple NICs, it's nice to know which
one is producing warnings.  Here is an example of the
new ouput:

ath: wiphy0: Failed to stop TX DMA, queues=0x005!

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 efc0111... 54f255d... M	drivers/net/wireless/ath/ath.h
:100644 100644 d9218fe... ea2c737... M	drivers/net/wireless/ath/main.c
 drivers/net/wireless/ath/ath.h  |    7 ++++---
 drivers/net/wireless/ath/main.c |    9 +++++++--
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index efc0111..54f255d 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -174,12 +174,13 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry);
 void ath_hw_cycle_counters_update(struct ath_common *common);
 int32_t ath_hw_get_listen_time(struct ath_common *common);
 
-extern __printf(2, 3) void ath_printk(const char *level, const char *fmt, ...);
+extern __printf(3, 4) void ath_printk(const char *level,
+				      const struct ath_common *common,
+				      const char *fmt, ...);
 
 #define _ath_printk(level, common, fmt, ...)			\
 do {								\
-	__always_unused struct ath_common *unused = common;	\
-	ath_printk(level, fmt, ##__VA_ARGS__);			\
+	ath_printk(level, common, fmt, ##__VA_ARGS__);		\
 } while (0)
 
 #define ath_emerg(common, fmt, ...)				\
diff --git a/drivers/net/wireless/ath/main.c b/drivers/net/wireless/ath/main.c
index d9218fe..ea2c737 100644
--- a/drivers/net/wireless/ath/main.c
+++ b/drivers/net/wireless/ath/main.c
@@ -57,7 +57,8 @@ struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
 }
 EXPORT_SYMBOL(ath_rxbuf_alloc);
 
-void ath_printk(const char *level, const char *fmt, ...)
+void ath_printk(const char *level, const struct ath_common* common,
+		const char *fmt, ...)
 {
 	struct va_format vaf;
 	va_list args;
@@ -67,7 +68,11 @@ void ath_printk(const char *level, const char *fmt, ...)
 	vaf.fmt = fmt;
 	vaf.va = &args;
 
-	printk("%sath: %pV", level, &vaf);
+	if (common && common->hw && common->hw->wiphy)
+		printk("%sath: %s: %pV",
+		       level, wiphy_name(common->hw->wiphy), &vaf);
+	else
+		printk("%sath: %pV", level, &vaf);
 
 	va_end(args);
 }
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [ath9k-devel] [PATCH] ath9k:  Add wiphy name to log messages.
  2012-03-08  0:05 ` greearb
@ 2012-03-08  0:54   ` Joe Perches
  -1 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2012-03-08  0:54 UTC (permalink / raw)
  To: ath9k-devel

On Wed, 2012-03-07 at 16:05 -0800, greearb at candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> 
> On systems with multiple NICs, it's nice to know which
> one is producing warnings.  Here is an example of the
> new ouput:
> 
> ath: wiphy0: Failed to stop TX DMA, queues=0x005!

Makes some sense.

> diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
[]
> @@ -174,12 +174,13 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry);
>  void ath_hw_cycle_counters_update(struct ath_common *common);
>  int32_t ath_hw_get_listen_time(struct ath_common *common);
>  
> -extern __printf(2, 3) void ath_printk(const char *level, const char *fmt, ...);
> +extern __printf(3, 4) void ath_printk(const char *level,
> +				      const struct ath_common *common,
> +				      const char *fmt, ...);

Maybe

__printf(3, 4)
void ath_printk(etc...

>  
>  #define _ath_printk(level, common, fmt, ...)			\
>  do {								\
> -	__always_unused struct ath_common *unused = common;	\
> -	ath_printk(level, fmt, ##__VA_ARGS__);			\
> +	ath_printk(level, common, fmt, ##__VA_ARGS__);		\
>  } while (0)
>  
>  #define ath_emerg(common, fmt, ...)				\

It's probably better to remove the _ath_printk
indirection altogether and just use ath_printk
directly in the ath_<level> macros.

> diff --git a/drivers/net/wireless/ath/main.c b/drivers/net/wireless/ath/main.c
[]
> @@ -57,7 +57,8 @@ struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
>  }
>  EXPORT_SYMBOL(ath_rxbuf_alloc);
>  
> -void ath_printk(const char *level, const char *fmt, ...)
> +void ath_printk(const char *level, const struct ath_common* common,
> +		const char *fmt, ...)
>  {
>  	struct va_format vaf;
>  	va_list args;
> @@ -67,7 +68,11 @@ void ath_printk(const char *level, const char *fmt, ...)
>  	vaf.fmt = fmt;
>  	vaf.va = &args;
>  
> -	printk("%sath: %pV", level, &vaf);
> +	if (common && common->hw && common->hw->wiphy)
> +		printk("%sath: %s: %pV",
> +		       level, wiphy_name(common->hw->wiphy), &vaf);
> +	else
> +		printk("%sath: %pV", level, &vaf);
>  
>  	va_end(args);

Maybe it's better to print wiphyX: only when
multiple ath nics exist?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ath9k:  Add wiphy name to log messages.
@ 2012-03-08  0:54   ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2012-03-08  0:54 UTC (permalink / raw)
  To: greearb; +Cc: ath9k-devel, netdev

On Wed, 2012-03-07 at 16:05 -0800, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> 
> On systems with multiple NICs, it's nice to know which
> one is producing warnings.  Here is an example of the
> new ouput:
> 
> ath: wiphy0: Failed to stop TX DMA, queues=0x005!

Makes some sense.

> diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
[]
> @@ -174,12 +174,13 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry);
>  void ath_hw_cycle_counters_update(struct ath_common *common);
>  int32_t ath_hw_get_listen_time(struct ath_common *common);
>  
> -extern __printf(2, 3) void ath_printk(const char *level, const char *fmt, ...);
> +extern __printf(3, 4) void ath_printk(const char *level,
> +				      const struct ath_common *common,
> +				      const char *fmt, ...);

Maybe

__printf(3, 4)
void ath_printk(etc...

>  
>  #define _ath_printk(level, common, fmt, ...)			\
>  do {								\
> -	__always_unused struct ath_common *unused = common;	\
> -	ath_printk(level, fmt, ##__VA_ARGS__);			\
> +	ath_printk(level, common, fmt, ##__VA_ARGS__);		\
>  } while (0)
>  
>  #define ath_emerg(common, fmt, ...)				\

It's probably better to remove the _ath_printk
indirection altogether and just use ath_printk
directly in the ath_<level> macros.

> diff --git a/drivers/net/wireless/ath/main.c b/drivers/net/wireless/ath/main.c
[]
> @@ -57,7 +57,8 @@ struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
>  }
>  EXPORT_SYMBOL(ath_rxbuf_alloc);
>  
> -void ath_printk(const char *level, const char *fmt, ...)
> +void ath_printk(const char *level, const struct ath_common* common,
> +		const char *fmt, ...)
>  {
>  	struct va_format vaf;
>  	va_list args;
> @@ -67,7 +68,11 @@ void ath_printk(const char *level, const char *fmt, ...)
>  	vaf.fmt = fmt;
>  	vaf.va = &args;
>  
> -	printk("%sath: %pV", level, &vaf);
> +	if (common && common->hw && common->hw->wiphy)
> +		printk("%sath: %s: %pV",
> +		       level, wiphy_name(common->hw->wiphy), &vaf);
> +	else
> +		printk("%sath: %pV", level, &vaf);
>  
>  	va_end(args);

Maybe it's better to print wiphyX: only when
multiple ath nics exist?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ath9k-devel] [PATCH] ath9k:  Add wiphy name to log messages.
  2012-03-08  0:54   ` Joe Perches
  (?)
@ 2012-03-08 13:08   ` michael-dev
  2012-03-08 16:43     ` Ben Greear
  -1 siblings, 1 reply; 6+ messages in thread
From: michael-dev @ 2012-03-08 13:08 UTC (permalink / raw)
  To: ath9k-devel

On Wed, 07 Mar 2012 16:54:59 -0800, Joe Perches wrote:
> Maybe it's better to print wiphyX: only when
> multiple ath nics exist?

on the other hand, parsing is simpler if the same kind of error message 
always has the same structure, not depending on the number of nics in 
system.
Further, printing the wiphy id shows that this information was set when 
generating the error message, thus proving more information even if 
there is only one nic.

Regards,
  M. Braun

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ath9k-devel] [PATCH] ath9k:  Add wiphy name to log messages.
  2012-03-08 13:08   ` [ath9k-devel] " michael-dev
@ 2012-03-08 16:43     ` Ben Greear
  0 siblings, 0 replies; 6+ messages in thread
From: Ben Greear @ 2012-03-08 16:43 UTC (permalink / raw)
  To: ath9k-devel

On 03/08/2012 05:08 AM, michael-dev wrote:
> On Wed, 07 Mar 2012 16:54:59 -0800, Joe Perches wrote:
>> Maybe it's better to print wiphyX: only when
>> multiple ath nics exist?
>
> on the other hand, parsing is simpler if the same kind of error message
> always has the same structure, not depending on the number of nics in
> system.
> Further, printing the wiphy id shows that this information was set when
> generating the error message, thus proving more information even if
> there is only one nic.

I also want to leave that part as it is..but I'll make the other changes
that were suggested by Joe.

Thanks,
Ben

>
> Regards,
>    M. Braun
>
> _______________________________________________
> ath9k-devel mailing list
> ath9k-devel at lists.ath9k.org
> https://lists.ath9k.org/mailman/listinfo/ath9k-devel


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-03-08 16:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-08  0:05 [ath9k-devel] [PATCH] ath9k: Add wiphy name to log messages greearb at candelatech.com
2012-03-08  0:05 ` greearb
2012-03-08  0:54 ` [ath9k-devel] " Joe Perches
2012-03-08  0:54   ` Joe Perches
2012-03-08 13:08   ` [ath9k-devel] " michael-dev
2012-03-08 16:43     ` Ben Greear

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.