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


Groups > linux.kernel > #1438966 > unrolled thread

[PATCH v2 08/22] usb: chipidea: Remove locking in ci_udc_start()

Started byStephen Boyd <stephen.boyd@linaro.org>
First post2016-07-08 00:30 +0200
Last post2016-07-08 12:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 08/22] usb: chipidea: Remove locking in ci_udc_start() Stephen Boyd <stephen.boyd@linaro.org> - 2016-07-08 00:30 +0200
    Re: [PATCH v2 08/22] usb: chipidea: Remove locking in ci_udc_start() Peter Chen <hzpeterchen@gmail.com> - 2016-07-08 12:00 +0200

#1438966 — [PATCH v2 08/22] usb: chipidea: Remove locking in ci_udc_start()

FromStephen Boyd <stephen.boyd@linaro.org>
Date2016-07-08 00:30 +0200
Subject[PATCH v2 08/22] usb: chipidea: Remove locking in ci_udc_start()
Message-ID<rSpXY-4yB-43@gated-at.bofh.it>
We don't call hw_device_reset() with the ci->lock held, so it
doesn't seem like this lock here is protecting anything. Let's
just remove it. This allows us to call sleeping functions like
phy_init() from within the CI_HDRC_CONTROLLER_RESET_EVENT hook.

Cc: Peter Chen <peter.chen@nxp.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
---
 drivers/usb/chipidea/udc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 065f5d97aa67..f16be4710cdb 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1719,7 +1719,6 @@ static int ci_udc_start(struct usb_gadget *gadget,
 			 struct usb_gadget_driver *driver)
 {
 	struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget);
-	unsigned long flags;
 	int retval = -ENOMEM;
 
 	if (driver->disconnect == NULL)
@@ -1746,7 +1745,6 @@ static int ci_udc_start(struct usb_gadget *gadget,
 
 	pm_runtime_get_sync(&ci->gadget.dev);
 	if (ci->vbus_active) {
-		spin_lock_irqsave(&ci->lock, flags);
 		hw_device_reset(ci);
 	} else {
 		usb_udc_vbus_handler(&ci->gadget, false);
@@ -1755,7 +1753,6 @@ static int ci_udc_start(struct usb_gadget *gadget,
 	}
 
 	retval = hw_device_state(ci, ci->ep0out->qh.dma);
-	spin_unlock_irqrestore(&ci->lock, flags);
 	if (retval)
 		pm_runtime_put_sync(&ci->gadget.dev);
 
-- 
2.9.0.rc2.8.ga28705d

[toc] | [next] | [standalone]


#1439262

FromPeter Chen <hzpeterchen@gmail.com>
Date2016-07-08 12:00 +0200
Message-ID<rSAJH-318-11@gated-at.bofh.it>
In reply to#1438966
On Thu, Jul 07, 2016 at 03:20:59PM -0700, Stephen Boyd wrote:
> We don't call hw_device_reset() with the ci->lock held, so it
> doesn't seem like this lock here is protecting anything. Let's
> just remove it. This allows us to call sleeping functions like
> phy_init() from within the CI_HDRC_CONTROLLER_RESET_EVENT hook.
> 
> Cc: Peter Chen <peter.chen@nxp.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
> ---
>  drivers/usb/chipidea/udc.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> index 065f5d97aa67..f16be4710cdb 100644
> --- a/drivers/usb/chipidea/udc.c
> +++ b/drivers/usb/chipidea/udc.c
> @@ -1719,7 +1719,6 @@ static int ci_udc_start(struct usb_gadget *gadget,
>  			 struct usb_gadget_driver *driver)
>  {
>  	struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget);
> -	unsigned long flags;
>  	int retval = -ENOMEM;
>  
>  	if (driver->disconnect == NULL)
> @@ -1746,7 +1745,6 @@ static int ci_udc_start(struct usb_gadget *gadget,
>  
>  	pm_runtime_get_sync(&ci->gadget.dev);
>  	if (ci->vbus_active) {
> -		spin_lock_irqsave(&ci->lock, flags);
>  		hw_device_reset(ci);
>  	} else {
>  		usb_udc_vbus_handler(&ci->gadget, false);
> @@ -1755,7 +1753,6 @@ static int ci_udc_start(struct usb_gadget *gadget,
>  	}
>  
>  	retval = hw_device_state(ci, ci->ep0out->qh.dma);
> -	spin_unlock_irqrestore(&ci->lock, flags);
>  	if (retval)
>  		pm_runtime_put_sync(&ci->gadget.dev);
>  

The main purpose for this is disabling interrupt when reset controller,
in case the unexpected interrupts occur.

You can move this between hw_device_state.

-- 

Best Regards,
Peter Chen

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web