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