diff mbox

[04/10] usb: musb: Remove unnecessary shutdown function

Message ID 1461864800-29979-5-git-send-email-tony@atomide.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tony Lindgren April 28, 2016, 5:33 p.m. UTC
We have remove() already calling shutdown(), so let's drop it
and move the code to remove().

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/usb/musb/musb_core.c | 39 ++++++++++++++-------------------------
 1 file changed, 14 insertions(+), 25 deletions(-)

Comments

Bin Liu May 5, 2016, 7:20 p.m. UTC | #1
Hi,

On Thu, Apr 28, 2016 at 10:33:14AM -0700, Tony Lindgren wrote:
> We have remove() already calling shutdown(), so let's drop it
> and move the code to remove().
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/usb/musb/musb_core.c | 39 ++++++++++++++-------------------------
>  1 file changed, 14 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> index 5fa6187..d7af8ed 100644
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -1090,29 +1090,6 @@ void musb_stop(struct musb *musb)
>  	musb_platform_try_idle(musb, 0);
>  }
>  
> -static void musb_shutdown(struct platform_device *pdev)
> -{
> -	struct musb	*musb = dev_to_musb(&pdev->dev);
> -	unsigned long	flags;
> -
> -	pm_runtime_get_sync(musb->controller);
> -
> -	musb_host_cleanup(musb);
> -	musb_gadget_cleanup(musb);
> -
> -	spin_lock_irqsave(&musb->lock, flags);
> -	musb_platform_disable(musb);
> -	musb_generic_disable(musb);
> -	spin_unlock_irqrestore(&musb->lock, flags);
> -
> -	musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
> -	musb_platform_exit(musb);
> -
> -	pm_runtime_put(musb->controller);
> -	/* FIXME power down */
> -}
> -
> -
>  /*-------------------------------------------------------------------------*/
>  
>  /*
> @@ -2312,6 +2289,7 @@ static int musb_remove(struct platform_device *pdev)
>  {
>  	struct device	*dev = &pdev->dev;
>  	struct musb	*musb = dev_to_musb(dev);
> +	unsigned long	flags;
>  
>  	/* this gets called on rmmod.
>  	 *  - Host mode: host may still be active
> @@ -2319,7 +2297,19 @@ static int musb_remove(struct platform_device *pdev)
>  	 *  - OTG mode: both roles are deactivated (or never-activated)
>  	 */
>  	musb_exit_debugfs(musb);
> -	musb_shutdown(pdev);
> +
> +	pm_runtime_get_sync(musb->controller);
> +	musb_host_cleanup(musb);
> +	musb_gadget_cleanup(musb);
> +	spin_lock_irqsave(&musb->lock, flags);
> +	musb_platform_disable(musb);
> +	musb_generic_disable(musb);
> +	spin_unlock_irqrestore(&musb->lock, flags);
> +	musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
> +	musb_platform_exit(musb);
> +	pm_runtime_put(musb->controller);
> +	/* FIXME power down */

Do we know what to be fixed? If not, I think we can drop this FIXME.

Regards,
-Bin.

> +
>  	musb_phy_callback = NULL;
>  
>  	if (musb->dma_controller)
> @@ -2612,7 +2602,6 @@ static struct platform_driver musb_driver = {
>  	},
>  	.probe		= musb_probe,
>  	.remove		= musb_remove,
> -	.shutdown	= musb_shutdown,
>  };
>  
>  module_platform_driver(musb_driver);
> -- 
> 2.8.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren May 5, 2016, 7:28 p.m. UTC | #2
* Bin Liu <b-liu@ti.com> [160505 12:22]:
> 
> Do we know what to be fixed? If not, I think we can drop this FIXME.

Yeah seems pointless.. I think the next patch drops it.

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bin Liu May 5, 2016, 7:49 p.m. UTC | #3
On Thu, May 05, 2016 at 12:28:52PM -0700, Tony Lindgren wrote:
> * Bin Liu <b-liu@ti.com> [160505 12:22]:
> > 
> > Do we know what to be fixed? If not, I think we can drop this FIXME.
> 
> Yeah seems pointless.. I think the next patch drops it.

Yeah, I just read patch 05/10.

> 
> Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 5fa6187..d7af8ed 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1090,29 +1090,6 @@  void musb_stop(struct musb *musb)
 	musb_platform_try_idle(musb, 0);
 }
 
-static void musb_shutdown(struct platform_device *pdev)
-{
-	struct musb	*musb = dev_to_musb(&pdev->dev);
-	unsigned long	flags;
-
-	pm_runtime_get_sync(musb->controller);
-
-	musb_host_cleanup(musb);
-	musb_gadget_cleanup(musb);
-
-	spin_lock_irqsave(&musb->lock, flags);
-	musb_platform_disable(musb);
-	musb_generic_disable(musb);
-	spin_unlock_irqrestore(&musb->lock, flags);
-
-	musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
-	musb_platform_exit(musb);
-
-	pm_runtime_put(musb->controller);
-	/* FIXME power down */
-}
-
-
 /*-------------------------------------------------------------------------*/
 
 /*
@@ -2312,6 +2289,7 @@  static int musb_remove(struct platform_device *pdev)
 {
 	struct device	*dev = &pdev->dev;
 	struct musb	*musb = dev_to_musb(dev);
+	unsigned long	flags;
 
 	/* this gets called on rmmod.
 	 *  - Host mode: host may still be active
@@ -2319,7 +2297,19 @@  static int musb_remove(struct platform_device *pdev)
 	 *  - OTG mode: both roles are deactivated (or never-activated)
 	 */
 	musb_exit_debugfs(musb);
-	musb_shutdown(pdev);
+
+	pm_runtime_get_sync(musb->controller);
+	musb_host_cleanup(musb);
+	musb_gadget_cleanup(musb);
+	spin_lock_irqsave(&musb->lock, flags);
+	musb_platform_disable(musb);
+	musb_generic_disable(musb);
+	spin_unlock_irqrestore(&musb->lock, flags);
+	musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
+	musb_platform_exit(musb);
+	pm_runtime_put(musb->controller);
+	/* FIXME power down */
+
 	musb_phy_callback = NULL;
 
 	if (musb->dma_controller)
@@ -2612,7 +2602,6 @@  static struct platform_driver musb_driver = {
 	},
 	.probe		= musb_probe,
 	.remove		= musb_remove,
-	.shutdown	= musb_shutdown,
 };
 
 module_platform_driver(musb_driver);