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
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.
12 This is a no-op change and just a search and replace.
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>
18 drivers/net/usb/r8152.c | 96 ++++++++++++++++++++---------------------
19 1 file changed, 48 insertions(+), 48 deletions(-)
21 --- a/drivers/net/usb/r8152.c
22 +++ b/drivers/net/usb/r8152.c
23 @@ -763,7 +763,7 @@ enum rtl_register_content {
28 + RTL8152_INACCESSIBLE = 0,
32 @@ -1241,7 +1241,7 @@ int set_registers(struct r8152 *tp, u16
33 static void rtl_set_unplug(struct r8152 *tp)
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();
41 @@ -1252,7 +1252,7 @@ static int generic_ocp_read(struct r8152
45 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
46 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
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;
54 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
55 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
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);
63 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
64 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
67 if (phy_id != R8152_PHY_ID)
68 @@ -1549,7 +1549,7 @@ void write_mii_word(struct net_device *n
70 struct r8152 *tp = netdev_priv(netdev);
72 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
73 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
76 if (phy_id != R8152_PHY_ID)
77 @@ -1754,7 +1754,7 @@ static void read_bulk_callback(struct ur
81 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
82 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
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))
90 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
91 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
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))
99 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
100 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
104 @@ -2611,7 +2611,7 @@ static void bottom_half(struct tasklet_s
106 struct r8152 *tp = from_tasklet(tp, t, tx_tl);
108 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
109 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
112 if (!test_bit(WORK_ENABLE, &tp->flags))
113 @@ -2654,7 +2654,7 @@ int r8152_submit_rx(struct r8152 *tp, st
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))
122 @@ -3050,7 +3050,7 @@ static int rtl_enable(struct r8152 *tp)
124 static int rtl8152_enable(struct r8152 *tp)
126 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
127 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
131 @@ -3137,7 +3137,7 @@ static int rtl8153_enable(struct r8152 *
135 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
136 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
140 @@ -3169,7 +3169,7 @@ static void rtl_disable(struct r8152 *tp
144 - if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
145 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) {
146 rtl_drop_queued_tx(tp);
149 @@ -3623,7 +3623,7 @@ static u16 r8153_phy_status(struct r8152
153 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
154 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
158 @@ -3655,7 +3655,7 @@ static void r8153b_ups_en(struct r8152 *
161 for (i = 0; i < 500; i++) {
162 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
163 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
165 if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) &
167 @@ -3697,7 +3697,7 @@ static void r8153c_ups_en(struct r8152 *
170 for (i = 0; i < 500; i++) {
171 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
172 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
174 if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) &
176 @@ -4042,8 +4042,8 @@ static int rtl_phy_patch_request(struct
177 for (i = 0; wait && i < 5000; i++) {
180 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
182 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
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 *
191 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
192 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
195 r8156_fc_parameter(tp);
196 @@ -6059,7 +6059,7 @@ static int rtl8156b_enable(struct r8152
200 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
201 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
205 @@ -6245,7 +6245,7 @@ out:
207 static void rtl8152_up(struct r8152 *tp)
209 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
210 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
213 r8152_aldps_en(tp, false);
214 @@ -6255,7 +6255,7 @@ static void rtl8152_up(struct r8152 *tp)
216 static void rtl8152_down(struct r8152 *tp)
218 - if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
219 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) {
220 rtl_drop_queued_tx(tp);
223 @@ -6270,7 +6270,7 @@ static void rtl8153_up(struct r8152 *tp)
227 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
228 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
231 r8153_u1u2en(tp, false);
232 @@ -6310,7 +6310,7 @@ static void rtl8153_down(struct r8152 *t
236 - if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
237 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) {
238 rtl_drop_queued_tx(tp);
241 @@ -6331,7 +6331,7 @@ static void rtl8153b_up(struct r8152 *tp
245 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
246 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
249 r8153b_u1u2en(tp, false);
250 @@ -6355,7 +6355,7 @@ static void rtl8153b_down(struct r8152 *
254 - if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
255 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) {
256 rtl_drop_queued_tx(tp);
259 @@ -6392,7 +6392,7 @@ static void rtl8153c_up(struct r8152 *tp
263 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
264 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
267 r8153b_u1u2en(tp, false);
268 @@ -6473,7 +6473,7 @@ static void rtl8156_up(struct r8152 *tp)
272 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
273 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
276 r8153b_u1u2en(tp, false);
277 @@ -6546,7 +6546,7 @@ static void rtl8156_down(struct r8152 *t
281 - if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
282 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) {
283 rtl_drop_queued_tx(tp);
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.
290 - if (test_bit(RTL8152_UNPLUG, &tp->flags) || !netif_running(tp->netdev))
291 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags) || !netif_running(tp->netdev))
294 if (usb_autopm_get_interface(tp->intf) < 0)
295 @@ -6723,7 +6723,7 @@ static void rtl_hw_phy_work_func_t(struc
297 struct r8152 *tp = container_of(work, struct r8152, hw_phy_work.work);
299 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
300 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
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);
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);
313 @@ -6883,7 +6883,7 @@ static void r8152b_init(struct r8152 *tp
317 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
318 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
321 data = r8152_mdio_read(tp, MII_BMCR);
322 @@ -6927,7 +6927,7 @@ static void r8153_init(struct r8152 *tp)
326 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
327 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
330 r8153_u1u2en(tp, false);
331 @@ -6938,7 +6938,7 @@ static void r8153_init(struct r8152 *tp)
335 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
336 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
340 @@ -7067,7 +7067,7 @@ static void r8153b_init(struct r8152 *tp
344 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
345 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
348 r8153b_u1u2en(tp, false);
349 @@ -7078,7 +7078,7 @@ static void r8153b_init(struct r8152 *tp
353 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
354 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
358 @@ -7149,7 +7149,7 @@ static void r8153c_init(struct r8152 *tp
362 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
363 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
366 r8153b_u1u2en(tp, false);
367 @@ -7169,7 +7169,7 @@ static void r8153c_init(struct r8152 *tp
371 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
372 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
376 @@ -7998,7 +7998,7 @@ static void r8156_init(struct r8152 *tp)
380 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
381 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
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)
389 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
390 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
394 @@ -8094,7 +8094,7 @@ static void r8156b_init(struct r8152 *tp
398 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
399 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
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
407 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
408 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
412 @@ -9153,7 +9153,7 @@ static int rtl8152_ioctl(struct net_devi
413 struct mii_ioctl_data *data = if_mii(rq);
416 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
417 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
420 res = usb_autopm_get_interface(tp->intf);
421 @@ -9255,7 +9255,7 @@ static const struct net_device_ops rtl81
423 static void rtl8152_unload(struct r8152 *tp)
425 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
426 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
429 if (tp->version != RTL_VER_01)
430 @@ -9264,7 +9264,7 @@ static void rtl8152_unload(struct r8152
432 static void rtl8153_unload(struct r8152 *tp)
434 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
435 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
438 r8153_power_cut_en(tp, false);
439 @@ -9272,7 +9272,7 @@ static void rtl8153_unload(struct r8152
441 static void rtl8153b_unload(struct r8152 *tp)
443 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
444 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
447 r8153b_power_cut_en(tp, false);