2024-03-19 15:13:26

by Lorenzo Bianconi

[permalink] [raw]
Subject: [PATCH] wifi: mt76: mt7915: workaround too long expansion sparse warnings

Fix the following sparse warnings:

drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion

No functional changes, compile tested only.

Fixes: e3296759f347 ("wifi: mt76: mt7915: enable per bandwidth power limit support")
Signed-off-by: Lorenzo Bianconi <[email protected]>
---
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
index 6c3696c8c700..450f4d221184 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
@@ -1049,6 +1049,7 @@ static ssize_t
mt7915_rate_txpower_set(struct file *file, const char __user *user_buf,
size_t count, loff_t *ppos)
{
+ int i, ret, pwr, pwr160 = 0, pwr80 = 0, pwr40 = 0, pwr20 = 0;
struct mt7915_phy *phy = file->private_data;
struct mt7915_dev *dev = phy->dev;
struct mt76_phy *mphy = phy->mt76;
@@ -1057,7 +1058,6 @@ mt7915_rate_txpower_set(struct file *file, const char __user *user_buf,
.band_idx = phy->mt76->band_idx,
};
char buf[100];
- int i, ret, pwr160 = 0, pwr80 = 0, pwr40 = 0, pwr20 = 0;
enum mac80211_rx_encoding mode;
u32 offs = 0, len = 0;

@@ -1130,8 +1130,8 @@ mt7915_rate_txpower_set(struct file *file, const char __user *user_buf,
if (ret)
goto out;

- mphy->txpower_cur = max(mphy->txpower_cur,
- max(pwr160, max(pwr80, max(pwr40, pwr20))));
+ pwr = max3(pwr80, pwr40, pwr20);
+ mphy->txpower_cur = max3(mphy->txpower_cur, pwr160, pwr);
out:
mutex_unlock(&dev->mt76.mutex);

--
2.44.0



2024-03-19 16:25:46

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] wifi: mt76: mt7915: workaround too long expansion sparse warnings

On Tue, 2024-03-19 at 16:12 +0100, Lorenzo Bianconi wrote:
>
> + pwr = max3(pwr80, pwr40, pwr20);
> + mphy->txpower_cur = max3(mphy->txpower_cur, pwr160, pwr);
>

Oh nice, I didn't know about max3, I had a different patch at some point
to just chain the max() with extra variables :)

johannes

2024-03-20 09:10:17

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] wifi: mt76: mt7915: workaround too long expansion sparse warnings

Lorenzo Bianconi <[email protected]> writes:

> Fix the following sparse warnings:
>
> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
>
> No functional changes, compile tested only.
>
> Fixes: e3296759f347 ("wifi: mt76: mt7915: enable per bandwidth power limit support")
> Signed-off-by: Lorenzo Bianconi <[email protected]>

Thanks Lorenzo! Could I take this directly to wireless-next? We are very
close of being sparse clean in the wireless subsystem, there are just
few warnings left ath drivers.

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

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

2024-03-20 09:14:06

by Lorenzo Bianconi

[permalink] [raw]
Subject: Re: [PATCH] wifi: mt76: mt7915: workaround too long expansion sparse warnings

> Lorenzo Bianconi <[email protected]> writes:
>
> > Fix the following sparse warnings:
> >
> > drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
> > drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
> > drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
> > drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
> >
> > No functional changes, compile tested only.
> >
> > Fixes: e3296759f347 ("wifi: mt76: mt7915: enable per bandwidth power limit support")
> > Signed-off-by: Lorenzo Bianconi <[email protected]>
>
> Thanks Lorenzo! Could I take this directly to wireless-next? We are very
> close of being sparse clean in the wireless subsystem, there are just
> few warnings left ath drivers.

sure, I am fine with it.
@Felix?

Regards,
Lorenzo

>
> --
> https://patchwork.kernel.org/project/linux-wireless/list/
>
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


Attachments:
(No filename) (1.08 kB)
signature.asc (235.00 B)
Download all attachments

2024-03-20 09:49:46

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] wifi: mt76: mt7915: workaround too long expansion sparse warnings

Felix Fietkau <[email protected]> writes:

> On 20.03.24 10:13, Lorenzo Bianconi wrote:
>>> Lorenzo Bianconi <[email protected]> writes:
>>> > Fix the following sparse warnings:
>>> >
>>> > drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29:
>>> > error: too long token expansion
>>> > drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29:
>>> > error: too long token expansion
>>> > drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29:
>>> > error: too long token expansion
>>> > drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29:
>>> > error: too long token expansion
>>> >
>>> > No functional changes, compile tested only.
>>> >
>>> > Fixes: e3296759f347 ("wifi: mt76: mt7915: enable per bandwidth
>>> > power limit support")
>>> > Signed-off-by: Lorenzo Bianconi <[email protected]>
>>> Thanks Lorenzo! Could I take this directly to wireless-next? We are
>>> very
>>> close of being sparse clean in the wireless subsystem, there are just
>>> few warnings left ath drivers.
>> sure, I am fine with it.
>> @Felix?
> Sure.
> Acked-by: Felix Fietkau <[email protected]>

Great, I now assigned this to me in patchwork.

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

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

2024-03-21 15:09:07

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] wifi: mt76: mt7915: workaround too long expansion sparse warnings

Lorenzo Bianconi <[email protected]> wrote:

> Fix the following sparse warnings:
>
> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
>
> No functional changes, compile tested only.
>
> Fixes: e3296759f347 ("wifi: mt76: mt7915: enable per bandwidth power limit support")
> Signed-off-by: Lorenzo Bianconi <[email protected]>
> Acked-by: Felix Fietkau <[email protected]>

Patch applied to wireless-next.git, thanks.

2d5cde1143ec wifi: mt76: mt7915: workaround too long expansion sparse warnings

--
https://patchwork.kernel.org/project/linux-wireless/patch/5457b92e41909dd75ab3db7a0e9ec372b917a386.1710858172.git.lorenzo@kernel.org/

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


2024-03-20 09:19:16

by Felix Fietkau

[permalink] [raw]
Subject: Re: [PATCH] wifi: mt76: mt7915: workaround too long expansion sparse warnings

On 20.03.24 10:13, Lorenzo Bianconi wrote:
>> Lorenzo Bianconi <[email protected]> writes:
>>
>> > Fix the following sparse warnings:
>> >
>> > drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
>> > drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
>> > drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
>> > drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: error: too long token expansion
>> >
>> > No functional changes, compile tested only.
>> >
>> > Fixes: e3296759f347 ("wifi: mt76: mt7915: enable per bandwidth power limit support")
>> > Signed-off-by: Lorenzo Bianconi <[email protected]>
>>
>> Thanks Lorenzo! Could I take this directly to wireless-next? We are very
>> close of being sparse clean in the wireless subsystem, there are just
>> few warnings left ath drivers.
>
> sure, I am fine with it.
> @Felix?
Sure.
Acked-by: Felix Fietkau <[email protected]>

- Felix