diff mbox series

mt76: mt7603: use the correct hweight8() function

Message ID 20190311130953.61869-1-nbd@nbd.name (mailing list archive)
State Accepted
Commit f2a00a821aacfa77985e4dbe83ed064c48a21bd5
Delegated to: Kalle Valo
Headers show
Series mt76: mt7603: use the correct hweight8() function | expand

Commit Message

Felix Fietkau March 11, 2019, 1:09 p.m. UTC
__sw_hweight8() is only defined if CONFIG_GENERIC_HWEIGHT is enabled.
The function that works on all architectures is hweight8().

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt7603/beacon.c | 3 +--
 drivers/net/wireless/mediatek/mt76/mt7603/init.c   | 2 +-
 drivers/net/wireless/mediatek/mt76/mt7603/mcu.c    | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

Comments

Kalle Valo March 11, 2019, 1:17 p.m. UTC | #1
Felix Fietkau <nbd@nbd.name> writes:

> __sw_hweight8() is only defined if CONFIG_GENERIC_HWEIGHT is enabled.
> The function that works on all architectures is hweight8().
>
> Signed-off-by: Felix Fietkau <nbd@nbd.name>

This should go to 5.1, right?
Felix Fietkau March 11, 2019, 1:17 p.m. UTC | #2
On 2019-03-11 14:17, Kalle Valo wrote:
> Felix Fietkau <nbd@nbd.name> writes:
> 
>> __sw_hweight8() is only defined if CONFIG_GENERIC_HWEIGHT is enabled.
>> The function that works on all architectures is hweight8().
>>
>> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> 
> This should go to 5.1, right?
Yes.

- Felix
Kalle Valo March 19, 2019, 3:36 p.m. UTC | #3
Felix Fietkau <nbd@nbd.name> wrote:

> __sw_hweight8() is only defined if CONFIG_GENERIC_HWEIGHT is enabled.
> The function that works on all architectures is hweight8().
> 
> Signed-off-by: Felix Fietkau <nbd@nbd.name>

Patch applied to wireless-drivers.git, thanks.

f2a00a821aac mt76: mt7603: use the correct hweight8() function
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/beacon.c b/drivers/net/wireless/mediatek/mt76/mt7603/beacon.c
index afcd86f735b4..4dcb465095d1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/beacon.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/beacon.c
@@ -135,8 +135,7 @@  void mt7603_pre_tbtt_tasklet(unsigned long arg)
 
 out:
 	mt76_queue_tx_cleanup(dev, MT_TXQ_BEACON, false);
-	if (dev->mt76.q_tx[MT_TXQ_BEACON].queued >
-	    __sw_hweight8(dev->beacon_mask))
+	if (dev->mt76.q_tx[MT_TXQ_BEACON].queued > hweight8(dev->beacon_mask))
 		dev->beacon_check++;
 }
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/init.c b/drivers/net/wireless/mediatek/mt76/mt7603/init.c
index 15cc8f33b34d..d54dda67d036 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/init.c
@@ -112,7 +112,7 @@  static void
 mt7603_phy_init(struct mt7603_dev *dev)
 {
 	int rx_chains = dev->mt76.antenna_mask;
-	int tx_chains = __sw_hweight8(rx_chains) - 1;
+	int tx_chains = hweight8(rx_chains) - 1;
 
 	mt76_rmw(dev, MT_WF_RMAC_RMCR,
 		 (MT_WF_RMAC_RMCR_SMPS_MODE |
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7603/mcu.c
index 4b0713f1fd5e..d06905ea8cc6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/mcu.c
@@ -433,7 +433,7 @@  int mt7603_mcu_set_channel(struct mt7603_dev *dev)
 {
 	struct cfg80211_chan_def *chandef = &dev->mt76.chandef;
 	struct ieee80211_hw *hw = mt76_hw(dev);
-	int n_chains = __sw_hweight8(dev->mt76.antenna_mask);
+	int n_chains = hweight8(dev->mt76.antenna_mask);
 	struct {
 		u8 control_chan;
 		u8 center_chan;