Commit bff18c81 authored by Duncan Sands's avatar Duncan Sands Committed by Greg Kroah-Hartman

[PATCH] usbfs: more list cleanups

Here is a small cleanup patch for 2.5 that goes on top of my previous
ones.  It makes devio.c use the list traversal macros from list.h.
parent 201d0a4a
...@@ -239,18 +239,14 @@ extern __inline__ struct async *async_getpending(struct dev_state *ps, void *use ...@@ -239,18 +239,14 @@ extern __inline__ struct async *async_getpending(struct dev_state *ps, void *use
{ {
unsigned long flags; unsigned long flags;
struct async *as; struct async *as;
struct list_head *p;
spin_lock_irqsave(&ps->lock, flags); spin_lock_irqsave(&ps->lock, flags);
for (p = ps->async_pending.next; p != &ps->async_pending; ) { list_for_each_entry(as, &ps->async_pending, asynclist)
as = list_entry(p, struct async, asynclist); if (as->userurb == userurb) {
p = p->next; list_del_init(&as->asynclist);
if (as->userurb != userurb) spin_unlock_irqrestore(&ps->lock, flags);
continue; return as;
list_del_init(&as->asynclist); }
spin_unlock_irqrestore(&ps->lock, flags);
return as;
}
spin_unlock_irqrestore(&ps->lock, flags); spin_unlock_irqrestore(&ps->lock, flags);
return NULL; return NULL;
} }
...@@ -295,19 +291,14 @@ static void destroy_async (struct dev_state *ps, struct list_head *list) ...@@ -295,19 +291,14 @@ static void destroy_async (struct dev_state *ps, struct list_head *list)
static void destroy_async_on_interface (struct dev_state *ps, unsigned int intf) static void destroy_async_on_interface (struct dev_state *ps, unsigned int intf)
{ {
struct async *as; struct list_head *p, *q, hitlist;
struct list_head *p, hitlist;
unsigned long flags; unsigned long flags;
INIT_LIST_HEAD(&hitlist); INIT_LIST_HEAD(&hitlist);
spin_lock_irqsave(&ps->lock, flags); spin_lock_irqsave(&ps->lock, flags);
for (p = ps->async_pending.next; p != &ps->async_pending; ) { list_for_each_safe(p, q, &ps->async_pending)
as = list_entry(p, struct async, asynclist); if (intf == list_entry(p, struct async, asynclist)->intf)
p = p->next; list_move_tail(p, &hitlist);
if (as->intf == intf)
list_move_tail(&as->asynclist, &hitlist);
}
spin_unlock_irqrestore(&ps->lock, flags); spin_unlock_irqrestore(&ps->lock, flags);
destroy_async(ps, &hitlist); destroy_async(ps, &hitlist);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment