ChangeSet 1.788, 2002/12/05 14:21:12-08:00, baldrick@wanadoo.fr [PATCH] usbdevfs: finalize urbs on interface release here is a patch for 2.4 that goes on top of the previous one. It cleans up the list handling, in line with Dave's comment. diff -Nru a/drivers/usb/devio.c b/drivers/usb/devio.c --- a/drivers/usb/devio.c Thu Dec 5 14:48:32 2002 +++ b/drivers/usb/devio.c Thu Dec 5 14:48:32 2002 @@ -205,8 +205,7 @@ unsigned long flags; spin_lock_irqsave(&ps->lock, flags); - list_del(&as->asynclist); - INIT_LIST_HEAD(&as->asynclist); + list_del_init(&as->asynclist); spin_unlock_irqrestore(&ps->lock, flags); } @@ -218,8 +217,7 @@ spin_lock_irqsave(&ps->lock, flags); if (!list_empty(&ps->async_completed)) { as = list_entry(ps->async_completed.next, struct async, asynclist); - list_del(&as->asynclist); - INIT_LIST_HEAD(&as->asynclist); + list_del_init(&as->asynclist); } spin_unlock_irqrestore(&ps->lock, flags); return as; @@ -237,8 +235,7 @@ p = p->next; if (as->userurb != userurb) continue; - list_del(&as->asynclist); - INIT_LIST_HEAD(&as->asynclist); + list_del_init(&as->asynclist); spin_unlock_irqrestore(&ps->lock, flags); return as; } @@ -253,8 +250,7 @@ struct siginfo sinfo; spin_lock(&ps->lock); - list_del(&as->asynclist); - list_add_tail(&as->asynclist, &ps->async_completed); + list_move_tail(&as->asynclist, &ps->async_completed); spin_unlock(&ps->lock); wake_up(&ps->wait); if (as->signr) { @@ -274,8 +270,7 @@ spin_lock_irqsave(&ps->lock, flags); while (!list_empty(list)) { as = list_entry(list->next, struct async, asynclist); - list_del(&as->asynclist); - INIT_LIST_HEAD(&as->asynclist); + list_del_init(&as->asynclist); spin_unlock_irqrestore(&ps->lock, flags); /* usb_unlink_urb calls the completion handler with status == USB_ST_URB_KILLED */ usb_unlink_urb(&as->urb); @@ -298,10 +293,8 @@ as = list_entry(p, struct async, asynclist); p = p->next; - if (as->intf == intf) { - list_del(&as->asynclist); - list_add_tail(&as->asynclist, &hitlist); - } + if (as->intf == intf) + list_move_tail(&as->asynclist, &hitlist); } spin_unlock_irqrestore(&ps->lock, flags); destroy_async(ps, &hitlist); @@ -546,8 +539,7 @@ unsigned int i; lock_kernel(); - list_del(&ps->list); - INIT_LIST_HEAD(&ps->list); + list_del_init(&ps->list); if (ps->dev) { for (i = 0; ps->ifclaimed && i < 8*sizeof(ps->ifclaimed); i++) if (test_bit(i, &ps->ifclaimed))