hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
....@@ -1,20 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
34 Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
45 <http://rt2x00.serialmonkey.com>
56
6
- This program is free software; you can redistribute it and/or modify
7
- it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation; either version 2 of the License, or
9
- (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with this program; if not, see <http://www.gnu.org/licenses/>.
187 */
198
209 /*
....@@ -382,9 +371,6 @@
382371 IEEE80211_TX_CTL_AMPDU;
383372 tx_info->status.ampdu_len = 1;
384373 tx_info->status.ampdu_ack_len = success ? 1 : 0;
385
-
386
- if (!success)
387
- tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
388374 }
389375
390376 if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
....@@ -1007,7 +993,7 @@
1007993 const char *mac_addr;
1008994
1009995 mac_addr = of_get_mac_address(rt2x00dev->dev->of_node);
1010
- if (mac_addr)
996
+ if (!IS_ERR(mac_addr))
1011997 ether_addr_copy(eeprom_mac_addr, mac_addr);
1012998
1013999 if (!is_valid_ether_addr(eeprom_mac_addr)) {
....@@ -1181,9 +1167,8 @@
11811167 */
11821168 #define RT2X00_TASKLET_INIT(taskletname) \
11831169 if (rt2x00dev->ops->lib->taskletname) { \
1184
- tasklet_init(&rt2x00dev->taskletname, \
1185
- rt2x00dev->ops->lib->taskletname, \
1186
- (unsigned long)rt2x00dev); \
1170
+ tasklet_setup(&rt2x00dev->taskletname, \
1171
+ rt2x00dev->ops->lib->taskletname); \
11871172 }
11881173
11891174 RT2X00_TASKLET_INIT(txstatus_tasklet);
....@@ -1267,10 +1252,7 @@
12671252
12681253 int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
12691254 {
1270
- int retval;
1271
-
1272
- if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags))
1273
- return 0;
1255
+ int retval = 0;
12741256
12751257 /*
12761258 * If this is the first interface which is added,
....@@ -1278,14 +1260,14 @@
12781260 */
12791261 retval = rt2x00lib_load_firmware(rt2x00dev);
12801262 if (retval)
1281
- return retval;
1263
+ goto out;
12821264
12831265 /*
12841266 * Initialize the device.
12851267 */
12861268 retval = rt2x00lib_initialize(rt2x00dev);
12871269 if (retval)
1288
- return retval;
1270
+ goto out;
12891271
12901272 rt2x00dev->intf_ap_count = 0;
12911273 rt2x00dev->intf_sta_count = 0;
....@@ -1294,11 +1276,12 @@
12941276 /* Enable the radio */
12951277 retval = rt2x00lib_enable_radio(rt2x00dev);
12961278 if (retval)
1297
- return retval;
1279
+ goto out;
12981280
12991281 set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags);
13001282
1301
- return 0;
1283
+out:
1284
+ return retval;
13021285 }
13031286
13041287 void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev)
....@@ -1391,6 +1374,8 @@
13911374 mutex_init(&rt2x00dev->conf_mutex);
13921375 INIT_LIST_HEAD(&rt2x00dev->bar_list);
13931376 spin_lock_init(&rt2x00dev->bar_list_lock);
1377
+ hrtimer_init(&rt2x00dev->txstatus_timer, CLOCK_MONOTONIC,
1378
+ HRTIMER_MODE_REL);
13941379
13951380 set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
13961381
....@@ -1515,6 +1500,8 @@
15151500 cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
15161501 cancel_work_sync(&rt2x00dev->sleep_work);
15171502
1503
+ hrtimer_cancel(&rt2x00dev->txstatus_timer);
1504
+
15181505 /*
15191506 * Kill the tx status tasklet.
15201507 */
....@@ -1568,8 +1555,7 @@
15681555 /*
15691556 * Device state handlers
15701557 */
1571
-#ifdef CONFIG_PM
1572
-int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state)
1558
+int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev)
15731559 {
15741560 rt2x00_dbg(rt2x00dev, "Going to sleep\n");
15751561
....@@ -1626,7 +1612,6 @@
16261612 return 0;
16271613 }
16281614 EXPORT_SYMBOL_GPL(rt2x00lib_resume);
1629
-#endif /* CONFIG_PM */
16301615
16311616 /*
16321617 * rt2x00lib module information.