hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/drivers/net/wireless/broadcom/b43/main.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23
34 Broadcom B43 wireless driver
....@@ -15,20 +16,6 @@
1516 Some parts of the code in this file are derived from the ipw2200
1617 driver Copyright(c) 2003 - 2004 Intel Corporation.
1718
18
- This program is free software; you can redistribute it and/or modify
19
- it under the terms of the GNU General Public License as published by
20
- the Free Software Foundation; either version 2 of the License, or
21
- (at your option) any later version.
22
-
23
- This program is distributed in the hope that it will be useful,
24
- but WITHOUT ANY WARRANTY; without even the implied warranty of
25
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
- GNU General Public License for more details.
27
-
28
- You should have received a copy of the GNU General Public License
29
- along with this program; see the file COPYING. If not, write to
30
- the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
31
- Boston, MA 02110-1301, USA.
3219
3320 */
3421
....@@ -485,7 +472,6 @@
485472 val = swab32(val);
486473
487474 b43_write32(dev, B43_MMIO_RAM_CONTROL, offset);
488
- mmiowb();
489475 b43_write32(dev, B43_MMIO_RAM_DATA, val);
490476 }
491477
....@@ -656,9 +642,7 @@
656642 /* The hardware guarantees us an atomic write, if we
657643 * write the low register first. */
658644 b43_write32(dev, B43_MMIO_REV3PLUS_TSF_LOW, low);
659
- mmiowb();
660645 b43_write32(dev, B43_MMIO_REV3PLUS_TSF_HIGH, high);
661
- mmiowb();
662646 }
663647
664648 void b43_tsf_write(struct b43_wldev *dev, u64 tsf)
....@@ -750,7 +734,7 @@
750734 }
751735
752736 /* DummyTransmission function, as documented on
753
- * http://bcm-v4.sipsolutions.net/802.11/DummyTransmission
737
+ * https://bcm-v4.sipsolutions.net/802.11/DummyTransmission
754738 */
755739 void b43_dummy_transmission(struct b43_wldev *dev, bool ofdm, bool pa_on)
756740 {
....@@ -797,8 +781,9 @@
797781 b43_write16(dev, B43_MMIO_XMTSEL, 0x0826);
798782 b43_write16(dev, B43_MMIO_TXE0_CTL, 0x0000);
799783
800
- if (!pa_on && phy->type == B43_PHYTYPE_N)
784
+ if (!pa_on && phy->type == B43_PHYTYPE_N) {
801785 ; /*b43_nphy_pa_override(dev, false) */
786
+ }
802787
803788 switch (phy->type) {
804789 case B43_PHYTYPE_N:
....@@ -1214,7 +1199,7 @@
12141199 }
12151200 }
12161201
1217
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacCorePllReset */
1202
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/BmacCorePllReset */
12181203 void b43_wireless_core_phy_pll_reset(struct b43_wldev *dev)
12191204 {
12201205 struct bcma_drv_cc *bcma_cc __maybe_unused;
....@@ -1822,11 +1807,9 @@
18221807 if (b43_bus_host_is_sdio(dev->dev)) {
18231808 /* wl->mutex is enough. */
18241809 b43_do_beacon_update_trigger_work(dev);
1825
- mmiowb();
18261810 } else {
18271811 spin_lock_irq(&wl->hardirq_lock);
18281812 b43_do_beacon_update_trigger_work(dev);
1829
- mmiowb();
18301813 spin_unlock_irq(&wl->hardirq_lock);
18311814 }
18321815 }
....@@ -1891,7 +1874,7 @@
18911874 switch (reason) {
18921875 default:
18931876 b43dbg(dev->wl, "The panic reason is unknown.\n");
1894
- /* fallthrough */
1877
+ fallthrough;
18951878 case B43_FWPANIC_DIE:
18961879 /* Do not restart the controller or firmware.
18971880 * The device is nonfunctional from now on.
....@@ -2031,8 +2014,9 @@
20312014 handle_irq_beacon(dev);
20322015 if (reason & B43_IRQ_PMQ)
20332016 handle_irq_pmq(dev);
2034
- if (reason & B43_IRQ_TXFIFO_FLUSH_OK)
2017
+ if (reason & B43_IRQ_TXFIFO_FLUSH_OK) {
20352018 ;/* TODO */
2019
+ }
20362020 if (reason & B43_IRQ_NOISESAMPLE_OK)
20372021 handle_irq_noise(dev);
20382022
....@@ -2078,7 +2062,6 @@
20782062
20792063 mutex_lock(&dev->wl->mutex);
20802064 b43_do_interrupt_thread(dev);
2081
- mmiowb();
20822065 mutex_unlock(&dev->wl->mutex);
20832066
20842067 return IRQ_HANDLED;
....@@ -2143,7 +2126,6 @@
21432126
21442127 spin_lock(&dev->wl->hardirq_lock);
21452128 ret = b43_do_interrupt(dev);
2146
- mmiowb();
21472129 spin_unlock(&dev->wl->hardirq_lock);
21482130
21492131 return ret;
....@@ -2184,7 +2166,7 @@
21842166 {
21852167 const char text[] =
21862168 "You must go to " \
2187
- "http://wireless.kernel.org/en/users/Drivers/b43#devicefirmware " \
2169
+ "https://wireless.wiki.kernel.org/en/users/Drivers/b43#devicefirmware " \
21882170 "and download the correct firmware for this driver version. " \
21892171 "Please carefully read all instructions on this website.\n";
21902172
....@@ -2286,7 +2268,7 @@
22862268 size = be32_to_cpu(hdr->size);
22872269 if (size != ctx->blob->size - sizeof(struct b43_fw_header))
22882270 goto err_format;
2289
- /* fallthrough */
2271
+ fallthrough;
22902272 case B43_FW_TYPE_IV:
22912273 if (hdr->ver != 1)
22922274 goto err_format;
....@@ -2310,7 +2292,7 @@
23102292 return -EPROTO;
23112293 }
23122294
2313
-/* http://bcm-v4.sipsolutions.net/802.11/Init/Firmware */
2295
+/* https://bcm-v4.sipsolutions.net/802.11/Init/Firmware */
23142296 static int b43_try_request_fw(struct b43_request_fw_context *ctx)
23152297 {
23162298 struct b43_wldev *dev = ctx->dev;
....@@ -2610,17 +2592,12 @@
26102592
26112593 err = ieee80211_register_hw(wl->hw);
26122594 if (err)
2613
- goto err_one_core_detach;
2614
- wl->hw_registred = true;
2595
+ goto out;
2596
+ wl->hw_registered = true;
26152597 b43_leds_register(wl->current_dev);
26162598
26172599 /* Register HW RNG driver */
26182600 b43_rng_init(wl);
2619
-
2620
- goto out;
2621
-
2622
-err_one_core_detach:
2623
- b43_one_core_detach(dev->dev);
26242601
26252602 out:
26262603 kfree(ctx);
....@@ -2868,7 +2845,7 @@
28682845 }
28692846
28702847 /* Initialize the GPIOs
2871
- * http://bcm-specs.sipsolutions.net/GPIO
2848
+ * https://bcm-specs.sipsolutions.net/GPIO
28722849 */
28732850
28742851 #ifdef CONFIG_B43_SSB
....@@ -2996,7 +2973,7 @@
29962973 }
29972974 }
29982975
2999
-/* http://bcm-specs.sipsolutions.net/SuspendMAC */
2976
+/* https://bcm-specs.sipsolutions.net/SuspendMAC */
30002977 void b43_mac_suspend(struct b43_wldev *dev)
30012978 {
30022979 int i;
....@@ -3029,7 +3006,7 @@
30293006 dev->mac_suspended++;
30303007 }
30313008
3032
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/MacPhyClkSet */
3009
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/MacPhyClkSet */
30333010 void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on)
30343011 {
30353012 u32 tmp;
....@@ -3203,7 +3180,7 @@
32033180 b43_rate_memory_write(dev, B43_OFDM_RATE_36MB, 1);
32043181 b43_rate_memory_write(dev, B43_OFDM_RATE_48MB, 1);
32053182 b43_rate_memory_write(dev, B43_OFDM_RATE_54MB, 1);
3206
- /* fallthrough */
3183
+ fallthrough;
32073184 case B43_PHYTYPE_B:
32083185 b43_rate_memory_write(dev, B43_CCK_RATE_1MB, 0);
32093186 b43_rate_memory_write(dev, B43_CCK_RATE_2MB, 0);
....@@ -3256,7 +3233,7 @@
32563233 }
32573234
32583235 /* Initialize the chip
3259
- * http://bcm-specs.sipsolutions.net/ChipInit
3236
+ * https://bcm-specs.sipsolutions.net/ChipInit
32603237 */
32613238 static int b43_chip_init(struct b43_wldev *dev)
32623239 {
....@@ -3625,7 +3602,7 @@
36253602 else
36263603 err = b43_dma_tx(dev, skb);
36273604 if (err == -ENOSPC) {
3628
- wl->tx_queue_stopped[queue_num] = 1;
3605
+ wl->tx_queue_stopped[queue_num] = true;
36293606 ieee80211_stop_queue(wl->hw, queue_num);
36303607 skb_queue_head(&wl->tx_queue[queue_num], skb);
36313608 break;
....@@ -3636,7 +3613,7 @@
36363613 }
36373614
36383615 if (!err)
3639
- wl->tx_queue_stopped[queue_num] = 0;
3616
+ wl->tx_queue_stopped[queue_num] = false;
36403617 }
36413618
36423619 #if B43_DEBUG
....@@ -5354,7 +5331,7 @@
53545331 /* There are 14e4:4321 PCI devs with 2.4 GHz BCM4321 (N-PHY) */
53555332 if (dev->phy.type != B43_PHYTYPE_G)
53565333 break;
5357
- /* fall through */
5334
+ fallthrough;
53585335 case 0x4313: /* BCM4311 */
53595336 case 0x431a: /* BCM4318 */
53605337 case 0x432a: /* BCM4321 */
....@@ -5493,13 +5470,11 @@
54935470 static void b43_one_core_detach(struct b43_bus_dev *dev)
54945471 {
54955472 struct b43_wldev *wldev;
5496
- struct b43_wl *wl;
54975473
54985474 /* Do not cancel ieee80211-workqueue based work here.
54995475 * See comment in b43_remove(). */
55005476
55015477 wldev = b43_bus_get_wldev(dev);
5502
- wl = wldev->wl;
55035478 b43_debugfs_remove_device(wldev);
55045479 b43_wireless_core_detach(wldev);
55055480 list_del(&wldev->list);
....@@ -5610,7 +5585,7 @@
56105585
56115586 wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
56125587
5613
- wl->hw_registred = false;
5588
+ wl->hw_registered = false;
56145589 hw->max_rates = 2;
56155590 SET_IEEE80211_DEV(hw, dev->dev);
56165591 if (is_valid_ether_addr(sprom->et1mac))
....@@ -5630,7 +5605,7 @@
56305605 /* Initialize queues and flags. */
56315606 for (queue_num = 0; queue_num < B43_QOS_QUEUE_NUM; queue_num++) {
56325607 skb_queue_head_init(&wl->tx_queue[queue_num]);
5633
- wl->tx_queue_stopped[queue_num] = 0;
5608
+ wl->tx_queue_stopped[queue_num] = false;
56345609 }
56355610
56365611 snprintf(chip_name, ARRAY_SIZE(chip_name),
....@@ -5693,7 +5668,7 @@
56935668 B43_WARN_ON(!wl);
56945669 if (!wldev->fw.ucode.data)
56955670 return; /* NULL if firmware never loaded */
5696
- if (wl->current_dev == wldev && wl->hw_registred) {
5671
+ if (wl->current_dev == wldev && wl->hw_registered) {
56975672 b43_leds_stop(wldev);
56985673 ieee80211_unregister_hw(wl->hw);
56995674 }
....@@ -5776,7 +5751,7 @@
57765751 B43_WARN_ON(!wl);
57775752 if (!wldev->fw.ucode.data)
57785753 return; /* NULL if firmware never loaded */
5779
- if (wl->current_dev == wldev && wl->hw_registred) {
5754
+ if (wl->current_dev == wldev && wl->hw_registered) {
57805755 b43_leds_stop(wldev);
57815756 ieee80211_unregister_hw(wl->hw);
57825757 }