[PATCH v4] GPIO PL061: Adding Clk framework support
Rabin Vincent
rabin at rab.in
Thu Jul 15 12:09:22 EDT 2010
On Thu, Jul 15, 2010 at 10:56:37AM +0100, Russell King - ARM Linux wrote:
> +static int amba_get_enable_pclk(struct amba_device *pcdev)
> +{
> + struct clk *pclk = clk_get(&pcdev->dev, "apb_pclk");
> + int ret;
> +
> + pcdev->pclk = pclk;
> +
> + if (IS_ERR(pclk))
> + return PTR_ERR(pclk);
> +
> + ret = clk_enable(pclk);
> + if (ret)
> + clk_put(pclk);
> +
> + return ret;
> +}
> +
...
> @@ -130,17 +155,33 @@ static int amba_probe(struct device *dev)
> {
> struct amba_device *pcdev = to_amba_device(dev);
> struct amba_driver *pcdrv = to_amba_driver(dev->driver);
> - struct amba_id *id;
> + struct amba_id *id = amba_lookup(pcdrv->id_table, pcdev);
> + int ret;
>
> - id = amba_lookup(pcdrv->id_table, pcdev);
> + do {
> + ret = amba_get_enable_pclk(pcdev);
> + if (ret)
> + break;
> +
> + ret = pcdrv->probe(pcdev, id);
> + if (ret == 0)
> + break;
>
> - return pcdrv->probe(pcdev, id);
> + amba_put_disable_pclk(pcdev);
> + } while (0);
> +
> + return ret;
> }
In your earlier patch, you proceeded with the probe if the error from
clk_get() was -ENOENT, but not in this version. Isn't the -ENOENT
special handling preferable, since it avoids the need to change all
existing platforms?
More information about the linux-arm-kernel
mailing list