@@ -412,9 +412,12 @@ static void acm_ctrl_irq(struct urb *urb)
412
412
413
413
exit :
414
414
retval = usb_submit_urb (urb , GFP_ATOMIC );
415
- if (retval && retval != - EPERM )
415
+ if (retval && retval != - EPERM && retval != - ENODEV )
416
416
dev_err (& acm -> control -> dev ,
417
417
"%s - usb_submit_urb failed: %d\n" , __func__ , retval );
418
+ else
419
+ dev_vdbg (& acm -> control -> dev ,
420
+ "control resubmission terminated %d\n" , retval );
418
421
}
419
422
420
423
static int acm_submit_read_urb (struct acm * acm , int index , gfp_t mem_flags )
@@ -430,6 +433,8 @@ static int acm_submit_read_urb(struct acm *acm, int index, gfp_t mem_flags)
430
433
dev_err (& acm -> data -> dev ,
431
434
"urb %d failed submission with %d\n" ,
432
435
index , res );
436
+ } else {
437
+ dev_vdbg (& acm -> data -> dev , "intended failure %d\n" , res );
433
438
}
434
439
set_bit (index , & acm -> read_urbs_free );
435
440
return res ;
@@ -471,6 +476,7 @@ static void acm_read_bulk_callback(struct urb *urb)
471
476
int status = urb -> status ;
472
477
bool stopped = false;
473
478
bool stalled = false;
479
+ bool cooldown = false;
474
480
475
481
dev_vdbg (& acm -> data -> dev , "got urb %d, len %d, status %d\n" ,
476
482
rb -> index , urb -> actual_length , status );
@@ -497,6 +503,14 @@ static void acm_read_bulk_callback(struct urb *urb)
497
503
__func__ , status );
498
504
stopped = true;
499
505
break ;
506
+ case - EOVERFLOW :
507
+ case - EPROTO :
508
+ dev_dbg (& acm -> data -> dev ,
509
+ "%s - cooling babbling device\n" , __func__ );
510
+ usb_mark_last_busy (acm -> dev );
511
+ set_bit (rb -> index , & acm -> urbs_in_error_delay );
512
+ cooldown = true;
513
+ break ;
500
514
default :
501
515
dev_dbg (& acm -> data -> dev ,
502
516
"%s - nonzero urb status received: %d\n" ,
@@ -518,9 +532,11 @@ static void acm_read_bulk_callback(struct urb *urb)
518
532
*/
519
533
smp_mb__after_atomic ();
520
534
521
- if (stopped || stalled ) {
535
+ if (stopped || stalled || cooldown ) {
522
536
if (stalled )
523
537
schedule_work (& acm -> work );
538
+ else if (cooldown )
539
+ schedule_delayed_work (& acm -> dwork , HZ / 2 );
524
540
return ;
525
541
}
526
542
@@ -567,6 +583,12 @@ static void acm_softint(struct work_struct *work)
567
583
}
568
584
}
569
585
586
+ if (test_and_clear_bit (ACM_ERROR_DELAY , & acm -> flags )) {
587
+ for (i = 0 ; i < ACM_NR ; i ++ )
588
+ if (test_and_clear_bit (i , & acm -> urbs_in_error_delay ))
589
+ acm_submit_read_urb (acm , i , GFP_NOIO );
590
+ }
591
+
570
592
if (test_and_clear_bit (EVENT_TTY_WAKEUP , & acm -> flags ))
571
593
tty_port_tty_wakeup (& acm -> port );
572
594
}
@@ -1333,6 +1355,7 @@ static int acm_probe(struct usb_interface *intf,
1333
1355
acm -> readsize = readsize ;
1334
1356
acm -> rx_buflimit = num_rx_buf ;
1335
1357
INIT_WORK (& acm -> work , acm_softint );
1358
+ INIT_DELAYED_WORK (& acm -> dwork , acm_softint );
1336
1359
init_waitqueue_head (& acm -> wioctl );
1337
1360
spin_lock_init (& acm -> write_lock );
1338
1361
spin_lock_init (& acm -> read_lock );
@@ -1542,6 +1565,7 @@ static void acm_disconnect(struct usb_interface *intf)
1542
1565
1543
1566
acm_kill_urbs (acm );
1544
1567
cancel_work_sync (& acm -> work );
1568
+ cancel_delayed_work_sync (& acm -> dwork );
1545
1569
1546
1570
tty_unregister_device (acm_tty_driver , acm -> minor );
1547
1571
@@ -1584,6 +1608,8 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message)
1584
1608
1585
1609
acm_kill_urbs (acm );
1586
1610
cancel_work_sync (& acm -> work );
1611
+ cancel_delayed_work_sync (& acm -> dwork );
1612
+ acm -> urbs_in_error_delay = 0 ;
1587
1613
1588
1614
return 0 ;
1589
1615
}
0 commit comments