Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1297478

[PATCH 8/9 v2] usb: gadget: rndis: use list_for_each_entry_safe

From Geliang Tang <geliangtang@163.com>
Newsgroups linux.kernel
Subject [PATCH 8/9 v2] usb: gadget: rndis: use list_for_each_entry_safe
Date 2015-12-23 15:00 +0100
Message-ID <qIS7n-1VH-5@gated-at.bofh.it> (permalink)
References <qIzxM-7jr-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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, &params->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, &params->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/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[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

csiph-web