Skip to content

Commit 32a574c

Browse files
diandersdavem330
authored andcommitted
r8152: Add RTL8152_INACCESSIBLE checks to more loops
Previous commits added checks for RTL8152_INACCESSIBLE in the loops in the driver. There are still a few more that keep tripping the driver up in error cases and make things take longer than they should. Add those in. All the loops that are part of this commit existed in some form or another since the r8152 driver was first introduced, though RTL8152_INACCESSIBLE was known as RTL8152_UNPLUG before commit 715f67f ("r8152: Rename RTL8152_UNPLUG to RTL8152_INACCESSIBLE") Fixes: ac718b6 ("net/usb: new driver for RTL8152") Reviewed-by: Grant Grundler <[email protected]> Signed-off-by: Douglas Anderson <[email protected]> Acked-by: Hayes Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e62adae commit 32a574c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/net/usb/r8152.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3000,6 +3000,8 @@ static void rtl8152_nic_reset(struct r8152 *tp)
30003000
ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CR, CR_RST);
30013001

30023002
for (i = 0; i < 1000; i++) {
3003+
if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
3004+
break;
30033005
if (!(ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CR) & CR_RST))
30043006
break;
30053007
usleep_range(100, 400);
@@ -3329,13 +3331,17 @@ static void rtl_disable(struct r8152 *tp)
33293331
rxdy_gated_en(tp, true);
33303332

33313333
for (i = 0; i < 1000; i++) {
3334+
if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
3335+
break;
33323336
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
33333337
if ((ocp_data & FIFO_EMPTY) == FIFO_EMPTY)
33343338
break;
33353339
usleep_range(1000, 2000);
33363340
}
33373341

33383342
for (i = 0; i < 1000; i++) {
3343+
if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
3344+
break;
33393345
if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_TCR0) & TCR0_TX_EMPTY)
33403346
break;
33413347
usleep_range(1000, 2000);
@@ -5499,6 +5505,8 @@ static void wait_oob_link_list_ready(struct r8152 *tp)
54995505
int i;
55005506

55015507
for (i = 0; i < 1000; i++) {
5508+
if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
5509+
break;
55025510
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
55035511
if (ocp_data & LINK_LIST_READY)
55045512
break;

0 commit comments

Comments
 (0)