2022-11-16 11:04:20

by Shayne Chen

[permalink] [raw]
Subject: [PATCH] wifi: mt76: mt7996: fix gcc warnings with sparc options

Fix the following warnings:

>> drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:2377:5: warning: no previous prototype for 'mt7996_mcu_restart' [-Wmissing-prototypes]
2377 | int mt7996_mcu_restart(struct mt76_dev *dev)
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/byteorder/big_endian.h:5,
from arch/sparc/include/uapi/asm/byteorder.h:5,
from include/asm-generic/qrwlock_types.h:6,
from arch/sparc/include/asm/spinlock_types.h:17,
from include/linux/spinlock_types_raw.h:7,
from include/linux/ratelimit_types.h:7,
from include/linux/printk.h:9,
from include/asm-generic/bug.h:22,
from arch/sparc/include/asm/bug.h:25,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/preempt.h:5,
from ./arch/sparc/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:56,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/firmware.h:7,
from drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:6:
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c: In function 'mt7996_mcu_set_tx':
>> include/uapi/linux/byteorder/big_endian.h:36:26: warning: conversion from 'short unsigned int' to 'u8' {aka 'unsigned char'} changes value from '2560' to '0' [-Woverflow]
36 | #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
| ^
include/linux/byteorder/generic.h:90:21: note: in expansion of macro '__cpu_to_le16'
90 | #define cpu_to_le16 __cpu_to_le16
| ^~~~~~~~~~~~~
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:2546:37: note: in expansion of macro 'cpu_to_le16'
2546 | e->cw_max = cpu_to_le16(10);
| ^~~~~~~~~~~

Fixes: 23c307666f69 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
---
@Felix, could you please help to fold this patch? Thanks.
---
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
index adc80b9930bd..bf83d0862988 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
@@ -2373,7 +2373,8 @@ mt7996_mcu_init_rx_airtime(struct mt7996_dev *dev)
MCU_WM_UNI_CMD(VOW), true);
}

-int mt7996_mcu_restart(struct mt76_dev *dev)
+static int
+mt7996_mcu_restart(struct mt76_dev *dev)
{
struct {
u8 __rsv1[4];
@@ -2540,10 +2541,11 @@ int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct ieee80211_vif *vif)
e->cw_min = 5;

if (q->cw_max)
- e->cw_max = cpu_to_le16(fls(q->cw_max));
+ e->cw_max = fls(q->cw_max);
else
- e->cw_max = cpu_to_le16(10);
+ e->cw_max = 10;
}
+
return mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_WM_UNI_CMD(EDCA_UPDATE), true);
}
--
2.25.1