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

Johannes Berg johannes at sipsolutions.net
Fri Apr 28 01:56:19 PDT 2023


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 at 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



More information about the Linux-mediatek mailing list