[v2,05/10] usb: dwc2/gadget: move setting last reset time to s3c_hsotg_core_init

Message ID 1413801940-31086-6-git-send-email-m.szyprowski@samsung.com
State Accepted
Commit ac3c81f3e8dcb435a92e03e2fa069d1e60687cfe
Headers show

Commit Message

Marek Szyprowski Oct. 20, 2014, 10:45 a.m.
This patch removes duplicated code and sets last_rst variable in the
function which does the hardware reset.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/usb/dwc2/gadget.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Paul Zimmerman Oct. 25, 2014, 12:23 a.m. | #1
> From: Marek Szyprowski [mailto:m.szyprowski@samsung.com]
> Sent: Monday, October 20, 2014 3:46 AM
> 
> This patch removes duplicated code and sets last_rst variable in the
> function which does the hardware reset.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/usb/dwc2/gadget.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> index fd52a8b23649..c1dad46bbbdd 100644
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -2247,6 +2247,8 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
>  	/* must be at-least 3ms to allow bus to see disconnect */
>  	mdelay(3);
> 
> +	hsotg->last_rst = jiffies;
> +
>  	/* remove the soft-disconnect and let's go */
>  	__bic32(hsotg->regs + DCTL, DCTL_SFTDISCON);
>  }
> @@ -2347,7 +2349,6 @@ irq_retry:
>  							  -ECONNRESET, true);
> 
>  				s3c_hsotg_core_init(hsotg);
> -				hsotg->last_rst = jiffies;
>  			}
>  		}
>  	}
> @@ -2908,7 +2909,6 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget,
>  		goto err;
>  	}
> 
> -	hsotg->last_rst = jiffies;
>  	dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name);
>  	return 0;
> 
> @@ -3667,7 +3667,6 @@ static int s3c_hsotg_resume(struct platform_device *pdev)
>  	}
> 
>  	spin_lock_irqsave(&hsotg->lock, flags);
> -	hsotg->last_rst = jiffies;
>  	s3c_hsotg_phy_enable(hsotg);
>  	s3c_hsotg_core_init(hsotg);
>  	spin_unlock_irqrestore(&hsotg->lock, flags);

Acked-by: Paul Zimmerman <paulz@synopsys.com>

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

Patch

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index fd52a8b23649..c1dad46bbbdd 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2247,6 +2247,8 @@  static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
 	/* must be at-least 3ms to allow bus to see disconnect */
 	mdelay(3);
 
+	hsotg->last_rst = jiffies;
+
 	/* remove the soft-disconnect and let's go */
 	__bic32(hsotg->regs + DCTL, DCTL_SFTDISCON);
 }
@@ -2347,7 +2349,6 @@  irq_retry:
 							  -ECONNRESET, true);
 
 				s3c_hsotg_core_init(hsotg);
-				hsotg->last_rst = jiffies;
 			}
 		}
 	}
@@ -2908,7 +2909,6 @@  static int s3c_hsotg_udc_start(struct usb_gadget *gadget,
 		goto err;
 	}
 
-	hsotg->last_rst = jiffies;
 	dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name);
 	return 0;
 
@@ -3667,7 +3667,6 @@  static int s3c_hsotg_resume(struct platform_device *pdev)
 	}
 
 	spin_lock_irqsave(&hsotg->lock, flags);
-	hsotg->last_rst = jiffies;
 	s3c_hsotg_phy_enable(hsotg);
 	s3c_hsotg_core_init(hsotg);
 	spin_unlock_irqrestore(&hsotg->lock, flags);