> -----Original Message----- > From: Larry Finger <Larry.Finger@xxxxxxxxxxxx> > Sent: Saturday, May 21, 2022 2:45 AM > To: Kalle Valo <kvalo@xxxxxxxxxx> > Cc: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>; linux-wireless@xxxxxxxxxxxxxxx; Larry Finger > <Larry.Finger@xxxxxxxxxxxx>; Pkshih <pkshih@xxxxxxxxxxx> > Subject: [PATCH 1/4] rtw88: Fix Sparse warning for rtw8822b > > Sparse lists the following for rtw88: > > CHECK drivers/net/wireless/realtek/rtw88/rtw8822b.c > drivers/net/wireless/realtek/rtw88/rtw8822b.c:2500:22: warning: symbol 'rtw8822b_hw_spec' was not > declared. Should it be static? > > Signed-off-by: Larry Finger <Larry.Finger@xxxxxxxxxxxx> > --- > drivers/net/wireless/realtek/rtw88/rtw8822b.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c > b/drivers/net/wireless/realtek/rtw88/rtw8822b.c > index dccd722b8e62..60c4e75df035 100644 > --- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c > +++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c > @@ -2497,7 +2497,7 @@ static struct rtw_hw_reg_offset rtw8822b_edcca_th[] = { > [EDCCA_TH_H2L_IDX] = {{.addr = 0x8a4, .mask = MASKBYTE1}, .offset = 0}, > }; > > -struct rtw_chip_info rtw8822b_hw_spec = { > +static struct rtw_chip_info rtw8822b_hw_spec = { As Kalle's recommendation, this should be 'const' > .ops = &rtw8822b_ops, > .id = RTW_CHIP_TYPE_8822B, > .fw_name = "rtw88/rtw8822b_fw.bin", I do grep with 'rtw8822b_hw_spec': rtw8822b.c:struct rtw_chip_info rtw8822b_hw_spec = { rtw8822b.c:EXPORT_SYMBOL(rtw8822b_hw_spec); rtw8822be.c: .driver_data = (kernel_ulong_t)&rtw8822b_hw_spec rtw8822be.h:extern struct rtw_chip_info rtw8822b_hw_spec; Making rtw8822b_hw_spec static can avoid sparse warning, but I worry that it can't be loaded, because it is an "external" symbol and used by rtw8822be.ko. Spuriously, it works. However, I think we should correct them by moving extern prototype to rtw8822b.h and include rtw8822b.h by rtw8822be.c. Ping-Ke