linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] wifi: mt76: mt7915: workaround dubious x | !y warning
@ 2024-03-25 15:58 Kalle Valo
  2024-03-25 17:22 ` Kalle Valo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kalle Valo @ 2024-03-25 15:58 UTC (permalink / raw)
  To: nbd, lorenzo.bianconi; +Cc: linux-wireless

Sparse warns:

drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:526:9: warning: dubious: x | !y

Workaround it by using the '?' operator. Compile tested only.

Signed-off-by: Kalle Valo <kvalo@kernel.org>
---
v2:

* use parenthesis

 drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
index 450f4d221184..578013884e43 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
@@ -523,7 +523,8 @@ mt7915_fw_debug_wm_set(void *data, u64 val)
 
 	/* WM CPU info record control */
 	mt76_clear(dev, MT_CPU_UTIL_CTRL, BIT(0));
-	mt76_wr(dev, MT_DIC_CMD_REG_CMD, BIT(2) | BIT(13) | !dev->fw.debug_wm);
+	mt76_wr(dev, MT_DIC_CMD_REG_CMD, BIT(2) | BIT(13) |
+		(dev->fw.debug_wm ? 0 : BIT(0)));
 	mt76_wr(dev, MT_MCU_WM_CIRQ_IRQ_MASK_CLR_ADDR, BIT(5));
 	mt76_wr(dev, MT_MCU_WM_CIRQ_IRQ_SOFT_ADDR, BIT(5));
 
-- 
2.39.2


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

* Re: [PATCH v2] wifi: mt76: mt7915: workaround dubious x | !y warning
  2024-03-25 15:58 [PATCH v2] wifi: mt76: mt7915: workaround dubious x | !y warning Kalle Valo
@ 2024-03-25 17:22 ` Kalle Valo
  2024-03-27 14:38 ` Lorenzo Bianconi
  2024-03-28 13:08 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2024-03-25 17:22 UTC (permalink / raw)
  To: nbd; +Cc: lorenzo.bianconi, linux-wireless

Kalle Valo <kvalo@kernel.org> writes:

> Sparse warns:
>
> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:526:9: warning: dubious: x | !y
>
> Workaround it by using the '?' operator. Compile tested only.
>
> Signed-off-by: Kalle Valo <kvalo@kernel.org>
> ---
> v2:
>
> * use parenthesis

Felix&Lorenzo, if this looks ok to you I would like to take this
directly to wireless-next. I'm aiming that the next wireless-next pull
request is sparse warning free :)

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

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

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

* Re: [PATCH v2] wifi: mt76: mt7915: workaround dubious x | !y warning
  2024-03-25 15:58 [PATCH v2] wifi: mt76: mt7915: workaround dubious x | !y warning Kalle Valo
  2024-03-25 17:22 ` Kalle Valo
@ 2024-03-27 14:38 ` Lorenzo Bianconi
  2024-03-28 13:08 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2024-03-27 14:38 UTC (permalink / raw)
  To: Kalle Valo; +Cc: nbd, lorenzo.bianconi, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1211 bytes --]

> Sparse warns:
> 
> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:526:9: warning: dubious: x | !y
> 
> Workaround it by using the '?' operator. Compile tested only.

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>

> 
> Signed-off-by: Kalle Valo <kvalo@kernel.org>
> ---
> v2:
> 
> * use parenthesis
> 
>  drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
> index 450f4d221184..578013884e43 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
> @@ -523,7 +523,8 @@ mt7915_fw_debug_wm_set(void *data, u64 val)
>  
>  	/* WM CPU info record control */
>  	mt76_clear(dev, MT_CPU_UTIL_CTRL, BIT(0));
> -	mt76_wr(dev, MT_DIC_CMD_REG_CMD, BIT(2) | BIT(13) | !dev->fw.debug_wm);
> +	mt76_wr(dev, MT_DIC_CMD_REG_CMD, BIT(2) | BIT(13) |
> +		(dev->fw.debug_wm ? 0 : BIT(0)));
>  	mt76_wr(dev, MT_MCU_WM_CIRQ_IRQ_MASK_CLR_ADDR, BIT(5));
>  	mt76_wr(dev, MT_MCU_WM_CIRQ_IRQ_SOFT_ADDR, BIT(5));
>  
> -- 
> 2.39.2
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v2] wifi: mt76: mt7915: workaround dubious x | !y warning
  2024-03-25 15:58 [PATCH v2] wifi: mt76: mt7915: workaround dubious x | !y warning Kalle Valo
  2024-03-25 17:22 ` Kalle Valo
  2024-03-27 14:38 ` Lorenzo Bianconi
@ 2024-03-28 13:08 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2024-03-28 13:08 UTC (permalink / raw)
  To: Kalle Valo; +Cc: nbd, lorenzo.bianconi, linux-wireless

Kalle Valo <kvalo@kernel.org> wrote:

> Sparse warns:
> 
> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:526:9: warning: dubious: x | !y
> 
> Workaround it by using the '?' operator. Compile tested only.
> 
> Signed-off-by: Kalle Valo <kvalo@kernel.org>
> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>

Patch applied to wireless-next.git, thanks.

b68b2beadfd3 wifi: mt76: mt7915: workaround dubious x | !y warning

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20240325155838.1558680-1-kvalo@kernel.org/

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


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

end of thread, other threads:[~2024-03-28 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-25 15:58 [PATCH v2] wifi: mt76: mt7915: workaround dubious x | !y warning Kalle Valo
2024-03-25 17:22 ` Kalle Valo
2024-03-27 14:38 ` Lorenzo Bianconi
2024-03-28 13:08 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).