All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath9k: fix build error with disabled debug
@ 2014-05-21 10:40 Zefir Kurtisi
  2014-05-22 13:15 ` Kalle Valo
  0 siblings, 1 reply; 5+ messages in thread
From: Zefir Kurtisi @ 2014-05-21 10:40 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, jim.epost, Zefir Kurtisi

DFS pulse interval printing is only available
when CONFIG_ATH9K_DEBUGFS is set.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
---
 drivers/net/wireless/ath/ath9k/dfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c
index 5049bec..e0c740d 100644
--- a/drivers/net/wireless/ath/ath9k/dfs.c
+++ b/drivers/net/wireless/ath/ath9k/dfs.c
@@ -178,12 +178,14 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data,
 	pe.ts = mactime;
 	if (ath9k_postprocess_radar_event(sc, &ard, &pe)) {
 		struct dfs_pattern_detector *pd = sc->dfs_detector;
+#ifdef CONFIG_ATH9K_DEBUGFS
 		ath_dbg(common, DFS,
 			"ath9k_dfs_process_phyerr: channel=%d, ts=%llu, "
 			"width=%d, rssi=%d, delta_ts=%llu\n",
 			pe.freq, pe.ts, pe.width, pe.rssi,
 			pe.ts - sc->debug.stats.dfs_stats.last_ts);
 		sc->debug.stats.dfs_stats.last_ts = pe.ts;
+#endif
 		DFS_STAT_INC(sc, pulses_processed);
 		if (pd != NULL && pd->add_pulse(pd, &pe)) {
 			DFS_STAT_INC(sc, radar_detected);
-- 
1.9.1


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

* Re: [PATCH] ath9k: fix build error with disabled debug
  2014-05-21 10:40 [PATCH] ath9k: fix build error with disabled debug Zefir Kurtisi
@ 2014-05-22 13:15 ` Kalle Valo
  2014-05-23  8:15   ` Zefir Kurtisi
  0 siblings, 1 reply; 5+ messages in thread
From: Kalle Valo @ 2014-05-22 13:15 UTC (permalink / raw)
  To: Zefir Kurtisi; +Cc: linville, linux-wireless, jim.epost

Zefir Kurtisi <zefir.kurtisi@neratec.com> writes:

> DFS pulse interval printing is only available
> when CONFIG_ATH9K_DEBUGFS is set.
>
> Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>

[...]

> --- a/drivers/net/wireless/ath/ath9k/dfs.c
> +++ b/drivers/net/wireless/ath/ath9k/dfs.c
> @@ -178,12 +178,14 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data,
>  	pe.ts = mactime;
>  	if (ath9k_postprocess_radar_event(sc, &ard, &pe)) {
>  		struct dfs_pattern_detector *pd = sc->dfs_detector;
> +#ifdef CONFIG_ATH9K_DEBUGFS

IMHO config_enabled() is much nicer than ifdef.

-- 
Kalle Valo

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

* Re: [PATCH] ath9k: fix build error with disabled debug
  2014-05-22 13:15 ` Kalle Valo
@ 2014-05-23  8:15   ` Zefir Kurtisi
  2014-05-23 14:40     ` John W. Linville
  0 siblings, 1 reply; 5+ messages in thread
From: Zefir Kurtisi @ 2014-05-23  8:15 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linville, linux-wireless, jim.epost

On 05/22/2014 03:15 PM, Kalle Valo wrote:
> Zefir Kurtisi <zefir.kurtisi@neratec.com> writes:
> 
>> DFS pulse interval printing is only available
>> when CONFIG_ATH9K_DEBUGFS is set.
>>
>> Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
> 
> [...]
> 
>> --- a/drivers/net/wireless/ath/ath9k/dfs.c
>> +++ b/drivers/net/wireless/ath/ath9k/dfs.c
>> @@ -178,12 +178,14 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data,
>>  	pe.ts = mactime;
>>  	if (ath9k_postprocess_radar_event(sc, &ard, &pe)) {
>>  		struct dfs_pattern_detector *pd = sc->dfs_detector;
>> +#ifdef CONFIG_ATH9K_DEBUGFS
> 
> IMHO config_enabled() is much nicer than ifdef.
> 

Actually, I dislike both of them.

While this is for debug printing only, it is still a bad idea to use variables in
debugfs dependent space and splatter source code with required checks. I'll move
that into a different context and post a follow-up patch.


John, please drop this one.

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

* Re: [PATCH] ath9k: fix build error with disabled debug
  2014-05-23  8:15   ` Zefir Kurtisi
@ 2014-05-23 14:40     ` John W. Linville
  2014-05-23 15:22       ` [PATCH] ath9k: simplify DFS pulse interval debug printing Zefir Kurtisi
  0 siblings, 1 reply; 5+ messages in thread
From: John W. Linville @ 2014-05-23 14:40 UTC (permalink / raw)
  To: Zefir Kurtisi; +Cc: Kalle Valo, linux-wireless, jim.epost

On Fri, May 23, 2014 at 10:15:08AM +0200, Zefir Kurtisi wrote:
> On 05/22/2014 03:15 PM, Kalle Valo wrote:
> > Zefir Kurtisi <zefir.kurtisi@neratec.com> writes:
> > 
> >> DFS pulse interval printing is only available
> >> when CONFIG_ATH9K_DEBUGFS is set.
> >>
> >> Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
> > 
> > [...]
> > 
> >> --- a/drivers/net/wireless/ath/ath9k/dfs.c
> >> +++ b/drivers/net/wireless/ath/ath9k/dfs.c
> >> @@ -178,12 +178,14 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data,
> >>  	pe.ts = mactime;
> >>  	if (ath9k_postprocess_radar_event(sc, &ard, &pe)) {
> >>  		struct dfs_pattern_detector *pd = sc->dfs_detector;
> >> +#ifdef CONFIG_ATH9K_DEBUGFS
> > 
> > IMHO config_enabled() is much nicer than ifdef.
> > 
> 
> Actually, I dislike both of them.
> 
> While this is for debug printing only, it is still a bad idea to use variables in
> debugfs dependent space and splatter source code with required checks. I'll move
> that into a different context and post a follow-up patch.
> 
> 
> John, please drop this one.

Actually, I merged it yesterday.  Please submit your follow-up patch
on top of this one.

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

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

* [PATCH] ath9k: simplify DFS pulse interval debug printing
  2014-05-23 14:40     ` John W. Linville
@ 2014-05-23 15:22       ` Zefir Kurtisi
  0 siblings, 0 replies; 5+ messages in thread
From: Zefir Kurtisi @ 2014-05-23 15:22 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, kvalo, jim.epost, Zefir Kurtisi

Make DFS pulse interval calculation independent
from CONFIG_ATH9K_DEBUGFS.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
---
 drivers/net/wireless/ath/ath9k/ath9k.h     | 1 +
 drivers/net/wireless/ath/ath9k/dfs.c       | 6 ++----
 drivers/net/wireless/ath/ath9k/dfs_debug.h | 1 -
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index b204694..2ca8f7e 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -770,6 +770,7 @@ struct ath_softc {
 	struct ath_ant_comb ant_comb;
 	u8 ant_tx, ant_rx;
 	struct dfs_pattern_detector *dfs_detector;
+	u64 dfs_prev_pulse_ts;
 	u32 wow_enabled;
 	/* relay(fs) channel for spectral scan */
 	struct rchan *rfs_chan_spec_scan;
diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c
index e0c740d..726271c 100644
--- a/drivers/net/wireless/ath/ath9k/dfs.c
+++ b/drivers/net/wireless/ath/ath9k/dfs.c
@@ -178,14 +178,12 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data,
 	pe.ts = mactime;
 	if (ath9k_postprocess_radar_event(sc, &ard, &pe)) {
 		struct dfs_pattern_detector *pd = sc->dfs_detector;
-#ifdef CONFIG_ATH9K_DEBUGFS
 		ath_dbg(common, DFS,
 			"ath9k_dfs_process_phyerr: channel=%d, ts=%llu, "
 			"width=%d, rssi=%d, delta_ts=%llu\n",
 			pe.freq, pe.ts, pe.width, pe.rssi,
-			pe.ts - sc->debug.stats.dfs_stats.last_ts);
-		sc->debug.stats.dfs_stats.last_ts = pe.ts;
-#endif
+			pe.ts - sc->dfs_prev_pulse_ts);
+		sc->dfs_prev_pulse_ts = pe.ts;
 		DFS_STAT_INC(sc, pulses_processed);
 		if (pd != NULL && pd->add_pulse(pd, &pe)) {
 			DFS_STAT_INC(sc, radar_detected);
diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.h b/drivers/net/wireless/ath/ath9k/dfs_debug.h
index d948686..7936c91 100644
--- a/drivers/net/wireless/ath/ath9k/dfs_debug.h
+++ b/drivers/net/wireless/ath/ath9k/dfs_debug.h
@@ -51,7 +51,6 @@ struct ath_dfs_stats {
 	/* pattern detection stats */
 	u32 pulses_processed;
 	u32 radar_detected;
-	u64 last_ts;
 };
 
 #if defined(CONFIG_ATH9K_DFS_DEBUGFS)
-- 
1.9.1


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

end of thread, other threads:[~2014-05-23 15:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-21 10:40 [PATCH] ath9k: fix build error with disabled debug Zefir Kurtisi
2014-05-22 13:15 ` Kalle Valo
2014-05-23  8:15   ` Zefir Kurtisi
2014-05-23 14:40     ` John W. Linville
2014-05-23 15:22       ` [PATCH] ath9k: simplify DFS pulse interval debug printing Zefir Kurtisi

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.