4f0e0e1c65813048d3b78a053528b8eded8319b5
[openwrt/staging/ldir.git] /
1 From 715f67f33af45ce2cc3a5b1ef133cc8c8e7787b0 Mon Sep 17 00:00:00 2001
2 From: Douglas Anderson <dianders@chromium.org>
3 Date: Fri, 20 Oct 2023 14:06:58 -0700
4 Subject: [PATCH] r8152: Rename RTL8152_UNPLUG to RTL8152_INACCESSIBLE
5
6 Whenever the RTL8152_UNPLUG is set that just tells the driver that all
7 accesses will fail and we should just immediately bail. A future patch
8 will use this same concept at a time when the driver hasn't actually
9 been unplugged but is about to be reset. Rename the flag in
10 preparation for the future patch.
11
12 This is a no-op change and just a search and replace.
13
14 Signed-off-by: Douglas Anderson <dianders@chromium.org>
15 Reviewed-by: Grant Grundler <grundler@chromium.org>
16 Signed-off-by: David S. Miller <davem@davemloft.net>
17 ---
18 drivers/net/usb/r8152.c | 96 ++++++++++++++++++++---------------------
19 1 file changed, 48 insertions(+), 48 deletions(-)
20
21 --- a/drivers/net/usb/r8152.c
22 +++ b/drivers/net/usb/r8152.c
23 @@ -763,7 +763,7 @@ enum rtl_register_content {
24
25 /* rtl8152 flags */
26 enum rtl8152_flags {
27 - RTL8152_UNPLUG = 0,
28 + RTL8152_INACCESSIBLE = 0,
29 RTL8152_SET_RX_MODE,
30 WORK_ENABLE,
31 RTL8152_LINK_CHG,
32 @@ -1241,7 +1241,7 @@ int set_registers(struct r8152 *tp, u16
33 static void rtl_set_unplug(struct r8152 *tp)
34 {
35 if (tp->udev->state == USB_STATE_NOTATTACHED) {
36 - set_bit(RTL8152_UNPLUG, &tp->flags);
37 + set_bit(RTL8152_INACCESSIBLE, &tp->flags);
38 smp_mb__after_atomic();
39 }
40 }
41 @@ -1252,7 +1252,7 @@ static int generic_ocp_read(struct r8152
42 u16 limit = 64;
43 int ret = 0;
44
45 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
46 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
47 return -ENODEV;
48
49 /* both size and indix must be 4 bytes align */
50 @@ -1296,7 +1296,7 @@ static int generic_ocp_write(struct r815
51 u16 byteen_start, byteen_end, byen;
52 u16 limit = 512;
53
54 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
55 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
56 return -ENODEV;
57
58 /* both size and indix must be 4 bytes align */
59 @@ -1533,7 +1533,7 @@ static int read_mii_word(struct net_devi
60 struct r8152 *tp = netdev_priv(netdev);
61 int ret;
62
63 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
64 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
65 return -ENODEV;
66
67 if (phy_id != R8152_PHY_ID)
68 @@ -1549,7 +1549,7 @@ void write_mii_word(struct net_device *n
69 {
70 struct r8152 *tp = netdev_priv(netdev);
71
72 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
73 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
74 return;
75
76 if (phy_id != R8152_PHY_ID)
77 @@ -1754,7 +1754,7 @@ static void read_bulk_callback(struct ur
78 if (!tp)
79 return;
80
81 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
82 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
83 return;
84
85 if (!test_bit(WORK_ENABLE, &tp->flags))
86 @@ -1846,7 +1846,7 @@ static void write_bulk_callback(struct u
87 if (!test_bit(WORK_ENABLE, &tp->flags))
88 return;
89
90 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
91 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
92 return;
93
94 if (!skb_queue_empty(&tp->tx_queue))
95 @@ -1867,7 +1867,7 @@ static void intr_callback(struct urb *ur
96 if (!test_bit(WORK_ENABLE, &tp->flags))
97 return;
98
99 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
100 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
101 return;
102
103 switch (status) {
104 @@ -2611,7 +2611,7 @@ static void bottom_half(struct tasklet_s
105 {
106 struct r8152 *tp = from_tasklet(tp, t, tx_tl);
107
108 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
109 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
110 return;
111
112 if (!test_bit(WORK_ENABLE, &tp->flags))
113 @@ -2654,7 +2654,7 @@ int r8152_submit_rx(struct r8152 *tp, st
114 int ret;
115
116 /* The rx would be stopped, so skip submitting */
117 - if (test_bit(RTL8152_UNPLUG, &tp->flags) ||
118 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags) ||
119 !test_bit(WORK_ENABLE, &tp->flags) || !netif_carrier_ok(tp->netdev))
120 return 0;
121
122 @@ -3050,7 +3050,7 @@ static int rtl_enable(struct r8152 *tp)
123
124 static int rtl8152_enable(struct r8152 *tp)
125 {
126 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
127 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
128 return -ENODEV;
129
130 set_tx_qlen(tp);
131 @@ -3137,7 +3137,7 @@ static int rtl8153_enable(struct r8152 *
132 {
133 u32 ocp_data;
134
135 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
136 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
137 return -ENODEV;
138
139 set_tx_qlen(tp);
140 @@ -3169,7 +3169,7 @@ static void rtl_disable(struct r8152 *tp
141 u32 ocp_data;
142 int i;
143
144 - if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
145 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) {
146 rtl_drop_queued_tx(tp);
147 return;
148 }
149 @@ -3623,7 +3623,7 @@ static u16 r8153_phy_status(struct r8152
150 }
151
152 msleep(20);
153 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
154 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
155 break;
156 }
157
158 @@ -3655,7 +3655,7 @@ static void r8153b_ups_en(struct r8152 *
159 int i;
160
161 for (i = 0; i < 500; i++) {
162 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
163 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
164 return;
165 if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) &
166 AUTOLOAD_DONE)
167 @@ -3697,7 +3697,7 @@ static void r8153c_ups_en(struct r8152 *
168 int i;
169
170 for (i = 0; i < 500; i++) {
171 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
172 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
173 return;
174 if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) &
175 AUTOLOAD_DONE)
176 @@ -4042,8 +4042,8 @@ static int rtl_phy_patch_request(struct
177 for (i = 0; wait && i < 5000; i++) {
178 u32 ocp_data;
179
180 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
181 - break;
182 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
183 + return -ENODEV;
184
185 usleep_range(1000, 2000);
186 ocp_data = ocp_reg_read(tp, OCP_PHY_PATCH_STAT);
187 @@ -6001,7 +6001,7 @@ static int rtl8156_enable(struct r8152 *
188 u32 ocp_data;
189 u16 speed;
190
191 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
192 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
193 return -ENODEV;
194
195 r8156_fc_parameter(tp);
196 @@ -6059,7 +6059,7 @@ static int rtl8156b_enable(struct r8152
197 u32 ocp_data;
198 u16 speed;
199
200 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
201 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
202 return -ENODEV;
203
204 set_tx_qlen(tp);
205 @@ -6245,7 +6245,7 @@ out:
206
207 static void rtl8152_up(struct r8152 *tp)
208 {
209 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
210 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
211 return;
212
213 r8152_aldps_en(tp, false);
214 @@ -6255,7 +6255,7 @@ static void rtl8152_up(struct r8152 *tp)
215
216 static void rtl8152_down(struct r8152 *tp)
217 {
218 - if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
219 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) {
220 rtl_drop_queued_tx(tp);
221 return;
222 }
223 @@ -6270,7 +6270,7 @@ static void rtl8153_up(struct r8152 *tp)
224 {
225 u32 ocp_data;
226
227 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
228 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
229 return;
230
231 r8153_u1u2en(tp, false);
232 @@ -6310,7 +6310,7 @@ static void rtl8153_down(struct r8152 *t
233 {
234 u32 ocp_data;
235
236 - if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
237 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) {
238 rtl_drop_queued_tx(tp);
239 return;
240 }
241 @@ -6331,7 +6331,7 @@ static void rtl8153b_up(struct r8152 *tp
242 {
243 u32 ocp_data;
244
245 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
246 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
247 return;
248
249 r8153b_u1u2en(tp, false);
250 @@ -6355,7 +6355,7 @@ static void rtl8153b_down(struct r8152 *
251 {
252 u32 ocp_data;
253
254 - if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
255 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) {
256 rtl_drop_queued_tx(tp);
257 return;
258 }
259 @@ -6392,7 +6392,7 @@ static void rtl8153c_up(struct r8152 *tp
260 {
261 u32 ocp_data;
262
263 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
264 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
265 return;
266
267 r8153b_u1u2en(tp, false);
268 @@ -6473,7 +6473,7 @@ static void rtl8156_up(struct r8152 *tp)
269 {
270 u32 ocp_data;
271
272 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
273 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
274 return;
275
276 r8153b_u1u2en(tp, false);
277 @@ -6546,7 +6546,7 @@ static void rtl8156_down(struct r8152 *t
278 {
279 u32 ocp_data;
280
281 - if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
282 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) {
283 rtl_drop_queued_tx(tp);
284 return;
285 }
286 @@ -6684,7 +6684,7 @@ static void rtl_work_func_t(struct work_
287 /* If the device is unplugged or !netif_running(), the workqueue
288 * doesn't need to wake the device, and could return directly.
289 */
290 - if (test_bit(RTL8152_UNPLUG, &tp->flags) || !netif_running(tp->netdev))
291 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags) || !netif_running(tp->netdev))
292 return;
293
294 if (usb_autopm_get_interface(tp->intf) < 0)
295 @@ -6723,7 +6723,7 @@ static void rtl_hw_phy_work_func_t(struc
296 {
297 struct r8152 *tp = container_of(work, struct r8152, hw_phy_work.work);
298
299 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
300 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
301 return;
302
303 if (usb_autopm_get_interface(tp->intf) < 0)
304 @@ -6850,7 +6850,7 @@ static int rtl8152_close(struct net_devi
305 netif_stop_queue(netdev);
306
307 res = usb_autopm_get_interface(tp->intf);
308 - if (res < 0 || test_bit(RTL8152_UNPLUG, &tp->flags)) {
309 + if (res < 0 || test_bit(RTL8152_INACCESSIBLE, &tp->flags)) {
310 rtl_drop_queued_tx(tp);
311 rtl_stop_rx(tp);
312 } else {
313 @@ -6883,7 +6883,7 @@ static void r8152b_init(struct r8152 *tp
314 u32 ocp_data;
315 u16 data;
316
317 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
318 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
319 return;
320
321 data = r8152_mdio_read(tp, MII_BMCR);
322 @@ -6927,7 +6927,7 @@ static void r8153_init(struct r8152 *tp)
323 u16 data;
324 int i;
325
326 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
327 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
328 return;
329
330 r8153_u1u2en(tp, false);
331 @@ -6938,7 +6938,7 @@ static void r8153_init(struct r8152 *tp)
332 break;
333
334 msleep(20);
335 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
336 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
337 break;
338 }
339
340 @@ -7067,7 +7067,7 @@ static void r8153b_init(struct r8152 *tp
341 u16 data;
342 int i;
343
344 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
345 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
346 return;
347
348 r8153b_u1u2en(tp, false);
349 @@ -7078,7 +7078,7 @@ static void r8153b_init(struct r8152 *tp
350 break;
351
352 msleep(20);
353 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
354 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
355 break;
356 }
357
358 @@ -7149,7 +7149,7 @@ static void r8153c_init(struct r8152 *tp
359 u16 data;
360 int i;
361
362 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
363 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
364 return;
365
366 r8153b_u1u2en(tp, false);
367 @@ -7169,7 +7169,7 @@ static void r8153c_init(struct r8152 *tp
368 break;
369
370 msleep(20);
371 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
372 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
373 return;
374 }
375
376 @@ -7998,7 +7998,7 @@ static void r8156_init(struct r8152 *tp)
377 u16 data;
378 int i;
379
380 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
381 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
382 return;
383
384 ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_ECM_OP);
385 @@ -8019,7 +8019,7 @@ static void r8156_init(struct r8152 *tp)
386 break;
387
388 msleep(20);
389 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
390 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
391 return;
392 }
393
394 @@ -8094,7 +8094,7 @@ static void r8156b_init(struct r8152 *tp
395 u16 data;
396 int i;
397
398 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
399 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
400 return;
401
402 ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_ECM_OP);
403 @@ -8128,7 +8128,7 @@ static void r8156b_init(struct r8152 *tp
404 break;
405
406 msleep(20);
407 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
408 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
409 return;
410 }
411
412 @@ -9153,7 +9153,7 @@ static int rtl8152_ioctl(struct net_devi
413 struct mii_ioctl_data *data = if_mii(rq);
414 int res;
415
416 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
417 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
418 return -ENODEV;
419
420 res = usb_autopm_get_interface(tp->intf);
421 @@ -9255,7 +9255,7 @@ static const struct net_device_ops rtl81
422
423 static void rtl8152_unload(struct r8152 *tp)
424 {
425 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
426 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
427 return;
428
429 if (tp->version != RTL_VER_01)
430 @@ -9264,7 +9264,7 @@ static void rtl8152_unload(struct r8152
431
432 static void rtl8153_unload(struct r8152 *tp)
433 {
434 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
435 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
436 return;
437
438 r8153_power_cut_en(tp, false);
439 @@ -9272,7 +9272,7 @@ static void rtl8153_unload(struct r8152
440
441 static void rtl8153b_unload(struct r8152 *tp)
442 {
443 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
444 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
445 return;
446
447 r8153b_power_cut_en(tp, false);