Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: host: u132-hcd: use list_for_each_entry

Use list_for_each_entry() instead of list_for_each() to simplify
the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Geliang Tang and committed by
Greg Kroah-Hartman
4e5d7a82 7b1585f2

+6 -12
+6 -12
drivers/usb/host/u132-hcd.c
··· 1309 1309 u132_ring_put_kref(u132, ring); 1310 1310 return; 1311 1311 } else if (ring->curr_endp) { 1312 - struct u132_endp *last_endp = ring->curr_endp; 1313 - struct list_head *scan; 1314 - struct list_head *head = &last_endp->endp_ring; 1312 + struct u132_endp *endp, *last_endp = ring->curr_endp; 1315 1313 unsigned long wakeup = 0; 1316 - list_for_each(scan, head) { 1317 - struct u132_endp *endp = list_entry(scan, 1318 - struct u132_endp, endp_ring); 1314 + list_for_each_entry(endp, &last_endp->endp_ring, endp_ring) { 1319 1315 if (endp->queue_next == endp->queue_last) { 1320 1316 } else if ((endp->delayed == 0) 1321 1317 || time_after_eq(jiffies, endp->jiffies)) { ··· 2389 2393 static int dequeue_from_overflow_chain(struct u132 *u132, 2390 2394 struct u132_endp *endp, struct urb *urb) 2391 2395 { 2392 - struct list_head *scan; 2393 - struct list_head *head = &endp->urb_more; 2394 - list_for_each(scan, head) { 2395 - struct u132_urbq *urbq = list_entry(scan, struct u132_urbq, 2396 - urb_more); 2396 + struct u132_urbq *urbq; 2397 + 2398 + list_for_each_entry(urbq, &endp->urb_more, urb_more) { 2397 2399 if (urbq->urb == urb) { 2398 2400 struct usb_hcd *hcd = u132_to_hcd(u132); 2399 - list_del(scan); 2401 + list_del(&urbq->urb_more); 2400 2402 endp->queue_size -= 1; 2401 2403 urb->error_count = 0; 2402 2404 usb_hcd_giveback_urb(hcd, urb, 0);