提交 179e0917 编写于 作者: A Akinobu Mita 提交者: Linus Torvalds

[PATCH] drivers: use list_move()

This patch converts the combination of list_del(A) and list_add(A, B) to
list_move(A, B) under drivers/.
Acked-by: NCorey Minyard <minyard@mvista.com>
Cc: Ben Collins <bcollins@debian.org>
Acked-by: NRoland Dreier <rolandd@cisco.com>
Cc: Alasdair Kergon <dm-devel@redhat.com>
Cc: Gerd Knorr <kraxel@bytesex.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frank Pavlic <fpavlic@de.ibm.com>
Acked-by: NMatthew Wilcox <matthew@wil.cx>
Cc: Andrew Vasquez <linux-driver@qlogic.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: NAkinobu Mita <mita@miraclelinux.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 a842ef29
...@@ -936,11 +936,8 @@ int ipmi_set_gets_events(ipmi_user_t user, int val) ...@@ -936,11 +936,8 @@ int ipmi_set_gets_events(ipmi_user_t user, int val)
if (val) { if (val) {
/* Deliver any queued events. */ /* Deliver any queued events. */
list_for_each_entry_safe(msg, msg2, &intf->waiting_events, list_for_each_entry_safe(msg, msg2, &intf->waiting_events, link)
link) { list_move_tail(&msg->link, &msgs);
list_del(&msg->link);
list_add_tail(&msg->link, &msgs);
}
intf->waiting_events_count = 0; intf->waiting_events_count = 0;
} }
......
...@@ -1074,8 +1074,7 @@ static inline int update_partial_datagram(struct list_head *pdgl, struct list_he ...@@ -1074,8 +1074,7 @@ static inline int update_partial_datagram(struct list_head *pdgl, struct list_he
/* Move list entry to beginnig of list so that oldest partial /* Move list entry to beginnig of list so that oldest partial
* datagrams percolate to the end of the list */ * datagrams percolate to the end of the list */
list_del(lh); list_move(lh, pdgl);
list_add(lh, pdgl);
return 0; return 0;
} }
......
...@@ -132,8 +132,7 @@ static void free_pending_request(struct pending_request *req) ...@@ -132,8 +132,7 @@ static void free_pending_request(struct pending_request *req)
static void __queue_complete_req(struct pending_request *req) static void __queue_complete_req(struct pending_request *req)
{ {
struct file_info *fi = req->file_info; struct file_info *fi = req->file_info;
list_del(&req->list); list_move_tail(&req->list, &fi->req_complete);
list_add_tail(&req->list, &fi->req_complete);
up(&fi->complete_sem); up(&fi->complete_sem);
wake_up_interruptible(&fi->poll_wait_complete); wake_up_interruptible(&fi->poll_wait_complete);
......
...@@ -1775,11 +1775,9 @@ ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv, ...@@ -1775,11 +1775,9 @@ ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv,
void ib_mark_mad_done(struct ib_mad_send_wr_private *mad_send_wr) void ib_mark_mad_done(struct ib_mad_send_wr_private *mad_send_wr)
{ {
mad_send_wr->timeout = 0; mad_send_wr->timeout = 0;
if (mad_send_wr->refcount == 1) { if (mad_send_wr->refcount == 1)
list_del(&mad_send_wr->agent_list); list_move_tail(&mad_send_wr->agent_list,
list_add_tail(&mad_send_wr->agent_list,
&mad_send_wr->mad_agent_priv->done_list); &mad_send_wr->mad_agent_priv->done_list);
}
} }
static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv,
...@@ -2098,8 +2096,7 @@ static void ib_mad_send_done_handler(struct ib_mad_port_private *port_priv, ...@@ -2098,8 +2096,7 @@ static void ib_mad_send_done_handler(struct ib_mad_port_private *port_priv,
queued_send_wr = container_of(mad_list, queued_send_wr = container_of(mad_list,
struct ib_mad_send_wr_private, struct ib_mad_send_wr_private,
mad_list); mad_list);
list_del(&mad_list->list); list_move_tail(&mad_list->list, &send_queue->list);
list_add_tail(&mad_list->list, &send_queue->list);
} }
spin_unlock_irqrestore(&send_queue->lock, flags); spin_unlock_irqrestore(&send_queue->lock, flags);
......
...@@ -665,8 +665,7 @@ static void process_rmpp_ack(struct ib_mad_agent_private *agent, ...@@ -665,8 +665,7 @@ static void process_rmpp_ack(struct ib_mad_agent_private *agent,
goto out; goto out;
mad_send_wr->refcount++; mad_send_wr->refcount++;
list_del(&mad_send_wr->agent_list); list_move_tail(&mad_send_wr->agent_list,
list_add_tail(&mad_send_wr->agent_list,
&mad_send_wr->mad_agent_priv->send_list); &mad_send_wr->mad_agent_priv->send_list);
} }
out: out:
......
...@@ -864,8 +864,7 @@ void ipoib_mcast_restart_task(void *dev_ptr) ...@@ -864,8 +864,7 @@ void ipoib_mcast_restart_task(void *dev_ptr)
if (mcast) { if (mcast) {
/* Destroy the send only entry */ /* Destroy the send only entry */
list_del(&mcast->list); list_move_tail(&mcast->list, &remove_list);
list_add_tail(&mcast->list, &remove_list);
rb_replace_node(&mcast->rb_node, rb_replace_node(&mcast->rb_node,
&nmcast->rb_node, &nmcast->rb_node,
...@@ -890,8 +889,7 @@ void ipoib_mcast_restart_task(void *dev_ptr) ...@@ -890,8 +889,7 @@ void ipoib_mcast_restart_task(void *dev_ptr)
rb_erase(&mcast->rb_node, &priv->multicast_tree); rb_erase(&mcast->rb_node, &priv->multicast_tree);
/* Move to the remove list */ /* Move to the remove list */
list_del(&mcast->list); list_move_tail(&mcast->list, &remove_list);
list_add_tail(&mcast->list, &remove_list);
} }
} }
......
...@@ -458,11 +458,9 @@ static int __rh_recovery_prepare(struct region_hash *rh) ...@@ -458,11 +458,9 @@ static int __rh_recovery_prepare(struct region_hash *rh)
/* Already quiesced ? */ /* Already quiesced ? */
if (atomic_read(&reg->pending)) if (atomic_read(&reg->pending))
list_del_init(&reg->list); list_del_init(&reg->list);
else
list_move(&reg->list, &rh->quiesced_regions);
else {
list_del_init(&reg->list);
list_add(&reg->list, &rh->quiesced_regions);
}
spin_unlock_irq(&rh->region_lock); spin_unlock_irq(&rh->region_lock);
return 1; return 1;
......
...@@ -494,8 +494,7 @@ static int restart_video_queue(struct cx8800_dev *dev, ...@@ -494,8 +494,7 @@ static int restart_video_queue(struct cx8800_dev *dev,
return 0; return 0;
buf = list_entry(q->queued.next, struct cx88_buffer, vb.queue); buf = list_entry(q->queued.next, struct cx88_buffer, vb.queue);
if (NULL == prev) { if (NULL == prev) {
list_del(&buf->vb.queue); list_move_tail(&buf->vb.queue, &q->active);
list_add_tail(&buf->vb.queue,&q->active);
start_video_dma(dev, q, buf); start_video_dma(dev, q, buf);
buf->vb.state = STATE_ACTIVE; buf->vb.state = STATE_ACTIVE;
buf->count = q->count++; buf->count = q->count++;
...@@ -506,8 +505,7 @@ static int restart_video_queue(struct cx8800_dev *dev, ...@@ -506,8 +505,7 @@ static int restart_video_queue(struct cx8800_dev *dev,
} else if (prev->vb.width == buf->vb.width && } else if (prev->vb.width == buf->vb.width &&
prev->vb.height == buf->vb.height && prev->vb.height == buf->vb.height &&
prev->fmt == buf->fmt) { prev->fmt == buf->fmt) {
list_del(&buf->vb.queue); list_move_tail(&buf->vb.queue, &q->active);
list_add_tail(&buf->vb.queue,&q->active);
buf->vb.state = STATE_ACTIVE; buf->vb.state = STATE_ACTIVE;
buf->count = q->count++; buf->count = q->count++;
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
......
...@@ -2578,8 +2578,7 @@ ppp_find_channel(int unit) ...@@ -2578,8 +2578,7 @@ ppp_find_channel(int unit)
list_for_each_entry(pch, &new_channels, list) { list_for_each_entry(pch, &new_channels, list) {
if (pch->file.index == unit) { if (pch->file.index == unit) {
list_del(&pch->list); list_move(&pch->list, &all_channels);
list_add(&pch->list, &all_channels);
return pch; return pch;
} }
} }
......
...@@ -1140,10 +1140,9 @@ lcs_fix_multicast_list(struct lcs_card *card) ...@@ -1140,10 +1140,9 @@ lcs_fix_multicast_list(struct lcs_card *card)
} }
} }
/* re-insert all entries from the failed_list into ipm_list */ /* re-insert all entries from the failed_list into ipm_list */
list_for_each_entry_safe(ipm, tmp, &failed_list, list) { list_for_each_entry_safe(ipm, tmp, &failed_list, list)
list_del_init(&ipm->list); list_move_tail(&ipm->list, &card->ipm_list);
list_add_tail(&ipm->list, &card->ipm_list);
}
spin_unlock_irqrestore(&card->ipm_lock, flags); spin_unlock_irqrestore(&card->ipm_lock, flags);
} }
......
...@@ -5118,8 +5118,7 @@ static void ncr_ccb_skipped(struct ncb *np, struct ccb *cp) ...@@ -5118,8 +5118,7 @@ static void ncr_ccb_skipped(struct ncb *np, struct ccb *cp)
cp->host_status &= ~HS_SKIPMASK; cp->host_status &= ~HS_SKIPMASK;
cp->start.schedule.l_paddr = cp->start.schedule.l_paddr =
cpu_to_scr(NCB_SCRIPT_PHYS (np, select)); cpu_to_scr(NCB_SCRIPT_PHYS (np, select));
list_del(&cp->link_ccbq); list_move_tail(&cp->link_ccbq, &lp->skip_ccbq);
list_add_tail(&cp->link_ccbq, &lp->skip_ccbq);
if (cp->queued) { if (cp->queued) {
--lp->queuedccbs; --lp->queuedccbs;
} }
......
...@@ -2258,8 +2258,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha) ...@@ -2258,8 +2258,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha)
} }
/* Remove device from the new list and add it to DB */ /* Remove device from the new list and add it to DB */
list_del(&fcport->list); list_move_tail(&fcport->list, &ha->fcports);
list_add_tail(&fcport->list, &ha->fcports);
/* Login and update database */ /* Login and update database */
qla2x00_fabric_dev_login(ha, fcport, &next_loopid); qla2x00_fabric_dev_login(ha, fcport, &next_loopid);
......
...@@ -411,8 +411,7 @@ static inline void urb_list_move_last(struct urb *urb, int epid) ...@@ -411,8 +411,7 @@ static inline void urb_list_move_last(struct urb *urb, int epid)
urb_entry_t *urb_entry = __urb_list_entry(urb, epid); urb_entry_t *urb_entry = __urb_list_entry(urb, epid);
assert(urb_entry); assert(urb_entry);
list_del(&urb_entry->list); list_move_tail(&urb_entry->list, &urb_list[epid]);
list_add_tail(&urb_entry->list, &urb_list[epid]);
} }
/* Get the next urb in the list. */ /* Get the next urb in the list. */
......
...@@ -686,19 +686,16 @@ static void whiteheat_close(struct usb_serial_port *port, struct file * filp) ...@@ -686,19 +686,16 @@ static void whiteheat_close(struct usb_serial_port *port, struct file * filp)
wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); wrap = list_entry(tmp, struct whiteheat_urb_wrap, list);
urb = wrap->urb; urb = wrap->urb;
usb_kill_urb(urb); usb_kill_urb(urb);
list_del(tmp); list_move(tmp, &info->rx_urbs_free);
list_add(tmp, &info->rx_urbs_free);
}
list_for_each_safe(tmp, tmp2, &info->rx_urb_q) {
list_del(tmp);
list_add(tmp, &info->rx_urbs_free);
} }
list_for_each_safe(tmp, tmp2, &info->rx_urb_q)
list_move(tmp, &info->rx_urbs_free);
list_for_each_safe(tmp, tmp2, &info->tx_urbs_submitted) { list_for_each_safe(tmp, tmp2, &info->tx_urbs_submitted) {
wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); wrap = list_entry(tmp, struct whiteheat_urb_wrap, list);
urb = wrap->urb; urb = wrap->urb;
usb_kill_urb(urb); usb_kill_urb(urb);
list_del(tmp); list_move(tmp, &info->tx_urbs_free);
list_add(tmp, &info->tx_urbs_free);
} }
spin_unlock_irqrestore(&info->lock, flags); spin_unlock_irqrestore(&info->lock, flags);
...@@ -1080,8 +1077,7 @@ static void whiteheat_write_callback(struct urb *urb, struct pt_regs *regs) ...@@ -1080,8 +1077,7 @@ static void whiteheat_write_callback(struct urb *urb, struct pt_regs *regs)
err("%s - Not my urb!", __FUNCTION__); err("%s - Not my urb!", __FUNCTION__);
return; return;
} }
list_del(&wrap->list); list_move(&wrap->list, &info->tx_urbs_free);
list_add(&wrap->list, &info->tx_urbs_free);
spin_unlock(&info->lock); spin_unlock(&info->lock);
if (urb->status) { if (urb->status) {
...@@ -1371,8 +1367,7 @@ static int start_port_read(struct usb_serial_port *port) ...@@ -1371,8 +1367,7 @@ static int start_port_read(struct usb_serial_port *port)
wrap = list_entry(tmp, struct whiteheat_urb_wrap, list); wrap = list_entry(tmp, struct whiteheat_urb_wrap, list);
urb = wrap->urb; urb = wrap->urb;
usb_kill_urb(urb); usb_kill_urb(urb);
list_del(tmp); list_move(tmp, &info->rx_urbs_free);
list_add(tmp, &info->rx_urbs_free);
} }
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册