linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: musb: Fix external abort in musb_remove
@ 2018-03-08 20:40 Merlijn Wajer
  2018-03-08 21:15 ` Bin Liu
  2018-03-08 21:18 ` Bin Liu
  0 siblings, 2 replies; 5+ messages in thread
From: Merlijn Wajer @ 2018-03-08 20:40 UTC (permalink / raw)
  To: b-liu
  Cc: merlijn, ivo.g.dimitrov.75, linux-omap, Greg Kroah-Hartman,
	linux-usb, linux-kernel

This fixes an oops on unbind / module unload.

musb_remove function now calls musb_platform_exit before disabling
runtime pm.

Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>
---
 drivers/usb/musb/musb_core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index e2e95071328a..cf90d34f7199 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2472,13 +2472,14 @@ static int musb_remove(struct platform_device *pdev)
 	musb_platform_disable(musb);
 	spin_lock_irqsave(&musb->lock, flags);
 	musb_disable_interrupts(musb);
-	musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
 	spin_unlock_irqrestore(&musb->lock, flags);
 
+	musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
+	musb_platform_exit(musb);
+
 	pm_runtime_dont_use_autosuspend(musb->controller);
 	pm_runtime_put_sync(musb->controller);
 	pm_runtime_disable(musb->controller);
-	musb_platform_exit(musb);
 	musb_phy_callback = NULL;
 	if (musb->dma_controller)
 		musb_dma_controller_destroy(musb->dma_controller);
-- 
2.16.2


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

* Re: [PATCH] usb: musb: Fix external abort in musb_remove
  2018-03-08 20:40 [PATCH] usb: musb: Fix external abort in musb_remove Merlijn Wajer
@ 2018-03-08 21:15 ` Bin Liu
  2018-03-08 22:17   ` Merlijn Wajer
  2018-03-08 21:18 ` Bin Liu
  1 sibling, 1 reply; 5+ messages in thread
From: Bin Liu @ 2018-03-08 21:15 UTC (permalink / raw)
  To: Merlijn Wajer
  Cc: ivo.g.dimitrov.75, linux-omap, Greg Kroah-Hartman, linux-usb,
	linux-kernel

Hi,

please add patch version numbers in the subject when necessary. This
helps cross-referencing.

On Thu, Mar 08, 2018 at 09:40:47PM +0100, Merlijn Wajer wrote:
> This fixes an oops on unbind / module unload.
> 
> musb_remove function now calls musb_platform_exit before disabling
> runtime pm.
> 
> Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>
> ---
>  drivers/usb/musb/musb_core.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> index e2e95071328a..cf90d34f7199 100644
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -2472,13 +2472,14 @@ static int musb_remove(struct platform_device *pdev)
>  	musb_platform_disable(musb);
>  	spin_lock_irqsave(&musb->lock, flags);
>  	musb_disable_interrupts(musb);
> -	musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
>  	spin_unlock_irqrestore(&musb->lock, flags);
>  
> +	musb_writeb(musb->mregs, MUSB_DEVCTL, 0);

Does it solve the issue if not moving this line? I'd like to have
minimum change if possible.

> +	musb_platform_exit(musb);
> +
>  	pm_runtime_dont_use_autosuspend(musb->controller);
>  	pm_runtime_put_sync(musb->controller);
>  	pm_runtime_disable(musb->controller);
> -	musb_platform_exit(musb);
>  	musb_phy_callback = NULL;
>  	if (musb->dma_controller)
>  		musb_dma_controller_destroy(musb->dma_controller);

Regards,
-Bin.


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

* Re: [PATCH] usb: musb: Fix external abort in musb_remove
  2018-03-08 20:40 [PATCH] usb: musb: Fix external abort in musb_remove Merlijn Wajer
  2018-03-08 21:15 ` Bin Liu
@ 2018-03-08 21:18 ` Bin Liu
  1 sibling, 0 replies; 5+ messages in thread
From: Bin Liu @ 2018-03-08 21:18 UTC (permalink / raw)
  To: Merlijn Wajer
  Cc: ivo.g.dimitrov.75, linux-omap, Greg Kroah-Hartman, linux-usb,
	linux-kernel

On Thu, Mar 08, 2018 at 09:40:47PM +0100, Merlijn Wajer wrote:
> This fixes an oops on unbind / module unload.

Please also mention here that it happens on omap2430 platform.

(omap2430 is the only platform affected by this bug.)

Regards,
-Bin.

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

* Re: [PATCH] usb: musb: Fix external abort in musb_remove
  2018-03-08 21:15 ` Bin Liu
@ 2018-03-08 22:17   ` Merlijn Wajer
  2018-03-09 13:39     ` Bin Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Merlijn Wajer @ 2018-03-08 22:17 UTC (permalink / raw)
  To: Bin Liu, ivo.g.dimitrov.75, linux-omap, Greg Kroah-Hartman,
	linux-usb, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 645 bytes --]

Hi,

On 08/03/18 22:15, Bin Liu wrote:

> please add patch version numbers in the subject when necessary. This
> helps cross-referencing.

Will do. I naively assumed that the first patch would implicitly be
number 1. Will send out v2 now.

>>  
>> +	musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
> 
> Does it solve the issue if not moving this line? I'd like to have
> minimum change if possible.

Yes, it does. The only reason I moved musb_writeb is because I
understood you wanted me to move both (per previous message: "This can
be move down to out side of holding the spinlock").

Thanks for the tips.

Cheers,
Merlijn


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH] usb: musb: Fix external abort in musb_remove
  2018-03-08 22:17   ` Merlijn Wajer
@ 2018-03-09 13:39     ` Bin Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Bin Liu @ 2018-03-09 13:39 UTC (permalink / raw)
  To: Merlijn Wajer
  Cc: ivo.g.dimitrov.75, linux-omap, Greg Kroah-Hartman, linux-usb,
	linux-kernel

On Thu, Mar 08, 2018 at 11:17:48PM +0100, Merlijn Wajer wrote:
> Hi,
> 
> On 08/03/18 22:15, Bin Liu wrote:
> 
> > please add patch version numbers in the subject when necessary. This
> > helps cross-referencing.
> 
> Will do. I naively assumed that the first patch would implicitly be
> number 1. Will send out v2 now.

Sorry, my bad, I forgot the first patch was a RFC. You are doing it
right.

> 
> >>  
> >> +	musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
> > 
> > Does it solve the issue if not moving this line? I'd like to have
> > minimum change if possible.
> 
> Yes, it does. The only reason I moved musb_writeb is because I
> understood you wanted me to move both (per previous message: "This can
> be move down to out side of holding the spinlock").

Typically the comments would only applies to the modified code.
Otherwise the comments have to be explicit to avoid confusion.
No worries here anyway, confusion does happen sometimes ;)

Regards,
-Bin.

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

end of thread, other threads:[~2018-03-09 13:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-08 20:40 [PATCH] usb: musb: Fix external abort in musb_remove Merlijn Wajer
2018-03-08 21:15 ` Bin Liu
2018-03-08 22:17   ` Merlijn Wajer
2018-03-09 13:39     ` Bin Liu
2018-03-08 21:18 ` Bin Liu

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