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


Groups > linux.kernel > #1485849 > unrolled thread

[PATCH v2 0/3] usb: trivial cleanups with list_first_entry_or_null()

Started byMasahiro Yamada <yamada.masahiro@socionext.com>
First post2016-09-18 18:10 +0200
Last post2016-09-18 18:10 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/3] usb: trivial cleanups with list_first_entry_or_null() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-09-18 18:10 +0200
    [PATCH v2 3/3] usb: renesas_usbhs: cleanup with list_first_entry_or_null() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-09-18 18:10 +0200
    [PATCH v2 1/3] usb: dwc2: cleanup with list_first_entry_or_null() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-09-18 18:10 +0200

#1485849 — [PATCH v2 0/3] usb: trivial cleanups with list_first_entry_or_null()

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2016-09-18 18:10 +0200
Subject[PATCH v2 0/3] usb: trivial cleanups with list_first_entry_or_null()
Message-ID<siMPf-1Ng-3@gated-at.bofh.it>
Replace the chain of list_empty() and list_first_entry()
with list_first_entry_or_null().

Changes in v2:
 - Split into per-driver patches


Masahiro Yamada (3):
  usb: dwc2: cleanup with list_first_entry_or_null()
  usb: dwc3: cleanup with list_first_entry_or_null()
  usb: renesas_usbhs: cleanup with list_first_entry_or_null()

 drivers/usb/dwc2/gadget.c        | 6 ++----
 drivers/usb/dwc3/gadget.h        | 5 +----
 drivers/usb/renesas_usbhs/fifo.c | 5 +----
 3 files changed, 4 insertions(+), 12 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1485850 — [PATCH v2 3/3] usb: renesas_usbhs: cleanup with list_first_entry_or_null()

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2016-09-18 18:10 +0200
Subject[PATCH v2 3/3] usb: renesas_usbhs: cleanup with list_first_entry_or_null()
Message-ID<siMPf-1Ng-7@gated-at.bofh.it>
In reply to#1485849
The combo of list_empty() check and return list_first_entry()
can be replaced with list_first_entry_or_null().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/usb/renesas_usbhs/fifo.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 857e783..d1af831 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -100,10 +100,7 @@ static void __usbhsf_pkt_del(struct usbhs_pkt *pkt)
 
 static struct usbhs_pkt *__usbhsf_pkt_get(struct usbhs_pipe *pipe)
 {
-	if (list_empty(&pipe->list))
-		return NULL;
-
-	return list_first_entry(&pipe->list, struct usbhs_pkt, node);
+	return list_first_entry_or_null(&pipe->list, struct usbhs_pkt, node);
 }
 
 static void usbhsf_fifo_clear(struct usbhs_pipe *pipe,
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1485851 — [PATCH v2 1/3] usb: dwc2: cleanup with list_first_entry_or_null()

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2016-09-18 18:10 +0200
Subject[PATCH v2 1/3] usb: dwc2: cleanup with list_first_entry_or_null()
Message-ID<siMPf-1Ng-13@gated-at.bofh.it>
In reply to#1485849
The combo of list_empty() check and return list_first_entry()
can be replaced with list_first_entry_or_null().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: John Youn <johnyoun@synopsys.com>
---

 drivers/usb/dwc2/gadget.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index af46adf..28a250a 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -1098,10 +1098,8 @@ static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now);
  */
 static struct dwc2_hsotg_req *get_ep_head(struct dwc2_hsotg_ep *hs_ep)
 {
-	if (list_empty(&hs_ep->queue))
-		return NULL;
-
-	return list_first_entry(&hs_ep->queue, struct dwc2_hsotg_req, queue);
+	return list_first_entry_or_null(&hs_ep->queue, struct dwc2_hsotg_req,
+					queue);
 }
 
 /**
-- 
1.9.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web