diff mbox series

[1/2] wifi: mt76: mt7996: fix endianness of MT_TXD6_TX_RATE

Message ID 16fa938373e3b145cb07a2c98d2428fea2abadba.1682285873.git.ryder.lee@mediatek.com
State New
Headers show
Series [1/2] wifi: mt76: mt7996: fix endianness of MT_TXD6_TX_RATE | expand

Commit Message

Ryder Lee April 23, 2023, 9:39 p.m. UTC
To avoid sparse warning:
sparse: warning: invalid assignment: |=
sparse:    left side has type restricted __le32
sparse:    right side has type unsigned lon

Fixes: 15ee62e73705 ("wifi: mt76: mt7996: enable BSS_CHANGED_BASIC_RATES support")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kalle Valo April 28, 2023, 5:03 a.m. UTC | #1
Ryder Lee <ryder.lee@mediatek.com> writes:

> To avoid sparse warning:
> sparse: warning: invalid assignment: |=
> sparse:    left side has type restricted __le32
> sparse:    right side has type unsigned lon
>
> Fixes: 15ee62e73705 ("wifi: mt76: mt7996: enable BSS_CHANGED_BASIC_RATES support")
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>

I guess this is the fix for Jakub's report? I should take it to wireless
then?

What about patch 2, should I also take it to wireless? Felix, ack?
Johannes Berg April 28, 2023, 8:56 a.m. UTC | #2
On Mon, 2023-04-24 at 05:39 +0800, Ryder Lee wrote:
> To avoid sparse warning:
> sparse: warning: invalid assignment: |=
> sparse:    left side has type restricted __le32
> sparse:    right side has type unsigned lon
> 
> Fixes: 15ee62e73705 ("wifi: mt76: mt7996: enable BSS_CHANGED_BASIC_RATES support")
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> index 130eb7b4fd91..39a4a73ef8e6 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> @@ -1088,7 +1088,7 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
>  		else if (beacon && mvif->beacon_rates_idx)
>  			idx = mvif->beacon_rates_idx;
>  
> -		txwi[6] |= FIELD_PREP(MT_TXD6_TX_RATE, idx);
> +		txwi[6] |= cpu_to_le32(FIELD_PREP(MT_TXD6_TX_RATE, idx));

Btw, and no need to change anything as far as I'm concerned, but just in
case you weren't familiar with it; that kind of thing might be nicer as
le32_encode_bits(), i.e.

	txwi[6] |= le32_encode_bits(idx, MT_TXD6_TX_RATE);

Personally, I also generally prefer the typed lower-case versions over
FIELD_GET/PREP etc. but YMMV.

johannes
Ryder Lee May 6, 2023, 7:13 a.m. UTC | #3
On Fri, 2023-04-28 at 08:03 +0300, Kalle Valo wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> Ryder Lee <ryder.lee@mediatek.com> writes:
> 
> > To avoid sparse warning:
> > sparse: warning: invalid assignment: |=
> > sparse:    left side has type restricted __le32
> > sparse:    right side has type unsigned lon
> > 
> > Fixes: 15ee62e73705 ("wifi: mt76: mt7996: enable
> > BSS_CHANGED_BASIC_RATES support")
> > Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> 
> I guess this is the fix for Jakub's report? I should take it to
> wireless
> then?

Yes, this is for that sparse fixup. You can take it.

Ryder

> What about patch 2, should I also take it to wireless? Felix, ack?
>
Kalle Valo May 12, 2023, 8:21 a.m. UTC | #4
Ryder Lee <ryder.lee@mediatek.com> wrote:

> To avoid sparse warning:
> sparse: warning: invalid assignment: |=
> sparse:    left side has type restricted __le32
> sparse:    right side has type unsigned lon
> 
> Fixes: 15ee62e73705 ("wifi: mt76: mt7996: enable BSS_CHANGED_BASIC_RATES support")
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>

2 patches applied to wireless.git, thanks.

cdc26ee89bdd wifi: mt76: mt7996: fix endianness of MT_TXD6_TX_RATE
c7ab7a29ef5c wifi: mt76: connac: fix stats->tx_bytes calculation
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
index 130eb7b4fd91..39a4a73ef8e6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
@@ -1088,7 +1088,7 @@  void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
 		else if (beacon && mvif->beacon_rates_idx)
 			idx = mvif->beacon_rates_idx;
 
-		txwi[6] |= FIELD_PREP(MT_TXD6_TX_RATE, idx);
+		txwi[6] |= cpu_to_le32(FIELD_PREP(MT_TXD6_TX_RATE, idx));
 		txwi[3] |= cpu_to_le32(MT_TXD3_BA_DISABLE);
 	}
 }