linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] usb: trivial cleanups with list_first_entry_or_null()
@ 2016-09-18 16:03 Masahiro Yamada
  2016-09-18 16:03 ` [PATCH v2 1/3] usb: dwc2: cleanup " Masahiro Yamada
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Masahiro Yamada @ 2016-09-18 16:03 UTC (permalink / raw)
  To: linux-usb
  Cc: Felipe Balbi, Masahiro Yamada, Felipe Balbi, linux-kernel,
	Yoshihiro Shimoda, Julia Lawall, Greg Kroah-Hartman, John Youn

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/3] usb: dwc2: cleanup with list_first_entry_or_null()
  2016-09-18 16:03 [PATCH v2 0/3] usb: trivial cleanups with list_first_entry_or_null() Masahiro Yamada
@ 2016-09-18 16:03 ` Masahiro Yamada
  2016-09-18 16:03 ` [PATCH v2 2/3] usb: dwc3: " Masahiro Yamada
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2016-09-18 16:03 UTC (permalink / raw)
  To: linux-usb
  Cc: Felipe Balbi, Masahiro Yamada, Greg Kroah-Hartman, John Youn,
	linux-kernel

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/3] usb: dwc3: cleanup with list_first_entry_or_null()
  2016-09-18 16:03 [PATCH v2 0/3] usb: trivial cleanups with list_first_entry_or_null() Masahiro Yamada
  2016-09-18 16:03 ` [PATCH v2 1/3] usb: dwc2: cleanup " Masahiro Yamada
@ 2016-09-18 16:03 ` Masahiro Yamada
  2016-09-18 16:03 ` [PATCH v2 3/3] usb: renesas_usbhs: " Masahiro Yamada
  2016-10-28 14:55 ` [PATCH v2 0/3] usb: trivial cleanups " Masahiro Yamada
  3 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2016-09-18 16:03 UTC (permalink / raw)
  To: linux-usb; +Cc: Felipe Balbi, Masahiro Yamada, Greg Kroah-Hartman, linux-kernel

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/dwc3/gadget.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h
index e4a1d97..3129bcf 100644
--- a/drivers/usb/dwc3/gadget.h
+++ b/drivers/usb/dwc3/gadget.h
@@ -62,10 +62,7 @@ struct dwc3;
 
 static inline struct dwc3_request *next_request(struct list_head *list)
 {
-	if (list_empty(list))
-		return NULL;
-
-	return list_first_entry(list, struct dwc3_request, list);
+	return list_first_entry_or_null(list, struct dwc3_request, list);
 }
 
 static inline void dwc3_gadget_move_started_request(struct dwc3_request *req)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/3] usb: renesas_usbhs: cleanup with list_first_entry_or_null()
  2016-09-18 16:03 [PATCH v2 0/3] usb: trivial cleanups with list_first_entry_or_null() Masahiro Yamada
  2016-09-18 16:03 ` [PATCH v2 1/3] usb: dwc2: cleanup " Masahiro Yamada
  2016-09-18 16:03 ` [PATCH v2 2/3] usb: dwc3: " Masahiro Yamada
@ 2016-09-18 16:03 ` Masahiro Yamada
  2016-09-27 12:14   ` Yoshihiro Shimoda
  2016-10-28 14:55 ` [PATCH v2 0/3] usb: trivial cleanups " Masahiro Yamada
  3 siblings, 1 reply; 8+ messages in thread
From: Masahiro Yamada @ 2016-09-18 16:03 UTC (permalink / raw)
  To: linux-usb
  Cc: Felipe Balbi, Masahiro Yamada, Felipe Balbi, linux-kernel,
	Yoshihiro Shimoda, Julia Lawall, Greg Kroah-Hartman

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH v2 3/3] usb: renesas_usbhs: cleanup with list_first_entry_or_null()
  2016-09-18 16:03 ` [PATCH v2 3/3] usb: renesas_usbhs: " Masahiro Yamada
@ 2016-09-27 12:14   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 8+ messages in thread
From: Yoshihiro Shimoda @ 2016-09-27 12:14 UTC (permalink / raw)
  To: Masahiro Yamada, linux-usb
  Cc: Felipe Balbi, Felipe Balbi, linux-kernel, Julia Lawall,
	Greg Kroah-Hartman

Hi Yamada-san,

> From: Masahiro Yamada
> Sent: Monday, September 19, 2016 1:03 AM
> 
> 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>

Thank you for the patch!

Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/3] usb: trivial cleanups with list_first_entry_or_null()
  2016-09-18 16:03 [PATCH v2 0/3] usb: trivial cleanups with list_first_entry_or_null() Masahiro Yamada
                   ` (2 preceding siblings ...)
  2016-09-18 16:03 ` [PATCH v2 3/3] usb: renesas_usbhs: " Masahiro Yamada
@ 2016-10-28 14:55 ` Masahiro Yamada
  2016-10-31 11:03   ` Felipe Balbi
  3 siblings, 1 reply; 8+ messages in thread
From: Masahiro Yamada @ 2016-10-28 14:55 UTC (permalink / raw)
  To: linux-usb, Felipe Balbi, Felipe Balbi
  Cc: Masahiro Yamada, Linux Kernel Mailing List, Yoshihiro Shimoda,
	Julia Lawall, John Youn, Greg Kroah-Hartman

Hello Felipe,

If this series looks good, can you pick it up please?

Thanks,

2016-09-19 1:03 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> 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
>



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/3] usb: trivial cleanups with list_first_entry_or_null()
  2016-10-28 14:55 ` [PATCH v2 0/3] usb: trivial cleanups " Masahiro Yamada
@ 2016-10-31 11:03   ` Felipe Balbi
  2016-10-31 11:15     ` Masahiro Yamada
  0 siblings, 1 reply; 8+ messages in thread
From: Felipe Balbi @ 2016-10-31 11:03 UTC (permalink / raw)
  To: Masahiro Yamada, linux-usb
  Cc: Masahiro Yamada, Linux Kernel Mailing List, Yoshihiro Shimoda,
	Julia Lawall, John Youn, Greg Kroah-Hartman

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]


Hi,

Masahiro Yamada <yamada.masahiro@socionext.com> writes:
> Hello Felipe,
>
> If this series looks good, can you pick it up please?

it's in my testing/next branch. Has been there for a while ;-)

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/3] usb: trivial cleanups with list_first_entry_or_null()
  2016-10-31 11:03   ` Felipe Balbi
@ 2016-10-31 11:15     ` Masahiro Yamada
  0 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2016-10-31 11:15 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: linux-usb, Linux Kernel Mailing List, Yoshihiro Shimoda,
	Julia Lawall, John Youn, Greg Kroah-Hartman

Hi Felipe,

>>
>> If this series looks good, can you pick it up please?
>
> it's in my testing/next branch. Has been there for a while ;-)


Good.  Thanks for taking care of it!



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-10-31 11:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-18 16:03 [PATCH v2 0/3] usb: trivial cleanups with list_first_entry_or_null() Masahiro Yamada
2016-09-18 16:03 ` [PATCH v2 1/3] usb: dwc2: cleanup " Masahiro Yamada
2016-09-18 16:03 ` [PATCH v2 2/3] usb: dwc3: " Masahiro Yamada
2016-09-18 16:03 ` [PATCH v2 3/3] usb: renesas_usbhs: " Masahiro Yamada
2016-09-27 12:14   ` Yoshihiro Shimoda
2016-10-28 14:55 ` [PATCH v2 0/3] usb: trivial cleanups " Masahiro Yamada
2016-10-31 11:03   ` Felipe Balbi
2016-10-31 11:15     ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).