hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/net/wireless/broadcom/b43legacy/main.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 *
34 * Broadcom B43legacy wireless driver
....@@ -12,21 +13,6 @@
1213 * Some parts of the code in this file are derived from the ipw2200
1314 * driver Copyright(c) 2003 - 2004 Intel Corporation.
1415
15
- * This program is free software; you can redistribute it and/or modify
16
- * it under the terms of the GNU General Public License as published by
17
- * the Free Software Foundation; either version 2 of the License, or
18
- * (at your option) any later version.
19
- *
20
- * This program is distributed in the hope that it will be useful,
21
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- * GNU General Public License for more details.
24
- *
25
- * You should have received a copy of the GNU General Public License
26
- * along with this program; see the file COPYING. If not, write to
27
- * the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
28
- * Boston, MA 02110-1301, USA.
29
- *
3016 */
3117
3218 #include <linux/delay.h>
....@@ -264,7 +250,6 @@
264250 val = swab32(val);
265251
266252 b43legacy_write32(dev, B43legacy_MMIO_RAM_CONTROL, offset);
267
- mmiowb();
268253 b43legacy_write32(dev, B43legacy_MMIO_RAM_DATA, val);
269254 }
270255
....@@ -341,14 +326,11 @@
341326 if (offset & 0x0003) {
342327 /* Unaligned access */
343328 b43legacy_shm_control_word(dev, routing, offset >> 2);
344
- mmiowb();
345329 b43legacy_write16(dev,
346330 B43legacy_MMIO_SHM_DATA_UNALIGNED,
347331 (value >> 16) & 0xffff);
348
- mmiowb();
349332 b43legacy_shm_control_word(dev, routing,
350333 (offset >> 2) + 1);
351
- mmiowb();
352334 b43legacy_write16(dev, B43legacy_MMIO_SHM_DATA,
353335 value & 0xffff);
354336 return;
....@@ -356,7 +338,6 @@
356338 offset >>= 2;
357339 }
358340 b43legacy_shm_control_word(dev, routing, offset);
359
- mmiowb();
360341 b43legacy_write32(dev, B43legacy_MMIO_SHM_DATA, value);
361342 }
362343
....@@ -368,7 +349,6 @@
368349 if (offset & 0x0003) {
369350 /* Unaligned access */
370351 b43legacy_shm_control_word(dev, routing, offset >> 2);
371
- mmiowb();
372352 b43legacy_write16(dev,
373353 B43legacy_MMIO_SHM_DATA_UNALIGNED,
374354 value);
....@@ -377,7 +357,6 @@
377357 offset >>= 2;
378358 }
379359 b43legacy_shm_control_word(dev, routing, offset);
380
- mmiowb();
381360 b43legacy_write16(dev, B43legacy_MMIO_SHM_DATA, value);
382361 }
383362
....@@ -471,7 +450,6 @@
471450 status = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
472451 status |= B43legacy_MACCTL_TBTTHOLD;
473452 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, status);
474
- mmiowb();
475453 }
476454
477455 static void b43legacy_time_unlock(struct b43legacy_wldev *dev)
....@@ -494,10 +472,8 @@
494472 u32 hi = (tsf & 0xFFFFFFFF00000000ULL) >> 32;
495473
496474 b43legacy_write32(dev, B43legacy_MMIO_REV3PLUS_TSF_LOW, 0);
497
- mmiowb();
498475 b43legacy_write32(dev, B43legacy_MMIO_REV3PLUS_TSF_HIGH,
499476 hi);
500
- mmiowb();
501477 b43legacy_write32(dev, B43legacy_MMIO_REV3PLUS_TSF_LOW,
502478 lo);
503479 } else {
....@@ -507,13 +483,9 @@
507483 u16 v3 = (tsf & 0xFFFF000000000000ULL) >> 48;
508484
509485 b43legacy_write16(dev, B43legacy_MMIO_TSF_0, 0);
510
- mmiowb();
511486 b43legacy_write16(dev, B43legacy_MMIO_TSF_3, v3);
512
- mmiowb();
513487 b43legacy_write16(dev, B43legacy_MMIO_TSF_2, v2);
514
- mmiowb();
515488 b43legacy_write16(dev, B43legacy_MMIO_TSF_1, v1);
516
- mmiowb();
517489 b43legacy_write16(dev, B43legacy_MMIO_TSF_0, v0);
518490 }
519491 }
....@@ -619,7 +591,7 @@
619591 }
620592
621593 /* DummyTransmission function, as documented on
622
- * http://bcm-specs.sipsolutions.net/DummyTransmission
594
+ * https://bcm-specs.sipsolutions.net/DummyTransmission
623595 */
624596 void b43legacy_dummy_transmission(struct b43legacy_wldev *dev)
625597 {
....@@ -1250,7 +1222,6 @@
12501222 /* The handler might have updated the IRQ mask. */
12511223 b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK,
12521224 dev->irq_mask);
1253
- mmiowb();
12541225 spin_unlock_irq(&wl->irq_lock);
12551226 }
12561227 mutex_unlock(&wl->mutex);
....@@ -1304,9 +1275,9 @@
13041275 }
13051276
13061277 /* Interrupt handler bottom-half */
1307
-static void b43legacy_interrupt_tasklet(unsigned long data)
1278
+static void b43legacy_interrupt_tasklet(struct tasklet_struct *t)
13081279 {
1309
- struct b43legacy_wldev *dev = (struct b43legacy_wldev *)data;
1280
+ struct b43legacy_wldev *dev = from_tasklet(dev, t, isr_tasklet);
13101281 u32 reason;
13111282 u32 dma_reason[ARRAY_SIZE(dev->dma_reason)];
13121283 u32 merged_dma_reason = 0;
....@@ -1347,7 +1318,6 @@
13471318 dma_reason[2], dma_reason[3],
13481319 dma_reason[4], dma_reason[5]);
13491320 b43legacy_controller_restart(dev, "DMA error");
1350
- mmiowb();
13511321 spin_unlock_irqrestore(&dev->wl->irq_lock, flags);
13521322 return;
13531323 }
....@@ -1370,8 +1340,9 @@
13701340 handle_irq_beacon(dev);
13711341 if (reason & B43legacy_IRQ_PMQ)
13721342 handle_irq_pmq(dev);
1373
- if (reason & B43legacy_IRQ_TXFIFO_FLUSH_OK)
1343
+ if (reason & B43legacy_IRQ_TXFIFO_FLUSH_OK) {
13741344 ;/*TODO*/
1345
+ }
13751346 if (reason & B43legacy_IRQ_NOISESAMPLE_OK)
13761347 handle_irq_noise(dev);
13771348
....@@ -1397,7 +1368,6 @@
13971368 handle_irq_transmit_status(dev);
13981369
13991370 b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, dev->irq_mask);
1400
- mmiowb();
14011371 spin_unlock_irqrestore(&dev->wl->irq_lock, flags);
14021372 }
14031373
....@@ -1489,7 +1459,6 @@
14891459 dev->irq_reason = reason;
14901460 tasklet_schedule(&dev->isr_tasklet);
14911461 out:
1492
- mmiowb();
14931462 spin_unlock(&dev->wl->irq_lock);
14941463
14951464 return ret;
....@@ -1509,8 +1478,8 @@
15091478
15101479 static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl)
15111480 {
1512
- b43legacyerr(wl, "You must go to http://wireless.kernel.org/en/users/"
1513
- "Drivers/b43#devicefirmware "
1481
+ b43legacyerr(wl, "You must go to https://wireless.wiki.kernel.org/en/"
1482
+ "users/Drivers/b43#devicefirmware "
15141483 "and download the correct firmware (version 3).\n");
15151484 }
15161485
....@@ -1569,7 +1538,7 @@
15691538 size = be32_to_cpu(hdr->size);
15701539 if (size != (*fw)->size - sizeof(struct b43legacy_fw_header))
15711540 goto err_format;
1572
- /* fallthrough */
1541
+ fallthrough;
15731542 case B43legacy_FW_TYPE_IV:
15741543 if (hdr->ver != 1)
15751544 goto err_format;
....@@ -1902,7 +1871,7 @@
19021871 }
19031872
19041873 /* Initialize the GPIOs
1905
- * http://bcm-specs.sipsolutions.net/GPIO
1874
+ * https://bcm-specs.sipsolutions.net/GPIO
19061875 */
19071876 static int b43legacy_gpio_init(struct b43legacy_wldev *dev)
19081877 {
....@@ -1992,7 +1961,7 @@
19921961 }
19931962 }
19941963
1995
-/* http://bcm-specs.sipsolutions.net/SuspendMAC */
1964
+/* https://bcm-specs.sipsolutions.net/SuspendMAC */
19961965 void b43legacy_mac_suspend(struct b43legacy_wldev *dev)
19971966 {
19981967 int i;
....@@ -2108,7 +2077,7 @@
21082077 b43legacy_rate_memory_write(dev, B43legacy_OFDM_RATE_36MB, 1);
21092078 b43legacy_rate_memory_write(dev, B43legacy_OFDM_RATE_48MB, 1);
21102079 b43legacy_rate_memory_write(dev, B43legacy_OFDM_RATE_54MB, 1);
2111
- /* fallthrough */
2080
+ fallthrough;
21122081 case B43legacy_PHYTYPE_B:
21132082 b43legacy_rate_memory_write(dev, B43legacy_CCK_RATE_1MB, 0);
21142083 b43legacy_rate_memory_write(dev, B43legacy_CCK_RATE_2MB, 0);
....@@ -2173,7 +2142,7 @@
21732142 }
21742143
21752144 /* Initialize the chip
2176
- * http://bcm-specs.sipsolutions.net/ChipInit
2145
+ * https://bcm-specs.sipsolutions.net/ChipInit
21772146 */
21782147 static int b43legacy_chip_init(struct b43legacy_wldev *dev)
21792148 {
....@@ -2612,7 +2581,7 @@
26122581 static int b43legacy_switch_phymode(struct b43legacy_wl *wl,
26132582 unsigned int new_mode)
26142583 {
2615
- struct b43legacy_wldev *uninitialized_var(up_dev);
2584
+ struct b43legacy_wldev *up_dev;
26162585 struct b43legacy_wldev *down_dev;
26172586 int err;
26182587 bool gmode = false;
....@@ -2782,7 +2751,6 @@
27822751
27832752 spin_lock_irqsave(&wl->irq_lock, flags);
27842753 b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, dev->irq_mask);
2785
- mmiowb();
27862754 spin_unlock_irqrestore(&wl->irq_lock, flags);
27872755 out_unlock_mutex:
27882756 mutex_unlock(&wl->mutex);
....@@ -2901,7 +2869,6 @@
29012869 spin_lock_irqsave(&wl->irq_lock, flags);
29022870 b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, dev->irq_mask);
29032871 /* XXX: why? */
2904
- mmiowb();
29052872 spin_unlock_irqrestore(&wl->irq_lock, flags);
29062873 out_unlock_mutex:
29072874 mutex_unlock(&wl->mutex);
....@@ -3775,9 +3742,7 @@
37753742 wldev->wl = wl;
37763743 b43legacy_set_status(wldev, B43legacy_STAT_UNINIT);
37773744 wldev->bad_frames_preempt = modparam_bad_frames_preempt;
3778
- tasklet_init(&wldev->isr_tasklet,
3779
- b43legacy_interrupt_tasklet,
3780
- (unsigned long)wldev);
3745
+ tasklet_setup(&wldev->isr_tasklet, b43legacy_interrupt_tasklet);
37813746 if (modparam_pio)
37823747 wldev->__using_pio = true;
37833748 INIT_LIST_HEAD(&wldev->list);