diff options
author | Ryder Lee <ryder.lee@mediatek.com> | 2022-03-09 09:29:24 +0300 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2022-03-14 17:53:26 +0300 |
commit | e49af7036bbc1e76338b7491cc65515e9e3bc92d (patch) | |
tree | 4a1f739162acd1350cc4f3c5f0f2ee4b22cc6dee /mt7603 | |
parent | 31a970940b971b78fa5fc1746a7489b159cd3511 (diff) |
mt76: use le32/16_get_bits() whenever possible
Switch to use le32/16_get_bits() to simplfy codes and specify
the size explicitly to avoid potential issues.
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'mt7603')
-rw-r--r-- | mt7603/dma.c | 2 | ||||
-rw-r--r-- | mt7603/mac.c | 9 |
2 files changed, 4 insertions, 7 deletions
diff --git a/mt7603/dma.c b/mt7603/dma.c index 415ea17b..37b092e3 100644 --- a/mt7603/dma.c +++ b/mt7603/dma.c @@ -76,7 +76,7 @@ void mt7603_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, __le32 *end = (__le32 *)&skb->data[skb->len]; enum rx_pkt_type type; - type = FIELD_GET(MT_RXD0_PKT_TYPE, le32_to_cpu(rxd[0])); + type = le32_get_bits(rxd[0], MT_RXD0_PKT_TYPE); if (q == MT_RXQ_MCU) { if (type == PKT_TYPE_RX_EVENT) diff --git a/mt7603/mac.c b/mt7603/mac.c index 2e5d2661..17713c82 100644 --- a/mt7603/mac.c +++ b/mt7603/mac.c @@ -1130,7 +1130,7 @@ mt7603_fill_txs(struct mt7603_dev *dev, struct mt7603_sta *sta, } rate_set_tsf = READ_ONCE(sta->rate_set_tsf); - rs_idx = !((u32)(FIELD_GET(MT_TXS1_F0_TIMESTAMP, le32_to_cpu(txs_data[1])) - + rs_idx = !((u32)(le32_get_bits(txs_data[1], MT_TXS1_F0_TIMESTAMP) - rate_set_tsf) < 1000000); rs_idx ^= rate_set_tsf & BIT(0); rs = &sta->rateset[rs_idx]; @@ -1244,14 +1244,11 @@ void mt7603_mac_add_txs(struct mt7603_dev *dev, void *data) struct mt7603_sta *msta = NULL; struct mt76_wcid *wcid; __le32 *txs_data = data; - u32 txs; u8 wcidx; u8 pid; - txs = le32_to_cpu(txs_data[4]); - pid = FIELD_GET(MT_TXS4_PID, txs); - txs = le32_to_cpu(txs_data[3]); - wcidx = FIELD_GET(MT_TXS3_WCID, txs); + pid = le32_get_bits(txs_data[4], MT_TXS4_PID); + wcidx = le32_get_bits(txs_data[3], MT_TXS3_WCID); if (pid == MT_PACKET_ID_NO_ACK) return; |