diff options
author | Lorenzo Bianconi <lorenzo.bianconi@redhat.com> | 2018-06-29 13:40:52 +0200 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2018-07-04 18:15:57 +0300 |
commit | ee8aa945e4ae94f2928ef1c2af340a655f16dfcc (patch) | |
tree | e8d333e3522a12db26ac6edb77fefd15fc06650d /drivers/net/wireless/mediatek/mt76 | |
parent | f9cbaeb52930342059429f56d0b9f05c8d54c0ba (diff) | |
download | linux-stable-ee8aa945e4ae94f2928ef1c2af340a655f16dfcc.tar.gz linux-stable-ee8aa945e4ae94f2928ef1c2af340a655f16dfcc.tar.bz2 linux-stable-ee8aa945e4ae94f2928ef1c2af340a655f16dfcc.zip |
mt76: introduce mt76_{incr,decr} utility routines
Add mt76_{incr,decr} utility routines to increment/decrement a value
with wrap-around (they will be used by mt76x2 DFS sw detector)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt76.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index d2166fbf50ff..96e9798bb8a0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -390,6 +390,18 @@ struct dentry *mt76_register_debugfs(struct mt76_dev *dev); int mt76_eeprom_init(struct mt76_dev *dev, int len); void mt76_eeprom_override(struct mt76_dev *dev); +/* increment with wrap-around */ +static inline int mt76_incr(int val, int size) +{ + return (val + 1) & (size - 1); +} + +/* decrement with wrap-around */ +static inline int mt76_decr(int val, int size) +{ + return (val - 1) & (size - 1); +} + static inline struct ieee80211_txq * mtxq_to_txq(struct mt76_txq *mtxq) { |