Re: [RFC 08/17] usb/ehci: sh: move the clock init to the top

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 29, 2011 at 2:51 AM, Sebastian Andrzej Siewior
<sebastian@xxxxxxxxxxxxx> wrote:
> Do the clock initialization as the first thing.

any specific reason for this??

>
> Signed-off-by: Sebastian Andrzej Siewior <sebastian@xxxxxxxxxxxxx>
> ---
>  drivers/usb/host/ehci-sh.c |   51 ++++++++++++++++++++-----------------------
>  1 files changed, 24 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c
> index 86a95bb..a1a6935 100644
> --- a/drivers/usb/host/ehci-sh.c
> +++ b/drivers/usb/host/ehci-sh.c
> @@ -106,6 +106,24 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
>        if (usb_disabled())
>                return -ENODEV;
>
> +       priv = kmalloc(sizeof(struct ehci_sh_priv), GFP_KERNEL);
> +       if (!priv) {
> +               dev_dbg(&pdev->dev, "error allocating priv data\n");
> +               return -ENOMEM;
> +       }
> +
> +       /* These are optional, we don't care if they fail */
> +       priv->fclk = clk_get(&pdev->dev, "usb_fck");
> +       if (IS_ERR(priv->fclk))
> +               priv->fclk = NULL;
> +
> +       priv->iclk = clk_get(&pdev->dev, "usb_ick");
> +       if (IS_ERR(priv->iclk))
> +               priv->iclk = NULL;
> +
> +       clk_enable(priv->fclk);
> +       clk_enable(priv->iclk);
> +
>        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>        if (!res) {
>                dev_err(&pdev->dev,
> @@ -149,25 +167,6 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
>                goto fail_ioremap;
>        }
>
> -       priv = kmalloc(sizeof(struct ehci_sh_priv), GFP_KERNEL);
> -       if (!priv) {
> -               dev_dbg(&pdev->dev, "error allocating priv data\n");
> -               ret = -ENOMEM;
> -               goto fail_alloc;
> -       }
> -
> -       /* These are optional, we don't care if they fail */
> -       priv->fclk = clk_get(&pdev->dev, "usb_fck");
> -       if (IS_ERR(priv->fclk))
> -               priv->fclk = NULL;
> -
> -       priv->iclk = clk_get(&pdev->dev, "usb_ick");
> -       if (IS_ERR(priv->iclk))
> -               priv->iclk = NULL;
> -
> -       clk_enable(priv->fclk);
> -       clk_enable(priv->iclk);
> -
>        ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);
>        if (ret != 0) {
>                dev_err(&pdev->dev, "Failed to add hcd");
> @@ -180,14 +179,6 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
>        return ret;
>
>  fail_add_hcd:
> -       clk_disable(priv->iclk);
> -       clk_disable(priv->fclk);
> -
> -       clk_put(priv->iclk);
> -       clk_put(priv->fclk);
> -
> -       kfree(priv);
> -fail_alloc:
>        iounmap(hcd->regs);
>  fail_ioremap:
>        release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
> @@ -196,6 +187,12 @@ fail_request_resource:
>  fail_create_hcd:
>        dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), ret);
>
> +       clk_disable(priv->iclk);
> +       clk_disable(priv->fclk);
> +
> +       clk_put(priv->iclk);
> +       clk_put(priv->fclk);
> +       kfree(priv);
>        return ret;
>  }
>
> --
> 1.7.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux