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


Groups > linux.kernel > #1516514 > unrolled thread

[PATCH] usb: dwc2: gadget: simplify list handling

Started byNicholas Mc Guire <hofrat@osadl.org>
First post2016-11-07 20:10 +0100
Last post2016-11-07 20:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] usb: dwc2: gadget: simplify list handling Nicholas Mc Guire <hofrat@osadl.org> - 2016-11-07 20:10 +0100
    Re: [PATCH] usb: dwc2: gadget: simplify list handling John Youn <John.Youn@synopsys.com> - 2016-11-07 20:20 +0100

#1516514 — [PATCH] usb: dwc2: gadget: simplify list handling

FromNicholas Mc Guire <hofrat@osadl.org>
Date2016-11-07 20:10 +0100
Subject[PATCH] usb: dwc2: gadget: simplify list handling
Message-ID<sAXsT-7ns-57@gated-at.bofh.it>
The current code is effectively equivalent to list_first_entry_or_null()
so simply switch and simplify the code.

Fixes: 9c39ddc60ee9 ("USB: s3c-hsotg: Fix stall condition processing")
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
Found by simple coccinelle scanner

Compile tested with: x86_64_defconfig + CONFIG_USB_DWC2=m,
CONFIG_USB_DWC2_PERIPHERAL=y

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

 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 24fbebc..9ac8ca0 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -1099,10 +1099,8 @@ static int dwc2_hsotg_process_req_status(struct dwc2_hsotg *hsotg,
  */
 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.7.10.4

[toc] | [next] | [standalone]


#1516525

FromJohn Youn <John.Youn@synopsys.com>
Date2016-11-07 20:20 +0100
Message-ID<sAXCy-7rh-39@gated-at.bofh.it>
In reply to#1516514
On 11/7/2016 11:06 AM, Nicholas Mc Guire wrote:
> The current code is effectively equivalent to list_first_entry_or_null()
> so simply switch and simplify the code.
> 
> Fixes: 9c39ddc60ee9 ("USB: s3c-hsotg: Fix stall condition processing")
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> ---
> Found by simple coccinelle scanner
> 
> Compile tested with: x86_64_defconfig + CONFIG_USB_DWC2=m,
> CONFIG_USB_DWC2_PERIPHERAL=y
> 
> Patch is against 4.9.0-rc2 (localversion-next is next-20161028)
> 
>  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 24fbebc..9ac8ca0 100644
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -1099,10 +1099,8 @@ static int dwc2_hsotg_process_req_status(struct dwc2_hsotg *hsotg,
>   */
>  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);
>  }
>  
>  /**
> 


Hi,

The same is already queued in Felipe's testing/next.

Regards,
John

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web