@@ -133,30 +133,24 @@ void mt7603_init_edcca(struct mt7603_dev *dev)
133133 mt7603_edcca_set_strict (dev , false);
134134}
135135
136- static int
137- mt7603_set_channel (struct ieee80211_hw * hw , struct cfg80211_chan_def * def )
136+ int mt7603_set_channel (struct mt76_phy * mphy )
138137{
139- struct mt7603_dev * dev = hw -> priv ;
138+ struct mt7603_dev * dev = container_of (mphy -> dev , struct mt7603_dev , mt76 );
139+ struct cfg80211_chan_def * def = & mphy -> chandef ;
140+
140141 u8 * rssi_data = (u8 * )dev -> mt76 .eeprom .data ;
141142 int idx , ret ;
142143 u8 bw = MT_BW_20 ;
143144 bool failed = false;
144145
145- ieee80211_stop_queues (hw );
146- cancel_delayed_work_sync (& dev -> mphy .mac_work );
147146 tasklet_disable (& dev -> mt76 .pre_tbtt_tasklet );
148147
149- mutex_lock (& dev -> mt76 .mutex );
150- set_bit (MT76_RESET , & dev -> mphy .state );
151-
152148 mt7603_beacon_set_timer (dev , -1 , 0 );
153- mt76_set_channel (& dev -> mphy );
154149 mt7603_mac_stop (dev );
155150
156151 if (def -> width == NL80211_CHAN_WIDTH_40 )
157152 bw = MT_BW_40 ;
158153
159- dev -> mphy .chandef = * def ;
160154 mt76_rmw_field (dev , MT_AGG_BWCR , MT_AGG_BWCR_BW , bw );
161155 ret = mt7603_mcu_set_channel (dev );
162156 if (ret ) {
@@ -180,10 +174,6 @@ mt7603_set_channel(struct ieee80211_hw *hw, struct cfg80211_chan_def *def)
180174 mt7603_mac_set_timing (dev );
181175 mt7603_mac_start (dev );
182176
183- clear_bit (MT76_RESET , & dev -> mphy .state );
184-
185- mt76_txq_schedule_all (& dev -> mphy );
186-
187177 ieee80211_queue_delayed_work (mt76_hw (dev ), & dev -> mphy .mac_work ,
188178 msecs_to_jiffies (MT7603_WATCHDOG_TIME ));
189179
@@ -199,17 +189,14 @@ mt7603_set_channel(struct ieee80211_hw *hw, struct cfg80211_chan_def *def)
199189 mt7603_init_edcca (dev );
200190
201191out :
202- if (!( mt76_hw ( dev ) -> conf . flags & IEEE80211_CONF_OFFCHANNEL ) )
192+ if (!mphy -> offchannel )
203193 mt7603_beacon_set_timer (dev , -1 , dev -> mt76 .beacon_int );
204- mutex_unlock (& dev -> mt76 .mutex );
205194
206195 tasklet_enable (& dev -> mt76 .pre_tbtt_tasklet );
207196
208197 if (failed )
209198 mt7603_mac_work (& dev -> mphy .mac_work .work );
210199
211- ieee80211_wake_queues (hw );
212-
213200 return ret ;
214201}
215202
@@ -227,7 +214,7 @@ static int mt7603_set_sar_specs(struct ieee80211_hw *hw,
227214 if (err )
228215 return err ;
229216
230- return mt7603_set_channel ( hw , & mphy -> chandef );
217+ return mt76_update_channel ( mphy );
231218}
232219
233220static int
@@ -238,7 +225,7 @@ mt7603_config(struct ieee80211_hw *hw, u32 changed)
238225
239226 if (changed & (IEEE80211_CONF_CHANGE_CHANNEL |
240227 IEEE80211_CONF_CHANGE_POWER ))
241- ret = mt7603_set_channel ( hw , & hw -> conf . chandef );
228+ ret = mt76_update_channel ( & dev -> mphy );
242229
243230 if (changed & IEEE80211_CONF_CHANGE_MONITOR ) {
244231 mutex_lock (& dev -> mt76 .mutex );
0 commit comments