On Wednesday 20 November 2002 07:24, Greg KH wrote:
> On Tue, Nov 19, 2002 at 01:49:20PM +0100, Duncan Sands wrote:
> > Patch against 2.4.20-rc1.
> >
> > Greg, please apply.
>
> Applied, thanks. Could you also make a 2.5 version of this patch?
Yes. In the meantime, 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.
Duncan.
--- linux/drivers/usb/devio.c.new 2002-11-21 20:53:24.000000000 +0100
+++ linux/drivers/usb/devio.c 2002-11-21 20:57:43.000000000 +0100
@@ -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))