mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: unify channel survey update code
Host time is used to calculate the channel active time on mt7603 and mt7615. Use the same on mt76x02 and move the lock to core code to get rid of some duplicated code. Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
+1
-14
@@ -1571,22 +1571,9 @@ void mt7603_update_channel(struct mt76_dev *mdev)
|
||||
{
|
||||
struct mt7603_dev *dev = container_of(mdev, struct mt7603_dev, mt76);
|
||||
struct mt76_channel_state *state;
|
||||
ktime_t cur_time;
|
||||
u32 busy;
|
||||
|
||||
if (!test_bit(MT76_STATE_RUNNING, &dev->mt76.state))
|
||||
return;
|
||||
|
||||
state = mdev->chan_state;
|
||||
busy = mt76_rr(dev, MT_MIB_STAT_CCA);
|
||||
|
||||
spin_lock_bh(&dev->mt76.cc_lock);
|
||||
cur_time = ktime_get_boottime();
|
||||
state->cc_busy += busy;
|
||||
state->cc_active += ktime_to_us(ktime_sub(cur_time,
|
||||
dev->mt76.survey_time));
|
||||
dev->mt76.survey_time = cur_time;
|
||||
spin_unlock_bh(&dev->mt76.cc_lock);
|
||||
state->cc_busy += mt76_rr(dev, MT_MIB_STAT_CCA);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user