Commit 77cb93d3 authored by Lightweight Patch Manager's avatar Lightweight Patch Manager Committed by Greg Kroah-Hartman

[PATCH] new list macros for USB

This is a collected patch for USB drivers to use the new list macros
(list_del_init, list_move*).
parent 8b2ada12
...@@ -215,8 +215,7 @@ extern __inline__ void async_removepending(struct async *as) ...@@ -215,8 +215,7 @@ extern __inline__ void async_removepending(struct async *as)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&ps->lock, flags); spin_lock_irqsave(&ps->lock, flags);
list_del(&as->asynclist); list_del_init(&as->asynclist);
INIT_LIST_HEAD(&as->asynclist);
spin_unlock_irqrestore(&ps->lock, flags); spin_unlock_irqrestore(&ps->lock, flags);
} }
...@@ -228,8 +227,7 @@ extern __inline__ struct async *async_getcompleted(struct dev_state *ps) ...@@ -228,8 +227,7 @@ extern __inline__ struct async *async_getcompleted(struct dev_state *ps)
spin_lock_irqsave(&ps->lock, flags); spin_lock_irqsave(&ps->lock, flags);
if (!list_empty(&ps->async_completed)) { if (!list_empty(&ps->async_completed)) {
as = list_entry(ps->async_completed.next, struct async, asynclist); as = list_entry(ps->async_completed.next, struct async, asynclist);
list_del(&as->asynclist); list_del_init(&as->asynclist);
INIT_LIST_HEAD(&as->asynclist);
} }
spin_unlock_irqrestore(&ps->lock, flags); spin_unlock_irqrestore(&ps->lock, flags);
return as; return as;
...@@ -247,8 +245,7 @@ extern __inline__ struct async *async_getpending(struct dev_state *ps, void *use ...@@ -247,8 +245,7 @@ extern __inline__ struct async *async_getpending(struct dev_state *ps, void *use
p = p->next; p = p->next;
if (as->userurb != userurb) if (as->userurb != userurb)
continue; continue;
list_del(&as->asynclist); list_del_init(&as->asynclist);
INIT_LIST_HEAD(&as->asynclist);
spin_unlock_irqrestore(&ps->lock, flags); spin_unlock_irqrestore(&ps->lock, flags);
return as; return as;
} }
...@@ -263,8 +260,7 @@ static void async_completed(struct urb *urb) ...@@ -263,8 +260,7 @@ static void async_completed(struct urb *urb)
struct siginfo sinfo; struct siginfo sinfo;
spin_lock(&ps->lock); spin_lock(&ps->lock);
list_del(&as->asynclist); list_move_tail(&as->asynclist, &ps->async_completed);
list_add_tail(&as->asynclist, &ps->async_completed);
spin_unlock(&ps->lock); spin_unlock(&ps->lock);
wake_up(&ps->wait); wake_up(&ps->wait);
if (as->signr) { if (as->signr) {
...@@ -284,8 +280,7 @@ static void destroy_all_async(struct dev_state *ps) ...@@ -284,8 +280,7 @@ static void destroy_all_async(struct dev_state *ps)
spin_lock_irqsave(&ps->lock, flags); spin_lock_irqsave(&ps->lock, flags);
while (!list_empty(&ps->async_pending)) { while (!list_empty(&ps->async_pending)) {
as = list_entry(ps->async_pending.next, struct async, asynclist); as = list_entry(ps->async_pending.next, struct async, asynclist);
list_del(&as->asynclist); list_del_init(&as->asynclist);
INIT_LIST_HEAD(&as->asynclist);
spin_unlock_irqrestore(&ps->lock, flags); spin_unlock_irqrestore(&ps->lock, flags);
/* usb_unlink_urb calls the completion handler with status == -ENOENT */ /* usb_unlink_urb calls the completion handler with status == -ENOENT */
usb_unlink_urb(as->urb); usb_unlink_urb(as->urb);
...@@ -528,8 +523,8 @@ static int usbdev_release(struct inode *inode, struct file *file) ...@@ -528,8 +523,8 @@ static int usbdev_release(struct inode *inode, struct file *file)
unsigned int i; unsigned int i;
lock_kernel(); lock_kernel();
list_del(&ps->list); list_del_init(&ps->list);
INIT_LIST_HEAD(&ps->list);
if (ps->dev) { if (ps->dev) {
for (i = 0; ps->ifclaimed && i < 8*sizeof(ps->ifclaimed); i++) for (i = 0; ps->ifclaimed && i < 8*sizeof(ps->ifclaimed); i++)
if (test_bit(i, &ps->ifclaimed)) if (test_bit(i, &ps->ifclaimed))
......
...@@ -220,14 +220,12 @@ static int hci_unlink_urb (struct urb * urb) ...@@ -220,14 +220,12 @@ static int hci_unlink_urb (struct urb * urb)
/* URB active? */ /* URB active? */
if (urb->transfer_flags & (USB_ASYNC_UNLINK | USB_TIMEOUT_KILLED)) { if (urb->transfer_flags & (USB_ASYNC_UNLINK | USB_TIMEOUT_KILLED)) {
/* asynchron with callback */ /* asynchronous with callback */
/* relink the urb to the del list */
list_del (&urb->urb_list); /* relink the urb to the del list */ list_move (&urb->urb_list, &hci->del_list);
list_add (&urb->urb_list, &hci->del_list);
spin_unlock_irqrestore (&usb_urb_lock, flags); spin_unlock_irqrestore (&usb_urb_lock, flags);
} else { } else {
/* synchron without callback */ /* synchronous without callback */
add_wait_queue (&hci->waitq, &wait); add_wait_queue (&hci->waitq, &wait);
...@@ -235,8 +233,8 @@ static int hci_unlink_urb (struct urb * urb) ...@@ -235,8 +233,8 @@ static int hci_unlink_urb (struct urb * urb)
comp = urb->complete; comp = urb->complete;
urb->complete = NULL; urb->complete = NULL;
list_del (&urb->urb_list); /* relink the urb to the del list */ /* relink the urb to the del list */
list_add (&urb->urb_list, &hci->del_list); list_move(&urb->urb_list, &hci->del_list);
spin_unlock_irqrestore (&usb_urb_lock, flags); spin_unlock_irqrestore (&usb_urb_lock, flags);
...@@ -560,10 +558,9 @@ static struct urb *qu_next_urb (hci_t * hci, struct urb * urb, int resub_ok) ...@@ -560,10 +558,9 @@ static struct urb *qu_next_urb (hci_t * hci, struct urb * urb, int resub_ok)
epd_t *ed = &hci_dev->ed[qu_pipeindex (urb->pipe)]; epd_t *ed = &hci_dev->ed[qu_pipeindex (urb->pipe)];
DBGFUNC ("enter qu_next_urb\n"); DBGFUNC ("enter qu_next_urb\n");
list_del (&urb->urb_list); list_del_init(&urb->urb_list);
INIT_LIST_HEAD (&urb->urb_list);
if (ed->pipe_head == urb) {
if (ed->pipe_head == urb) {
#ifdef HC_URB_TIMEOUT #ifdef HC_URB_TIMEOUT
if (urb->timeout) if (urb->timeout)
del_timer (&ed->timeout); del_timer (&ed->timeout);
...@@ -574,8 +571,7 @@ static struct urb *qu_next_urb (hci_t * hci, struct urb * urb, int resub_ok) ...@@ -574,8 +571,7 @@ static struct urb *qu_next_urb (hci_t * hci, struct urb * urb, int resub_ok)
if (!list_empty (&ed->urb_queue)) { if (!list_empty (&ed->urb_queue)) {
urb = list_entry (ed->urb_queue.next, struct urb, urb_list); urb = list_entry (ed->urb_queue.next, struct urb, urb_list);
list_del (&urb->urb_list); list_del_init (&urb->urb_list);
INIT_LIST_HEAD (&urb->urb_list);
ed->pipe_head = urb; ed->pipe_head = urb;
qu_queue_active_urb (hci, urb, ed); qu_queue_active_urb (hci, urb, ed);
} else { } else {
...@@ -756,8 +752,7 @@ static int sh_schedule_trans (hci_t * hci, int isSOF) ...@@ -756,8 +752,7 @@ static int sh_schedule_trans (hci_t * hci, int isSOF)
* only when the new SOF happens */ * only when the new SOF happens */
lh = hci->bulk_list.next; lh = hci->bulk_list.next;
list_del (&hci->bulk_list); list_move (&hci->bulk_list, lh);
list_add (&hci->bulk_list, lh);
} }
return 0; return 0;
} }
......
...@@ -1773,10 +1773,8 @@ static void stall_callback(unsigned long ptr) ...@@ -1773,10 +1773,8 @@ static void stall_callback(unsigned long ptr)
uhci_fsbr_timeout(uhci, u); uhci_fsbr_timeout(uhci, u);
/* Check if the URB timed out */ /* Check if the URB timed out */
if (u->timeout && time_after_eq(jiffies, up->inserttime + u->timeout)) { if (u->timeout && time_after_eq(jiffies, up->inserttime + u->timeout))
list_del(&up->urb_list); list_move_tail(&up->urb_list, &list);
list_add_tail(&up->urb_list, &list);
}
spin_unlock(&u->lock); spin_unlock(&u->lock);
} }
......
...@@ -2008,10 +2008,8 @@ static void rh_int_timer_do(unsigned long ptr) ...@@ -2008,10 +2008,8 @@ static void rh_int_timer_do(unsigned long ptr)
uhci_fsbr_timeout(uhci, u); uhci_fsbr_timeout(uhci, u);
/* Check if the URB timed out */ /* Check if the URB timed out */
if (u->timeout && time_after_eq(jiffies, up->inserttime + u->timeout)) { if (u->timeout && time_after_eq(jiffies, up->inserttime + u->timeout))
list_del(&u->urb_list); list_move_tail(&u->urb_list, &list);
list_add_tail(&u->urb_list, &list);
}
spin_unlock(&u->lock); spin_unlock(&u->lock);
} }
......
...@@ -80,8 +80,7 @@ static int dabusb_add_buf_tail (pdabusb_t s, struct list_head *dst, struct list_ ...@@ -80,8 +80,7 @@ static int dabusb_add_buf_tail (pdabusb_t s, struct list_head *dst, struct list_
goto err; goto err;
} }
tmp = src->next; tmp = src->next;
list_del (tmp); list_move_tail (tmp, dst);
list_add_tail (tmp, dst);
err: spin_unlock_irqrestore (&s->lock, flags); err: spin_unlock_irqrestore (&s->lock, flags);
return ret; return ret;
......
...@@ -401,8 +401,7 @@ static void ipaq_write_gather(struct usb_serial_port *port) ...@@ -401,8 +401,7 @@ static void ipaq_write_gather(struct usb_serial_port *port)
pkt->written += count; pkt->written += count;
priv->queue_len -= count; priv->queue_len -= count;
if (pkt->written == pkt->len) { if (pkt->written == pkt->len) {
list_del(&pkt->list); list_move(&pkt->list, &priv->freelist);
list_add(&pkt->list, &priv->freelist);
priv->free_len += PACKET_SIZE; priv->free_len += PACKET_SIZE;
} }
if (room == 0) { if (room == 0) {
......
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