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

usb: host: oxu210hp-hcd: use list_for_each_entry_safe

Use list_for_each_entry_safe() instead of list_for_each_safe() 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
7b1585f2 553c2360

+5 -10
+5 -10
drivers/usb/host/oxu210hp-hcd.c
··· 981 981 static unsigned qh_completions(struct oxu_hcd *oxu, struct ehci_qh *qh) 982 982 { 983 983 struct ehci_qtd *last = NULL, *end = qh->dummy; 984 - struct list_head *entry, *tmp; 984 + struct ehci_qtd *qtd, *tmp; 985 985 int stopped; 986 986 unsigned count = 0; 987 987 int do_status = 0; ··· 1006 1006 * then let the queue advance. 1007 1007 * if queue is stopped, handles unlinks. 1008 1008 */ 1009 - list_for_each_safe(entry, tmp, &qh->qtd_list) { 1010 - struct ehci_qtd *qtd; 1009 + list_for_each_entry_safe(qtd, tmp, &qh->qtd_list, qtd_list) { 1011 1010 struct urb *urb; 1012 1011 u32 token = 0; 1013 1012 1014 - qtd = list_entry(entry, struct ehci_qtd, qtd_list); 1015 1013 urb = qtd->urb; 1016 1014 1017 1015 /* Clean up any state from previous QTD ...*/ ··· 1172 1174 * used for cleanup after errors, before HC sees an URB's TDs. 1173 1175 */ 1174 1176 static void qtd_list_free(struct oxu_hcd *oxu, 1175 - struct urb *urb, struct list_head *qtd_list) 1177 + struct urb *urb, struct list_head *head) 1176 1178 { 1177 - struct list_head *entry, *temp; 1179 + struct ehci_qtd *qtd, *temp; 1178 1180 1179 - list_for_each_safe(entry, temp, qtd_list) { 1180 - struct ehci_qtd *qtd; 1181 - 1182 - qtd = list_entry(entry, struct ehci_qtd, qtd_list); 1181 + list_for_each_entry_safe(qtd, temp, head, qtd_list) { 1183 1182 list_del(&qtd->qtd_list); 1184 1183 oxu_qtd_free(oxu, qtd); 1185 1184 }