linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: renesas_usbhs: simplify list handling
@ 2016-11-07 19:07 Nicholas Mc Guire
  2016-11-08  2:17 ` Yoshihiro Shimoda
  0 siblings, 1 reply; 4+ messages in thread
From: Nicholas Mc Guire @ 2016-11-07 19:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Yoshihiro Shimoda, Felipe Balbi, Julia Lawall, linux-usb,
	linux-kernel, Nicholas Mc Guire

The current code is effectively equivalent to list_first_entry_or_null()
so simply switch and simplify the code.

Fixes: 6acb95d4e070 ("usb: renesas_usbhs: modify packet queue control method")
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
Found by simple coccinelle scanner

Compile tested with: multi_v7_defconfig (implies 
CONFIG_USB_RENESAS_USBHS=m)

Patch is against 4.9.0-rc2 (localversion-next is next-20161028)

 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.7.10.4

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

* RE: [PATCH] usb: renesas_usbhs: simplify list handling
  2016-11-07 19:07 [PATCH] usb: renesas_usbhs: simplify list handling Nicholas Mc Guire
@ 2016-11-08  2:17 ` Yoshihiro Shimoda
  2016-11-08  3:26   ` Masahiro Yamada
  0 siblings, 1 reply; 4+ messages in thread
From: Yoshihiro Shimoda @ 2016-11-08  2:17 UTC (permalink / raw)
  To: Nicholas Mc Guire, Greg Kroah-Hartman
  Cc: Felipe Balbi, Julia Lawall, linux-usb, linux-kernel

Hi,

> From: Nicholas Mc Guire
> Sent: Tuesday, November 08, 2016 4:07 AM
> 
> The current code is effectively equivalent to list_first_entry_or_null()
> so simply switch and simplify the code.
> 
> Fixes: 6acb95d4e070 ("usb: renesas_usbhs: modify packet queue control method")
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> ---
> Found by simple coccinelle scanner
> 
> Compile tested with: multi_v7_defconfig (implies
> CONFIG_USB_RENESAS_USBHS=m)
> 
> Patch is against 4.9.0-rc2 (localversion-next is next-20161028)

Thank you for the patch!
However, such a patch is already merged in the Felipe's usb.git repository unfortunately...
https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/commit/?h=testing/next&id=31faf878bd8c7e2c078a3b75f65efe64f23b0f18
So, the patch will appear in linux-next repository in the future.

Best regards,
Yoshihiro Shimoda

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

* Re: [PATCH] usb: renesas_usbhs: simplify list handling
  2016-11-08  2:17 ` Yoshihiro Shimoda
@ 2016-11-08  3:26   ` Masahiro Yamada
  2016-11-08  7:05     ` Nicholas Mc Guire
  0 siblings, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2016-11-08  3:26 UTC (permalink / raw)
  To: Yoshihiro Shimoda, Nicholas Mc Guire
  Cc: Greg Kroah-Hartman, Felipe Balbi, Julia Lawall, linux-usb, linux-kernel

>> Fixes: 6acb95d4e070 ("usb: renesas_usbhs: modify packet queue control method")


This is not a fix, but a clean-up patch.



>> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
>> ---
>> Found by simple coccinelle scanner
>>
>> Compile tested with: multi_v7_defconfig (implies
>> CONFIG_USB_RENESAS_USBHS=m)
>>
>> Patch is against 4.9.0-rc2 (localversion-next is next-20161028)
>
> Thank you for the patch!
> However, such a patch is already merged in the Felipe's usb.git repository unfortunately...
> https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/commit/?h=testing/next&id=31faf878bd8c7e2c078a3b75f65efe64f23b0f18
> So, the patch will appear in linux-next repository in the future.


Likewise for
drivers/usb/dwc3/gadget.h
drivers/usb/dwc2/gadget.c


-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH] usb: renesas_usbhs: simplify list handling
  2016-11-08  3:26   ` Masahiro Yamada
@ 2016-11-08  7:05     ` Nicholas Mc Guire
  0 siblings, 0 replies; 4+ messages in thread
From: Nicholas Mc Guire @ 2016-11-08  7:05 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Yoshihiro Shimoda, Nicholas Mc Guire, Greg Kroah-Hartman,
	Felipe Balbi, Julia Lawall, linux-usb, linux-kernel

On Tue, Nov 08, 2016 at 12:26:45PM +0900, Masahiro Yamada wrote:
> >> Fixes: 6acb95d4e070 ("usb: renesas_usbhs: modify packet queue control method")
> 
> 
> This is not a fix, but a clean-up patch.

true - I´ve been using it incorrectly to basically just record
the origin of the issue found - but looking at Submitting patches
this seems wrong.
In any case it would be interesting to be able to trace location
of where things go in that then need cleanups - is there an
alternative tag that could be used for that purpose ?

thx!
hofrat

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

end of thread, other threads:[~2016-11-08  7:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-07 19:07 [PATCH] usb: renesas_usbhs: simplify list handling Nicholas Mc Guire
2016-11-08  2:17 ` Yoshihiro Shimoda
2016-11-08  3:26   ` Masahiro Yamada
2016-11-08  7:05     ` Nicholas Mc Guire

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).