Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1295014 > unrolled thread
| Started by | Geliang Tang <geliangtang@163.com> |
|---|---|
| First post | 2015-12-18 17:40 +0100 |
| Last post | 2015-12-23 15:00 +0100 |
| Articles | 9 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH 1/9] usb: host: fotg210: use list_for_each_entry_safe Geliang Tang <geliangtang@163.com> - 2015-12-18 17:40 +0100
[PATCH 6/9] usb: chipidea: debug: use list_for_each_entry Geliang Tang <geliangtang@163.com> - 2015-12-18 17:40 +0100
Re: [PATCH 6/9] usb: chipidea: debug: use list_for_each_entry Peter Chen <hzpeterchen@gmail.com> - 2015-12-25 08:50 +0100
[PATCH 5/9] usb: xhci: use list_for_each_entry Geliang Tang <geliangtang@163.com> - 2015-12-18 17:40 +0100
[PATCH 3/9] usb: host: oxu210hp-hcd: use list_for_each_entry_safe Geliang Tang <geliangtang@163.com> - 2015-12-18 17:40 +0100
[PATCH 4/9] usb: host: u132-hcd: use list_for_each_entry Geliang Tang <geliangtang@163.com> - 2015-12-18 17:40 +0100
[PATCH 8/9] usb: gadget: rndis: use list_for_each_entry_safe Geliang Tang <geliangtang@163.com> - 2015-12-18 17:40 +0100
Re: [PATCH 8/9] usb: gadget: rndis: use list_for_each_entry_safe Felipe Balbi <balbi@ti.com> - 2015-12-22 19:10 +0100
[PATCH 8/9 v2] usb: gadget: rndis: use list_for_each_entry_safe Geliang Tang <geliangtang@163.com> - 2015-12-23 15:00 +0100
| From | Geliang Tang <geliangtang@163.com> |
|---|---|
| Date | 2015-12-18 17:40 +0100 |
| Subject | [PATCH 1/9] usb: host: fotg210: use list_for_each_entry_safe |
| Message-ID | <qH6et-82w-3@gated-at.bofh.it> |
Use list_for_each_entry_safe() instead of list_for_each_safe() to
simplify the code.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/usb/host/fotg210-hcd.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 2341af4..360a5e9 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -2267,7 +2267,7 @@ static unsigned qh_completions(struct fotg210_hcd *fotg210,
struct fotg210_qh *qh)
{
struct fotg210_qtd *last, *end = qh->dummy;
- struct list_head *entry, *tmp;
+ struct fotg210_qtd *qtd, *tmp;
int last_status;
int stopped;
unsigned count = 0;
@@ -2301,12 +2301,10 @@ rescan:
* then let the queue advance.
* if queue is stopped, handles unlinks.
*/
- list_for_each_safe(entry, tmp, &qh->qtd_list) {
- struct fotg210_qtd *qtd;
+ list_for_each_entry_safe(qtd, tmp, &qh->qtd_list, qtd_list) {
struct urb *urb;
u32 token = 0;
- qtd = list_entry(entry, struct fotg210_qtd, qtd_list);
urb = qtd->urb;
/* clean up any state from previous QTD ...*/
@@ -2544,14 +2542,11 @@ retry_xacterr:
* used for cleanup after errors, before HC sees an URB's TDs.
*/
static void qtd_list_free(struct fotg210_hcd *fotg210, struct urb *urb,
- struct list_head *qtd_list)
+ struct list_head *head)
{
- struct list_head *entry, *temp;
-
- list_for_each_safe(entry, temp, qtd_list) {
- struct fotg210_qtd *qtd;
+ struct fotg210_qtd *qtd, *temp;
- qtd = list_entry(entry, struct fotg210_qtd, qtd_list);
+ list_for_each_entry_safe(qtd, temp, head, qtd_list) {
list_del(&qtd->qtd_list);
fotg210_qtd_free(fotg210, qtd);
}
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Geliang Tang <geliangtang@163.com> |
|---|---|
| Date | 2015-12-18 17:40 +0100 |
| Subject | [PATCH 6/9] usb: chipidea: debug: use list_for_each_entry |
| Message-ID | <qH6eu-82w-21@gated-at.bofh.it> |
| In reply to | #1295014 |
Use list_for_each_entry() instead of list_for_each() to simplify
the code.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/usb/chipidea/debug.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c
index a4f7db2..de5c509 100644
--- a/drivers/usb/chipidea/debug.c
+++ b/drivers/usb/chipidea/debug.c
@@ -172,7 +172,6 @@ static int ci_requests_show(struct seq_file *s, void *data)
{
struct ci_hdrc *ci = s->private;
unsigned long flags;
- struct list_head *ptr = NULL;
struct ci_hw_req *req = NULL;
struct td_node *node, *tmpnode;
unsigned i, j, qsize = sizeof(struct ci_hw_td)/sizeof(u32);
@@ -184,9 +183,7 @@ static int ci_requests_show(struct seq_file *s, void *data)
spin_lock_irqsave(&ci->lock, flags);
for (i = 0; i < ci->hw_ep_max; i++)
- list_for_each(ptr, &ci->ci_hw_ep[i].qh.queue) {
- req = list_entry(ptr, struct ci_hw_req, queue);
-
+ list_for_each_entry(req, &ci->ci_hw_ep[i].qh.queue, queue) {
list_for_each_entry_safe(node, tmpnode, &req->tds, td) {
seq_printf(s, "EP=%02i: TD=%08X %s\n",
i % (ci->hw_ep_max / 2),
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Peter Chen <hzpeterchen@gmail.com> |
|---|---|
| Date | 2015-12-25 08:50 +0100 |
| Subject | Re: [PATCH 6/9] usb: chipidea: debug: use list_for_each_entry |
| Message-ID | <qJviq-EO-3@gated-at.bofh.it> |
| In reply to | #1295015 |
On Sat, Dec 19, 2015 at 12:34:31AM +0800, Geliang Tang wrote:
> Use list_for_each_entry() instead of list_for_each() to simplify
> the code.
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
> drivers/usb/chipidea/debug.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c
> index a4f7db2..de5c509 100644
> --- a/drivers/usb/chipidea/debug.c
> +++ b/drivers/usb/chipidea/debug.c
> @@ -172,7 +172,6 @@ static int ci_requests_show(struct seq_file *s, void *data)
> {
> struct ci_hdrc *ci = s->private;
> unsigned long flags;
> - struct list_head *ptr = NULL;
> struct ci_hw_req *req = NULL;
> struct td_node *node, *tmpnode;
> unsigned i, j, qsize = sizeof(struct ci_hw_td)/sizeof(u32);
> @@ -184,9 +183,7 @@ static int ci_requests_show(struct seq_file *s, void *data)
>
> spin_lock_irqsave(&ci->lock, flags);
> for (i = 0; i < ci->hw_ep_max; i++)
> - list_for_each(ptr, &ci->ci_hw_ep[i].qh.queue) {
> - req = list_entry(ptr, struct ci_hw_req, queue);
> -
> + list_for_each_entry(req, &ci->ci_hw_ep[i].qh.queue, queue) {
> list_for_each_entry_safe(node, tmpnode, &req->tds, td) {
> seq_printf(s, "EP=%02i: TD=%08X %s\n",
> i % (ci->hw_ep_max / 2),
> --
> 2.5.0
>
It is ok for chipidea part, I will queue it, you don't need to
re-send it again
--
Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Geliang Tang <geliangtang@163.com> |
|---|---|
| Date | 2015-12-18 17:40 +0100 |
| Subject | [PATCH 5/9] usb: xhci: use list_for_each_entry |
| Message-ID | <qH6ev-82w-33@gated-at.bofh.it> |
| In reply to | #1295014 |
Use list_for_each_entry() instead of list_for_each() to simplify
the code.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/usb/host/xhci-ring.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index f1c21c4..4ed15c0 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -640,7 +640,6 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id,
unsigned int ep_index;
struct xhci_ring *ep_ring;
struct xhci_virt_ep *ep;
- struct list_head *entry;
struct xhci_td *cur_td = NULL;
struct xhci_td *last_unlinked_td;
@@ -670,8 +669,7 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id,
* it. We're also in the event handler, so we can't get re-interrupted
* if another Stop Endpoint command completes
*/
- list_for_each(entry, &ep->cancelled_td_list) {
- cur_td = list_entry(entry, struct xhci_td, cancelled_td_list);
+ list_for_each_entry(cur_td, &ep->cancelled_td_list, cancelled_td_list) {
xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
"Removing canceled TD starting at 0x%llx (dma).",
(unsigned long long)xhci_trb_virt_to_dma(
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Geliang Tang <geliangtang@163.com> |
|---|---|
| Date | 2015-12-18 17:40 +0100 |
| Subject | [PATCH 3/9] usb: host: oxu210hp-hcd: use list_for_each_entry_safe |
| Message-ID | <qH6ev-82w-43@gated-at.bofh.it> |
| In reply to | #1295014 |
Use list_for_each_entry_safe() instead of list_for_each_safe() to
simplify the code.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/usb/host/oxu210hp-hcd.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index bc74aca..4e4d601 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -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)
{
struct ehci_qtd *last = NULL, *end = qh->dummy;
- struct list_head *entry, *tmp;
+ struct ehci_qtd *qtd, *tmp;
int stopped;
unsigned count = 0;
int do_status = 0;
@@ -1006,12 +1006,10 @@ static unsigned qh_completions(struct oxu_hcd *oxu, struct ehci_qh *qh)
* then let the queue advance.
* if queue is stopped, handles unlinks.
*/
- list_for_each_safe(entry, tmp, &qh->qtd_list) {
- struct ehci_qtd *qtd;
+ list_for_each_entry_safe(qtd, tmp, &qh->qtd_list, qtd_list) {
struct urb *urb;
u32 token = 0;
- qtd = list_entry(entry, struct ehci_qtd, qtd_list);
urb = qtd->urb;
/* Clean up any state from previous QTD ...*/
@@ -1174,14 +1172,11 @@ halt:
* used for cleanup after errors, before HC sees an URB's TDs.
*/
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;
-
- list_for_each_safe(entry, temp, qtd_list) {
- struct ehci_qtd *qtd;
+ struct ehci_qtd *qtd, *temp;
- qtd = list_entry(entry, struct ehci_qtd, qtd_list);
+ list_for_each_entry_safe(qtd, temp, head, qtd_list) {
list_del(&qtd->qtd_list);
oxu_qtd_free(oxu, qtd);
}
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Geliang Tang <geliangtang@163.com> |
|---|---|
| Date | 2015-12-18 17:40 +0100 |
| Subject | [PATCH 4/9] usb: host: u132-hcd: use list_for_each_entry |
| Message-ID | <qH6ew-82w-55@gated-at.bofh.it> |
| In reply to | #1295014 |
Use list_for_each_entry() instead of list_for_each() to simplify
the code.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/usb/host/u132-hcd.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index 05c85c7..43d5293 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -1309,13 +1309,9 @@ static void u132_hcd_ring_work_scheduler(struct work_struct *work)
u132_ring_put_kref(u132, ring);
return;
} else if (ring->curr_endp) {
- struct u132_endp *last_endp = ring->curr_endp;
- struct list_head *scan;
- struct list_head *head = &last_endp->endp_ring;
+ struct u132_endp *endp, *last_endp = ring->curr_endp;
unsigned long wakeup = 0;
- list_for_each(scan, head) {
- struct u132_endp *endp = list_entry(scan,
- struct u132_endp, endp_ring);
+ list_for_each_entry(endp, &last_endp->endp_ring, endp_ring) {
if (endp->queue_next == endp->queue_last) {
} else if ((endp->delayed == 0)
|| time_after_eq(jiffies, endp->jiffies)) {
@@ -2393,14 +2389,12 @@ static int u132_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
static int dequeue_from_overflow_chain(struct u132 *u132,
struct u132_endp *endp, struct urb *urb)
{
- struct list_head *scan;
- struct list_head *head = &endp->urb_more;
- list_for_each(scan, head) {
- struct u132_urbq *urbq = list_entry(scan, struct u132_urbq,
- urb_more);
+ struct u132_urbq *urbq;
+
+ list_for_each_entry(urbq, &endp->urb_more, urb_more) {
if (urbq->urb == urb) {
struct usb_hcd *hcd = u132_to_hcd(u132);
- list_del(scan);
+ list_del(&urbq->urb_more);
endp->queue_size -= 1;
urb->error_count = 0;
usb_hcd_giveback_urb(hcd, urb, 0);
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Geliang Tang <geliangtang@163.com> |
|---|---|
| Date | 2015-12-18 17:40 +0100 |
| Subject | [PATCH 8/9] usb: gadget: rndis: use list_for_each_entry_safe |
| Message-ID | <qH6ew-82w-49@gated-at.bofh.it> |
| In reply to | #1295014 |
Use list_for_each_entry_safe() instead of list_for_each_safe() to
simplify the code.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/usb/gadget/function/rndis.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c
index 70d3917..34a76db 100644
--- a/drivers/usb/gadget/function/rndis.c
+++ b/drivers/usb/gadget/function/rndis.c
@@ -914,7 +914,7 @@ struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v)
params->media_state = RNDIS_MEDIA_STATE_DISCONNECTED;
params->resp_avail = resp_avail;
params->v = v;
- INIT_LIST_HEAD(&(params->resp_queue));
+ INIT_LIST_HEAD(¶ms->resp_queue);
pr_debug("%s: configNr = %d\n", __func__, i);
return params;
@@ -1006,12 +1006,9 @@ EXPORT_SYMBOL_GPL(rndis_add_hdr);
void rndis_free_response(struct rndis_params *params, u8 *buf)
{
- rndis_resp_t *r;
- struct list_head *act, *tmp;
+ rndis_resp_t *r, *n;
- list_for_each_safe(act, tmp, &(params->resp_queue))
- {
- r = list_entry(act, rndis_resp_t, list);
+ list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) {
if (r && r->buf == buf) {
list_del(&r->list);
kfree(r);
@@ -1022,14 +1019,11 @@ EXPORT_SYMBOL_GPL(rndis_free_response);
u8 *rndis_get_next_response(struct rndis_params *params, u32 *length)
{
- rndis_resp_t *r;
- struct list_head *act, *tmp;
+ rndis_resp_t *r, *n;
if (!length) return NULL;
- list_for_each_safe(act, tmp, &(params->resp_queue))
- {
- r = list_entry(act, rndis_resp_t, list);
+ list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) {
if (!r->send) {
r->send = 1;
*length = r->length;
@@ -1053,7 +1047,7 @@ static rndis_resp_t *rndis_add_response(struct rndis_params *params, u32 length)
r->length = length;
r->send = 0;
- list_add_tail(&r->list, &(params->resp_queue));
+ list_add_tail(&r->list, ¶ms->resp_queue);
return r;
}
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Felipe Balbi <balbi@ti.com> |
|---|---|
| Date | 2015-12-22 19:10 +0100 |
| Subject | Re: [PATCH 8/9] usb: gadget: rndis: use list_for_each_entry_safe |
| Message-ID | <qIzxM-7jr-15@gated-at.bofh.it> |
| In reply to | #1295020 |
[Multipart message — attachments visible in raw view] — view raw
Hi, Geliang Tang <geliangtang@163.com> writes: > Use list_for_each_entry_safe() instead of list_for_each_safe() to > simplify the code. > > Signed-off-by: Geliang Tang <geliangtang@163.com> there are other cleanups in this patch which shouldn't be here. Please split and I'll apply for v4.6 merge window. -- balbi
[toc] | [prev] | [next] | [standalone]
| From | Geliang Tang <geliangtang@163.com> |
|---|---|
| Date | 2015-12-23 15:00 +0100 |
| Subject | [PATCH 8/9 v2] usb: gadget: rndis: use list_for_each_entry_safe |
| Message-ID | <qIS7n-1VH-5@gated-at.bofh.it> |
| In reply to | #1296951 |
Use list_for_each_entry_safe() instead of list_for_each_safe() to
simplify the code.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/usb/gadget/function/rndis.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c
index 70d3917..13280f5 100644
--- a/drivers/usb/gadget/function/rndis.c
+++ b/drivers/usb/gadget/function/rndis.c
@@ -1006,12 +1006,9 @@ EXPORT_SYMBOL_GPL(rndis_add_hdr);
void rndis_free_response(struct rndis_params *params, u8 *buf)
{
- rndis_resp_t *r;
- struct list_head *act, *tmp;
+ rndis_resp_t *r, *n;
- list_for_each_safe(act, tmp, &(params->resp_queue))
- {
- r = list_entry(act, rndis_resp_t, list);
+ list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) {
if (r && r->buf == buf) {
list_del(&r->list);
kfree(r);
@@ -1022,14 +1019,11 @@ EXPORT_SYMBOL_GPL(rndis_free_response);
u8 *rndis_get_next_response(struct rndis_params *params, u32 *length)
{
- rndis_resp_t *r;
- struct list_head *act, *tmp;
+ rndis_resp_t *r, *n;
if (!length) return NULL;
- list_for_each_safe(act, tmp, &(params->resp_queue))
- {
- r = list_entry(act, rndis_resp_t, list);
+ list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) {
if (!r->send) {
r->send = 1;
*length = r->length;
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web