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 @@ -1244,7 +1244,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 @@ -1255,7 +1255,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 @@ -1299,7 +1299,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 @@ -1536,7 +1536,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 @@ -1552,7 +1552,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 @@ -1757,7 +1757,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 @@ -1849,7 +1849,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 @@ -1870,7 +1870,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 @@ -2614,7 +2614,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 @@ -2657,7 +2657,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 @@ -3057,7 +3057,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 @@ -3144,7 +3144,7 @@ static int rtl8153_enable(struct r8152 *
135 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
136 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
140 @@ -3176,7 +3176,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 @@ -3630,7 +3630,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 @@ -3662,7 +3662,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 @@ -3704,7 +3704,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 @@ -4049,8 +4049,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 @@ -6008,7 +6008,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 @@ -6066,7 +6066,7 @@ static int rtl8156b_enable(struct r8152
200 - if (test_bit(RTL8152_UNPLUG, &tp->flags))
201 + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
205 @@ -6252,7 +6252,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 @@ -6262,7 +6262,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 @@ -6277,7 +6277,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 @@ -6317,7 +6317,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 @@ -6338,7 +6338,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 @@ -6362,7 +6362,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 @@ -6399,7 +6399,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 @@ -6480,7 +6480,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 @@ -6553,7 +6553,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 @@ -6691,7 +6691,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 @@ -6730,7 +6730,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 @@ -6857,7 +6857,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 @@ -6890,7 +6890,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 @@ -6934,7 +6934,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 @@ -6945,7 +6945,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 @@ -7074,7 +7074,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 @@ -7085,7 +7085,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 @@ -7156,7 +7156,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 @@ -7176,7 +7176,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 @@ -8005,7 +8005,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 @@ -8026,7 +8026,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 @@ -8101,7 +8101,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 @@ -8135,7 +8135,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 @@ -9164,7 +9164,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 @@ -9266,7 +9266,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 @@ -9275,7 +9275,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 @@ -9283,7 +9283,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);