Compile problem in ath9k with ATH_DBG_WARN_ON_ONCE
Hi,
I got an compile problem in drivers/net/wireless/ath/ath9k/main.c
This is caused by commit ff9f0b639f33c92a89b0799263ab625444be6ee1
ath9k: skip ATH9K_INT_TIM_TIMER when we are idle
and d7fd1b50a51be3fe6554fbab8953fa8a3ff4009b
ath9k: Make DMA warning in ath_stoprecv WARN_ON_ONCE.
If CONFIG_ATH_DEBUG=y is set ATH_DBG_WARN_ON_ONCE uses WARN_ON_ONCE and returns something, but if CONFIG_ATH_DEBUG is not set it does not return anything. Now ATH_DBG_WARN_ON_ONCE is used in the boolean expression in an if case and is not returning anything and causes a compile error.
CC [M] /drivers/net/wireless/ath/ath9k/main.o
/drivers/net/wireless/ath/ath9k/main.c: In function ‘ath_isr’:
/drivers/net/wireless/ath/ath9k/main.c:769: error: expected expression before ‘do’
make[5]: *** [/drivers/net/wireless/ath/ath9k/main.o] Error 1 make[4]: *** [/drivers/net/wireless/ath/ath9k] Error 2
Hauke
PATCH 1/1 ath: fix build break with ATH_DBG_WARN_ON_ONCE
Description by Hauke:
"If CONFIG_ATH_DEBUG=y is set ATH_DBG_WARN_ON_ONCE uses WARN_ON_ONCE and returns something, but if CONFIG_ATH_DEBUG is not set it does not return anything. Now ATH_DBG_WARN_ON_ONCE is used in the boolean expression in an if case and is not returning anything and causes a compile error.
CC [M] /drivers/net/wireless/ath/ath9k/main.o
/drivers/net/wireless/ath/ath9k/main.c: In function ‘ath_isr’:
/drivers/net/wireless/ath/ath9k/main.c:769: error: expected expression before ‘do’
make[5]: *** [/drivers/net/wireless/ath/ath9k/main.o] Error 1 make[4]: *** [/drivers/net/wireless/ath/ath9k] Error 2"
--- drivers/net/wireless/ath/ath.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath.h +1 -1
@@ -272,7 +272,7 @@ ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask,return 0 ; } #define ATH_DBG_WARN(foo, arg...) do {} while (0) -#define ATH_DBG_WARN_ON_ONCE (foo) do {} while (0) +#define ATH_DBG_WARN_ON_ONCE (foo) ({ 0; })#endif /* CONFIG_ATH_DEBUG */
Signature · 1 line
1.7.3.2
Re: [PATCH] ath: fix build break with ATH_DBG_WARN_ON_ONCE
drivers/net/wireless/ath/ath.h ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask, · line 275
Quoted 10 lines · John W. Linville
drivers/net/wireless/ath/ath.h +1
-1@@ -272,7 +272,7 @@ ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask,return 0 ; } #define ATH_DBG_WARN(foo, arg...) do {} while (0) -#define ATH_DBG_WARN_ON_ONCE (foo) do {} while (0) +#define ATH_DBG_WARN_ON_ONCE (foo) ({ 0; })
That'll fix the build error, but wouldn't you need (foo) for correctness instead?
johannes
Re: [PATCH] ath: fix build break with ATH_DBG_WARN_ON_ONCE
Quoted 15 lines · Johannes Berg
drivers/net/wireless/ath/ath.h ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask, · line 275
Quoted 10 lines · John W. Linville
drivers/net/wireless/ath/ath.h +1
-1@@ -272,7 +272,7 @@ ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask,return 0 ; } #define ATH_DBG_WARN(foo, arg...) do {} while (0) -#define ATH_DBG_WARN_ON_ONCE (foo) do {} while (0) +#define ATH_DBG_WARN_ON_ONCE (foo) ({ 0; })That'll fix the build error, but wouldn't you need (foo) for correctness instead?
Well, true -- that was too simple. Unfortunately (foo) gives warnings when the return code is not checked.
John
---
Quoted 1 line
From
b7613370db5ba66ad81e41cd3a5417fde4d5e03cMon Sep 17 00:00:00 2001
From: John W. Linville <[email protected]>
Date: Thu, 9 Dec 2010 09:08:47 -0500
Subject: [PATCH] ath: fix build break with ATH_DBG_WARN_ON_ONCE
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Description by Hauke:
"If CONFIG_ATH_DEBUG=y is set ATH_DBG_WARN_ON_ONCE uses WARN_ON_ONCE and returns something, but if CONFIG_ATH_DEBUG is not set it does not return anything. Now ATH_DBG_WARN_ON_ONCE is used in the boolean expression in an if case and is not returning anything and causes a compile error.
CC [M] /drivers/net/wireless/ath/ath9k/main.o
/drivers/net/wireless/ath/ath9k/main.c: In function ‘ath_isr’:
/drivers/net/wireless/ath/ath9k/main.c:769: error: expected expression before ‘do’
make[5]: *** [/drivers/net/wireless/ath/ath9k/main.o] Error 1 make[4]: *** [/drivers/net/wireless/ath/ath9k] Error 2"
--- drivers/net/wireless/ath/ath.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath.h +4 -1
@@ -272,7 +272,10 @@ ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask,return 0 ; } #define ATH_DBG_WARN(foo, arg...) do {} while (0) -#define ATH_DBG_WARN_ON_ONCE (foo) do {} while (0) +#define ATH_DBG_WARN_ON_ONCE (foo) ({ \ + int __ret_warn_once = !!(foo); \ + unlikely(__ret_warn_once); \ +})#endif /* CONFIG_ATH_DEBUG */
Signature · 5 lines
1.7.3.2 -- John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.