hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/net/wireless/broadcom/b43legacy/phy.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23
34 Broadcom B43legacy wireless driver
....@@ -12,20 +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.
2916
3017 */
3118
....@@ -82,17 +69,6 @@
8269
8370 static void b43legacy_phy_initg(struct b43legacy_wldev *dev);
8471
85
-
86
-static inline
87
-void b43legacy_voluntary_preempt(void)
88
-{
89
- B43legacy_BUG_ON(!(!in_atomic() && !in_irq() &&
90
- !in_interrupt() && !irqs_disabled()));
91
-#ifndef CONFIG_PREEMPT
92
- cond_resched();
93
-#endif /* CONFIG_PREEMPT */
94
-}
95
-
9672 /* Lock the PHY registers against concurrent access from the microcode.
9773 * This lock is nonrecursive. */
9874 void b43legacy_phy_lock(struct b43legacy_wldev *dev)
....@@ -134,7 +110,6 @@
134110 void b43legacy_phy_write(struct b43legacy_wldev *dev, u16 offset, u16 val)
135111 {
136112 b43legacy_write16(dev, B43legacy_MMIO_PHY_CONTROL, offset);
137
- mmiowb();
138113 b43legacy_write16(dev, B43legacy_MMIO_PHY_DATA, val);
139114 }
140115
....@@ -154,7 +129,7 @@
154129 }
155130
156131 /* initialize B PHY power control
157
- * as described in http://bcm-specs.sipsolutions.net/InitPowerControl
132
+ * as described in https://bcm-specs.sipsolutions.net/InitPowerControl
158133 */
159134 static void b43legacy_phy_init_pctl(struct b43legacy_wldev *dev)
160135 {
....@@ -1138,7 +1113,7 @@
11381113 ret += b43legacy_phy_read(dev, 0x002C);
11391114 }
11401115 local_irq_restore(flags);
1141
- b43legacy_voluntary_preempt();
1116
+ cond_resched();
11421117
11431118 return ret;
11441119 }
....@@ -1148,7 +1123,7 @@
11481123 struct b43legacy_phy *phy = &dev->phy;
11491124 u16 regstack[12] = { 0 };
11501125 u16 mls;
1151
- u16 fval;
1126
+ s16 fval;
11521127 int i;
11531128 int j;
11541129
....@@ -1267,7 +1242,7 @@
12671242 }
12681243 ret = b43legacy_phy_read(dev, 0x002D);
12691244 local_irq_restore(flags);
1270
- b43legacy_voluntary_preempt();
1245
+ cond_resched();
12711246
12721247 return ret;
12731248 }
....@@ -1486,7 +1461,7 @@
14861461 b43legacy_phy_write(dev, 0x0060, value);
14871462 }
14881463
1489
-/* http://bcm-specs.sipsolutions.net/LocalOscillator/Measure */
1464
+/* https://bcm-specs.sipsolutions.net/LocalOscillator/Measure */
14901465 void b43legacy_phy_lo_g_measure(struct b43legacy_wldev *dev)
14911466 {
14921467 static const u8 pairorder[10] = { 3, 1, 5, 7, 9, 2, 0, 4, 6, 8 };
....@@ -1605,7 +1580,7 @@
16051580 b43legacy_radio_write16(dev, 0x43, i);
16061581 b43legacy_radio_write16(dev, 0x52, phy->txctl2);
16071582 udelay(10);
1608
- b43legacy_voluntary_preempt();
1583
+ cond_resched();
16091584
16101585 b43legacy_phy_set_baseband_attenuation(dev, j * 2);
16111586
....@@ -1656,7 +1631,7 @@
16561631 phy->txctl2
16571632 | (3/*txctl1*/ << 4));
16581633 udelay(10);
1659
- b43legacy_voluntary_preempt();
1634
+ cond_resched();
16601635
16611636 b43legacy_phy_set_baseband_attenuation(dev, j * 2);
16621637
....@@ -1679,7 +1654,7 @@
16791654 b43legacy_phy_write(dev, 0x0812, (r27 << 8) | 0xA2);
16801655 udelay(2);
16811656 b43legacy_phy_write(dev, 0x0812, (r27 << 8) | 0xA3);
1682
- b43legacy_voluntary_preempt();
1657
+ cond_resched();
16831658 } else
16841659 b43legacy_phy_write(dev, 0x0015, r27 | 0xEFA0);
16851660 b43legacy_phy_lo_adjust(dev, is_initializing);
....@@ -1746,7 +1721,7 @@
17461721 }
17471722 }
17481723
1749
-/* http://bcm-specs.sipsolutions.net/EstimatePowerOut
1724
+/* https://bcm-specs.sipsolutions.net/EstimatePowerOut
17501725 * This function converts a TSSI value to dBm in Q5.2
17511726 */
17521727 static s8 b43legacy_phy_estimate_power_out(struct b43legacy_wldev *dev, s8 tssi)
....@@ -1772,7 +1747,7 @@
17721747 return dbm;
17731748 }
17741749
1775
-/* http://bcm-specs.sipsolutions.net/RecalculateTransmissionPower */
1750
+/* https://bcm-specs.sipsolutions.net/RecalculateTransmissionPower */
17761751 void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev)
17771752 {
17781753 struct b43legacy_phy *phy = &dev->phy;