All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-next] net: ath: fix minmax.cocci warnings
@ 2022-05-16 13:40 Guo Zhengkui
  2022-05-16 17:04 ` Kalle Valo
  0 siblings, 1 reply; 7+ messages in thread
From: Guo Zhengkui @ 2022-05-16 13:40 UTC (permalink / raw)
  To: Jiri Slaby, Nick Kossifidis, Luis Chamberlain, Kalle Valo,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Toke Høiland-Jørgensen,
	open list:ATHEROS ATH5K WIRELESS DRIVER,
	open list:NETWORKING DRIVERS, open list
  Cc: zhengkui_guo, Guo Zhengkui

Fix the following coccicheck warnings:

drivers/net/wireless/ath/ath5k/phy.c:3139:62-63: WARNING
opportunity for min()
drivers/net/wireless/ath/ath9k/dfs.c:249:28-30: WARNING
opportunity for max()

Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
---
 drivers/net/wireless/ath/ath5k/phy.c | 2 +-
 drivers/net/wireless/ath/ath9k/dfs.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 00f9e347d414..5797ef9c73d7 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -3136,7 +3136,7 @@ ath5k_combine_pwr_to_pdadc_curves(struct ath5k_hw *ah,
 		pdadc_n = gain_boundaries[pdg] + pd_gain_overlap - pwr_min[pdg];
 		/* Limit it to be inside pwr range */
 		table_size = pwr_max[pdg] - pwr_min[pdg];
-		max_idx = (pdadc_n < table_size) ? pdadc_n : table_size;
+		max_idx = min(pdadc_n, table_size);
 
 		/* Fill pdadc_out table */
 		while (pdadc_0 < max_idx && pdadc_i < 128)
diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c
index acb9602aa464..11349218bc21 100644
--- a/drivers/net/wireless/ath/ath9k/dfs.c
+++ b/drivers/net/wireless/ath/ath9k/dfs.c
@@ -246,7 +246,7 @@ ath9k_postprocess_radar_event(struct ath_softc *sc,
 		DFS_STAT_INC(sc, dc_phy_errors);
 
 		/* when both are present use stronger one */
-		rssi = (ard->rssi < ard->ext_rssi) ? ard->ext_rssi : ard->rssi;
+		rssi = max(ard->rssi, ard->ext_rssi);
 		break;
 	default:
 		/*
-- 
2.20.1


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

* Re: [PATCH linux-next] net: ath: fix minmax.cocci warnings
  2022-05-16 13:40 [PATCH linux-next] net: ath: fix minmax.cocci warnings Guo Zhengkui
@ 2022-05-16 17:04 ` Kalle Valo
  2022-05-17  2:39   ` [PATCH linux-next v2] net: ath5k: replace ternary operator with min() Guo Zhengkui
  2022-05-17  2:41   ` [PATCH linux-next v2] net: ath9k: replace ternary operator with max() Guo Zhengkui
  0 siblings, 2 replies; 7+ messages in thread
From: Kalle Valo @ 2022-05-16 17:04 UTC (permalink / raw)
  To: Guo Zhengkui
  Cc: Jiri Slaby, Nick Kossifidis, Luis Chamberlain, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Toke Høiland-Jørgensen,
	open list:ATHEROS ATH5K WIRELESS DRIVER,
	open list:NETWORKING DRIVERS, open list, zhengkui_guo

Guo Zhengkui <guozhengkui@vivo.com> writes:

> Fix the following coccicheck warnings:
>
> drivers/net/wireless/ath/ath5k/phy.c:3139:62-63: WARNING
> opportunity for min()
> drivers/net/wireless/ath/ath9k/dfs.c:249:28-30: WARNING
> opportunity for max()
>
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> ---
>  drivers/net/wireless/ath/ath5k/phy.c | 2 +-
>  drivers/net/wireless/ath/ath9k/dfs.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Please split this into two patches, one for ath5k and one for ath9k.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* [PATCH linux-next v2] net: ath5k: replace ternary operator with min()
  2022-05-16 17:04 ` Kalle Valo
@ 2022-05-17  2:39   ` Guo Zhengkui
  2022-05-22 12:29     ` Kalle Valo
  2022-05-17  2:41   ` [PATCH linux-next v2] net: ath9k: replace ternary operator with max() Guo Zhengkui
  1 sibling, 1 reply; 7+ messages in thread
From: Guo Zhengkui @ 2022-05-17  2:39 UTC (permalink / raw)
  To: Jiri Slaby, Nick Kossifidis, Luis Chamberlain, Kalle Valo,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	open list:ATHEROS ATH5K WIRELESS DRIVER,
	open list:NETWORKING DRIVERS, open list
  Cc: zhengkui_guo, Guo Zhengkui

Fix the following coccicheck warning:

drivers/net/wireless/ath/ath5k/phy.c:3139:62-63: WARNING
opportunity for min()

Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
---
 drivers/net/wireless/ath/ath5k/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 00f9e347d414..5797ef9c73d7 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -3136,7 +3136,7 @@ ath5k_combine_pwr_to_pdadc_curves(struct ath5k_hw *ah,
 		pdadc_n = gain_boundaries[pdg] + pd_gain_overlap - pwr_min[pdg];
 		/* Limit it to be inside pwr range */
 		table_size = pwr_max[pdg] - pwr_min[pdg];
-		max_idx = (pdadc_n < table_size) ? pdadc_n : table_size;
+		max_idx = min(pdadc_n, table_size);
 
 		/* Fill pdadc_out table */
 		while (pdadc_0 < max_idx && pdadc_i < 128)
-- 
2.20.1


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

* [PATCH linux-next v2] net: ath9k: replace ternary operator with max()
  2022-05-16 17:04 ` Kalle Valo
  2022-05-17  2:39   ` [PATCH linux-next v2] net: ath5k: replace ternary operator with min() Guo Zhengkui
@ 2022-05-17  2:41   ` Guo Zhengkui
  2022-05-17 10:24     ` Toke Høiland-Jørgensen
  2022-05-22 12:31     ` Kalle Valo
  1 sibling, 2 replies; 7+ messages in thread
From: Guo Zhengkui @ 2022-05-17  2:41 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen, Kalle Valo, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	open list:QUALCOMM ATHEROS ATH9K WIRELESS DRIVER,
	open list:NETWORKING DRIVERS, open list
  Cc: zhengkui_guo, Guo Zhengkui

Fix the following coccicheck warning:

drivers/net/wireless/ath/ath9k/dfs.c:249:28-30: WARNING
opportunity for max()

Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
---
 drivers/net/wireless/ath/ath9k/dfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c
index acb9602aa464..11349218bc21 100644
--- a/drivers/net/wireless/ath/ath9k/dfs.c
+++ b/drivers/net/wireless/ath/ath9k/dfs.c
@@ -246,7 +246,7 @@ ath9k_postprocess_radar_event(struct ath_softc *sc,
 		DFS_STAT_INC(sc, dc_phy_errors);
 
 		/* when both are present use stronger one */
-		rssi = (ard->rssi < ard->ext_rssi) ? ard->ext_rssi : ard->rssi;
+		rssi = max(ard->rssi, ard->ext_rssi);
 		break;
 	default:
 		/*
-- 
2.20.1


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

* Re: [PATCH linux-next v2] net: ath9k: replace ternary operator with max()
  2022-05-17  2:41   ` [PATCH linux-next v2] net: ath9k: replace ternary operator with max() Guo Zhengkui
@ 2022-05-17 10:24     ` Toke Høiland-Jørgensen
  2022-05-22 12:31     ` Kalle Valo
  1 sibling, 0 replies; 7+ messages in thread
From: Toke Høiland-Jørgensen @ 2022-05-17 10:24 UTC (permalink / raw)
  To: Guo Zhengkui, Kalle Valo, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni,
	open list:QUALCOMM ATHEROS ATH9K WIRELESS DRIVER,
	open list:NETWORKING DRIVERS, open list
  Cc: zhengkui_guo, Guo Zhengkui

Guo Zhengkui <guozhengkui@vivo.com> writes:

> Fix the following coccicheck warning:
>
> drivers/net/wireless/ath/ath9k/dfs.c:249:28-30: WARNING
> opportunity for max()
>
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>

Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>

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

* Re: [PATCH linux-next v2] net: ath5k: replace ternary operator with min()
  2022-05-17  2:39   ` [PATCH linux-next v2] net: ath5k: replace ternary operator with min() Guo Zhengkui
@ 2022-05-22 12:29     ` Kalle Valo
  0 siblings, 0 replies; 7+ messages in thread
From: Kalle Valo @ 2022-05-22 12:29 UTC (permalink / raw)
  To: Guo Zhengkui
  Cc: Jiri Slaby, Nick Kossifidis, Luis Chamberlain, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	open list:ATHEROS ATH5K WIRELESS DRIVER,
	open list:NETWORKING DRIVERS, open list, zhengkui_guo,
	Guo Zhengkui

Guo Zhengkui <guozhengkui@vivo.com> wrote:

> Fix the following coccicheck warning:
> 
> drivers/net/wireless/ath/ath5k/phy.c:3139:62-63: WARNING
> opportunity for min()
> 
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

b380d2056ebb ath5k: replace ternary operator with min()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20220517023923.76989-1-guozhengkui@vivo.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

* Re: [PATCH linux-next v2] net: ath9k: replace ternary operator with max()
  2022-05-17  2:41   ` [PATCH linux-next v2] net: ath9k: replace ternary operator with max() Guo Zhengkui
  2022-05-17 10:24     ` Toke Høiland-Jørgensen
@ 2022-05-22 12:31     ` Kalle Valo
  1 sibling, 0 replies; 7+ messages in thread
From: Kalle Valo @ 2022-05-22 12:31 UTC (permalink / raw)
  To: Guo Zhengkui
  Cc: Toke Høiland-Jørgensen, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni,
	open list:QUALCOMM ATHEROS ATH9K WIRELESS DRIVER,
	open list:NETWORKING DRIVERS, open list, zhengkui_guo,
	Guo Zhengkui

Guo Zhengkui <guozhengkui@vivo.com> wrote:

> Fix the following coccicheck warning:
> 
> drivers/net/wireless/ath/ath9k/dfs.c:249:28-30: WARNING
> opportunity for max()
> 
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

2be8afe05833 ath9k: replace ternary operator with max()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20220517024106.77050-1-guozhengkui@vivo.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2022-05-22 12:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16 13:40 [PATCH linux-next] net: ath: fix minmax.cocci warnings Guo Zhengkui
2022-05-16 17:04 ` Kalle Valo
2022-05-17  2:39   ` [PATCH linux-next v2] net: ath5k: replace ternary operator with min() Guo Zhengkui
2022-05-22 12:29     ` Kalle Valo
2022-05-17  2:41   ` [PATCH linux-next v2] net: ath9k: replace ternary operator with max() Guo Zhengkui
2022-05-17 10:24     ` Toke Høiland-Jørgensen
2022-05-22 12:31     ` Kalle Valo

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.