Commit 7b1585f2 authored by Geliang Tang's avatar Geliang Tang Committed by Greg Kroah-Hartman

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: default avatarGeliang Tang <geliangtang@163.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 553c2360
...@@ -981,7 +981,7 @@ static int qh_schedule(struct oxu_hcd *oxu, struct ehci_qh *qh); ...@@ -981,7 +981,7 @@ static int qh_schedule(struct oxu_hcd *oxu, struct ehci_qh *qh);
static unsigned qh_completions(struct oxu_hcd *oxu, struct ehci_qh *qh) static unsigned qh_completions(struct oxu_hcd *oxu, struct ehci_qh *qh)
{ {
struct ehci_qtd *last = NULL, *end = qh->dummy; struct ehci_qtd *last = NULL, *end = qh->dummy;
struct list_head *entry, *tmp; struct ehci_qtd *qtd, *tmp;
int stopped; int stopped;
unsigned count = 0; unsigned count = 0;
int do_status = 0; int do_status = 0;
...@@ -1006,12 +1006,10 @@ static unsigned qh_completions(struct oxu_hcd *oxu, struct ehci_qh *qh) ...@@ -1006,12 +1006,10 @@ static unsigned qh_completions(struct oxu_hcd *oxu, struct ehci_qh *qh)
* then let the queue advance. * then let the queue advance.
* if queue is stopped, handles unlinks. * if queue is stopped, handles unlinks.
*/ */
list_for_each_safe(entry, tmp, &qh->qtd_list) { list_for_each_entry_safe(qtd, tmp, &qh->qtd_list, qtd_list) {
struct ehci_qtd *qtd;
struct urb *urb; struct urb *urb;
u32 token = 0; u32 token = 0;
qtd = list_entry(entry, struct ehci_qtd, qtd_list);
urb = qtd->urb; urb = qtd->urb;
/* Clean up any state from previous QTD ...*/ /* Clean up any state from previous QTD ...*/
...@@ -1174,14 +1172,11 @@ static unsigned qh_completions(struct oxu_hcd *oxu, struct ehci_qh *qh) ...@@ -1174,14 +1172,11 @@ static unsigned qh_completions(struct oxu_hcd *oxu, struct ehci_qh *qh)
* used for cleanup after errors, before HC sees an URB's TDs. * used for cleanup after errors, before HC sees an URB's TDs.
*/ */
static void qtd_list_free(struct oxu_hcd *oxu, static void qtd_list_free(struct oxu_hcd *oxu,
struct urb *urb, struct list_head *qtd_list) struct urb *urb, struct list_head *head)
{ {
struct list_head *entry, *temp; struct ehci_qtd *qtd, *temp;
list_for_each_safe(entry, temp, qtd_list) {
struct ehci_qtd *qtd;
qtd = list_entry(entry, struct ehci_qtd, qtd_list); list_for_each_entry_safe(qtd, temp, head, qtd_list) {
list_del(&qtd->qtd_list); list_del(&qtd->qtd_list);
oxu_qtd_free(oxu, qtd); oxu_qtd_free(oxu, qtd);
} }
......
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