diff mbox

[v2,6/8] usb: host: ohci-s3c2410 Use clk_prepare_enable/clk_disable_unprepare

Message ID 1374536965-3545-7-git-send-email-tomasz.figa@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomasz Figa July 22, 2013, 11:49 p.m. UTC
This patch modifies the ohci-s3c2410 driver to prepare and unprepare
clocks in addition to enabling and disabling, since it is required
by common clock framework.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 drivers/usb/host/ohci-s3c2410.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Fabio Estevam July 23, 2013, 12:15 a.m. UTC | #1
On Mon, Jul 22, 2013 at 8:49 PM, Tomasz Figa <tomasz.figa@gmail.com> wrote:

>         dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
>
> -       clk_enable(usb_clk);
> +       clk_prepare_enable(usb_clk);

 clk_prepare_enable may fail, so you would better check its return value.
--
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
Tomasz Figa July 23, 2013, 12:44 a.m. UTC | #2
On Monday 22 of July 2013 21:15:12 Fabio Estevam wrote:
> On Mon, Jul 22, 2013 at 8:49 PM, Tomasz Figa <tomasz.figa@gmail.com> 
wrote:
> >         dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
> > 
> > -       clk_enable(usb_clk);
> > +       clk_prepare_enable(usb_clk);
> 
>  clk_prepare_enable may fail, so you would better check its return
> value.

Well, ideally yes, but since this driver doesn't have any error path here 
anyway and on Samsung platforms clk_prepare_enable() simply can't fail, 
I'd keep it this way until somebody fixes this driver, as it has more 
issues than just this one.

Best regards,
Tomasz

--
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
Tomasz Figa July 31, 2013, 6:58 p.m. UTC | #3
Alan, Greg,

On Tuesday 23 of July 2013 01:49:23 Tomasz Figa wrote:
> This patch modifies the ohci-s3c2410 driver to prepare and unprepare
> clocks in addition to enabling and disabling, since it is required
> by common clock framework.
> 
> Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
> ---
>  drivers/usb/host/ohci-s3c2410.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-s3c2410.c
> b/drivers/usb/host/ohci-s3c2410.c index e125770..db096bf 100644
> --- a/drivers/usb/host/ohci-s3c2410.c
> +++ b/drivers/usb/host/ohci-s3c2410.c
> @@ -47,10 +47,10 @@ static void s3c2410_start_hc(struct platform_device
> *dev, struct usb_hcd *hcd)
> 
>  	dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
> 
> -	clk_enable(usb_clk);
> +	clk_prepare_enable(usb_clk);
>  	mdelay(2);			/* let the bus clock stabilise */
> 
> -	clk_enable(clk);
> +	clk_prepare_enable(clk);
> 
>  	if (info != NULL) {
>  		info->hcd	= hcd;
> @@ -75,8 +75,8 @@ static void s3c2410_stop_hc(struct platform_device
> *dev) (info->enable_oc)(info, 0);
>  	}
> 
> -	clk_disable(clk);
> -	clk_disable(usb_clk);
> +	clk_disable_unprepare(clk);
> +	clk_disable_unprepare(usb_clk);
>  }
> 
>  /* ohci_s3c2410_hub_status_data

Any chance to get your ack on this?

Best regards,
Tomasz

--
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
Alan Stern July 31, 2013, 8:44 p.m. UTC | #4
On Wed, 31 Jul 2013, Tomasz Figa wrote:

> Alan, Greg,
> 
> On Tuesday 23 of July 2013 01:49:23 Tomasz Figa wrote:
> > This patch modifies the ohci-s3c2410 driver to prepare and unprepare
> > clocks in addition to enabling and disabling, since it is required
> > by common clock framework.
> > 
> > Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
> > ---
> >  drivers/usb/host/ohci-s3c2410.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/usb/host/ohci-s3c2410.c
> > b/drivers/usb/host/ohci-s3c2410.c index e125770..db096bf 100644
> > --- a/drivers/usb/host/ohci-s3c2410.c
> > +++ b/drivers/usb/host/ohci-s3c2410.c
> > @@ -47,10 +47,10 @@ static void s3c2410_start_hc(struct platform_device
> > *dev, struct usb_hcd *hcd)
> > 
> >  	dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
> > 
> > -	clk_enable(usb_clk);
> > +	clk_prepare_enable(usb_clk);
> >  	mdelay(2);			/* let the bus clock stabilise */
> > 
> > -	clk_enable(clk);
> > +	clk_prepare_enable(clk);
> > 
> >  	if (info != NULL) {
> >  		info->hcd	= hcd;
> > @@ -75,8 +75,8 @@ static void s3c2410_stop_hc(struct platform_device
> > *dev) (info->enable_oc)(info, 0);
> >  	}
> > 
> > -	clk_disable(clk);
> > -	clk_disable(usb_clk);
> > +	clk_disable_unprepare(clk);
> > +	clk_disable_unprepare(usb_clk);
> >  }
> > 
> >  /* ohci_s3c2410_hub_status_data
> 
> Any chance to get your ack on this?

Sorry, this must have slipped past.  It's fine with me.

Alan Stern

--
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
Greg Kroah-Hartman Aug. 1, 2013, 7:45 a.m. UTC | #5
On Wed, Jul 31, 2013 at 04:44:43PM -0400, Alan Stern wrote:
> On Wed, 31 Jul 2013, Tomasz Figa wrote:
> 
> > Alan, Greg,
> > 
> > On Tuesday 23 of July 2013 01:49:23 Tomasz Figa wrote:
> > > This patch modifies the ohci-s3c2410 driver to prepare and unprepare
> > > clocks in addition to enabling and disabling, since it is required
> > > by common clock framework.
> > > 
> > > Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
> > > ---
> > >  drivers/usb/host/ohci-s3c2410.c | 8 ++++----
> > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/drivers/usb/host/ohci-s3c2410.c
> > > b/drivers/usb/host/ohci-s3c2410.c index e125770..db096bf 100644
> > > --- a/drivers/usb/host/ohci-s3c2410.c
> > > +++ b/drivers/usb/host/ohci-s3c2410.c
> > > @@ -47,10 +47,10 @@ static void s3c2410_start_hc(struct platform_device
> > > *dev, struct usb_hcd *hcd)
> > > 
> > >  	dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
> > > 
> > > -	clk_enable(usb_clk);
> > > +	clk_prepare_enable(usb_clk);
> > >  	mdelay(2);			/* let the bus clock stabilise */
> > > 
> > > -	clk_enable(clk);
> > > +	clk_prepare_enable(clk);
> > > 
> > >  	if (info != NULL) {
> > >  		info->hcd	= hcd;
> > > @@ -75,8 +75,8 @@ static void s3c2410_stop_hc(struct platform_device
> > > *dev) (info->enable_oc)(info, 0);
> > >  	}
> > > 
> > > -	clk_disable(clk);
> > > -	clk_disable(usb_clk);
> > > +	clk_disable_unprepare(clk);
> > > +	clk_disable_unprepare(usb_clk);
> > >  }
> > > 
> > >  /* ohci_s3c2410_hub_status_data
> > 
> > Any chance to get your ack on this?
> 
> Sorry, this must have slipped past.  It's fine with me.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
--
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
diff mbox

Patch

diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index e125770..db096bf 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -47,10 +47,10 @@  static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd)
 
 	dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
 
-	clk_enable(usb_clk);
+	clk_prepare_enable(usb_clk);
 	mdelay(2);			/* let the bus clock stabilise */
 
-	clk_enable(clk);
+	clk_prepare_enable(clk);
 
 	if (info != NULL) {
 		info->hcd	= hcd;
@@ -75,8 +75,8 @@  static void s3c2410_stop_hc(struct platform_device *dev)
 			(info->enable_oc)(info, 0);
 	}
 
-	clk_disable(clk);
-	clk_disable(usb_clk);
+	clk_disable_unprepare(clk);
+	clk_disable_unprepare(usb_clk);
 }
 
 /* ohci_s3c2410_hub_status_data