mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-23 12:43:55 +08:00
drm/exynos: Use devm_clk_get in exynos_drm_fimc.c
This eliminates the need for explicit clk_put and makes the cleanup and exit path code simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Inki Dae <inki.dae@samsung.com>
This commit is contained in:
parent
3fb6922eae
commit
15b3263eb3
@ -1738,64 +1738,49 @@ static int __devinit fimc_probe(struct platform_device *pdev)
|
|||||||
platform_get_device_id(pdev)->driver_data;
|
platform_get_device_id(pdev)->driver_data;
|
||||||
|
|
||||||
/* clock control */
|
/* clock control */
|
||||||
ctx->sclk_fimc_clk = clk_get(dev, "sclk_fimc");
|
ctx->sclk_fimc_clk = devm_clk_get(dev, "sclk_fimc");
|
||||||
if (IS_ERR(ctx->sclk_fimc_clk)) {
|
if (IS_ERR(ctx->sclk_fimc_clk)) {
|
||||||
dev_err(dev, "failed to get src fimc clock.\n");
|
dev_err(dev, "failed to get src fimc clock.\n");
|
||||||
return PTR_ERR(ctx->sclk_fimc_clk);
|
return PTR_ERR(ctx->sclk_fimc_clk);
|
||||||
}
|
}
|
||||||
clk_enable(ctx->sclk_fimc_clk);
|
clk_enable(ctx->sclk_fimc_clk);
|
||||||
|
|
||||||
ctx->fimc_clk = clk_get(dev, "fimc");
|
ctx->fimc_clk = devm_clk_get(dev, "fimc");
|
||||||
if (IS_ERR(ctx->fimc_clk)) {
|
if (IS_ERR(ctx->fimc_clk)) {
|
||||||
dev_err(dev, "failed to get fimc clock.\n");
|
dev_err(dev, "failed to get fimc clock.\n");
|
||||||
clk_disable(ctx->sclk_fimc_clk);
|
clk_disable(ctx->sclk_fimc_clk);
|
||||||
clk_put(ctx->sclk_fimc_clk);
|
|
||||||
return PTR_ERR(ctx->fimc_clk);
|
return PTR_ERR(ctx->fimc_clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->wb_clk = clk_get(dev, "pxl_async0");
|
ctx->wb_clk = devm_clk_get(dev, "pxl_async0");
|
||||||
if (IS_ERR(ctx->wb_clk)) {
|
if (IS_ERR(ctx->wb_clk)) {
|
||||||
dev_err(dev, "failed to get writeback a clock.\n");
|
dev_err(dev, "failed to get writeback a clock.\n");
|
||||||
clk_disable(ctx->sclk_fimc_clk);
|
clk_disable(ctx->sclk_fimc_clk);
|
||||||
clk_put(ctx->sclk_fimc_clk);
|
|
||||||
clk_put(ctx->fimc_clk);
|
|
||||||
return PTR_ERR(ctx->wb_clk);
|
return PTR_ERR(ctx->wb_clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->wb_b_clk = clk_get(dev, "pxl_async1");
|
ctx->wb_b_clk = devm_clk_get(dev, "pxl_async1");
|
||||||
if (IS_ERR(ctx->wb_b_clk)) {
|
if (IS_ERR(ctx->wb_b_clk)) {
|
||||||
dev_err(dev, "failed to get writeback b clock.\n");
|
dev_err(dev, "failed to get writeback b clock.\n");
|
||||||
clk_disable(ctx->sclk_fimc_clk);
|
clk_disable(ctx->sclk_fimc_clk);
|
||||||
clk_put(ctx->sclk_fimc_clk);
|
|
||||||
clk_put(ctx->fimc_clk);
|
|
||||||
clk_put(ctx->wb_clk);
|
|
||||||
return PTR_ERR(ctx->wb_b_clk);
|
return PTR_ERR(ctx->wb_b_clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent_clk = clk_get(dev, ddata->parent_clk);
|
parent_clk = devm_clk_get(dev, ddata->parent_clk);
|
||||||
|
|
||||||
if (IS_ERR(parent_clk)) {
|
if (IS_ERR(parent_clk)) {
|
||||||
dev_err(dev, "failed to get parent clock.\n");
|
dev_err(dev, "failed to get parent clock.\n");
|
||||||
clk_disable(ctx->sclk_fimc_clk);
|
clk_disable(ctx->sclk_fimc_clk);
|
||||||
clk_put(ctx->sclk_fimc_clk);
|
|
||||||
clk_put(ctx->fimc_clk);
|
|
||||||
clk_put(ctx->wb_clk);
|
|
||||||
clk_put(ctx->wb_b_clk);
|
|
||||||
return PTR_ERR(parent_clk);
|
return PTR_ERR(parent_clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clk_set_parent(ctx->sclk_fimc_clk, parent_clk)) {
|
if (clk_set_parent(ctx->sclk_fimc_clk, parent_clk)) {
|
||||||
dev_err(dev, "failed to set parent.\n");
|
dev_err(dev, "failed to set parent.\n");
|
||||||
clk_put(parent_clk);
|
|
||||||
clk_disable(ctx->sclk_fimc_clk);
|
clk_disable(ctx->sclk_fimc_clk);
|
||||||
clk_put(ctx->sclk_fimc_clk);
|
|
||||||
clk_put(ctx->fimc_clk);
|
|
||||||
clk_put(ctx->wb_clk);
|
|
||||||
clk_put(ctx->wb_b_clk);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
clk_put(parent_clk);
|
devm_clk_put(dev, parent_clk);
|
||||||
clk_set_rate(ctx->sclk_fimc_clk, pdata->clk_rate);
|
clk_set_rate(ctx->sclk_fimc_clk, pdata->clk_rate);
|
||||||
|
|
||||||
/* resource memory */
|
/* resource memory */
|
||||||
@ -1803,16 +1788,14 @@ static int __devinit fimc_probe(struct platform_device *pdev)
|
|||||||
ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res);
|
ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res);
|
||||||
if (!ctx->regs) {
|
if (!ctx->regs) {
|
||||||
dev_err(dev, "failed to map registers.\n");
|
dev_err(dev, "failed to map registers.\n");
|
||||||
ret = -ENXIO;
|
return -ENXIO;
|
||||||
goto err_clk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* resource irq */
|
/* resource irq */
|
||||||
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
|
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
dev_err(dev, "failed to request irq resource.\n");
|
dev_err(dev, "failed to request irq resource.\n");
|
||||||
ret = -ENOENT;
|
return -ENOENT;
|
||||||
goto err_clk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->irq = res->start;
|
ctx->irq = res->start;
|
||||||
@ -1820,7 +1803,7 @@ static int __devinit fimc_probe(struct platform_device *pdev)
|
|||||||
IRQF_ONESHOT, "drm_fimc", ctx);
|
IRQF_ONESHOT, "drm_fimc", ctx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(dev, "failed to request irq.\n");
|
dev_err(dev, "failed to request irq.\n");
|
||||||
goto err_clk;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* context initailization */
|
/* context initailization */
|
||||||
@ -1866,11 +1849,6 @@ err_ippdrv_register:
|
|||||||
pm_runtime_disable(dev);
|
pm_runtime_disable(dev);
|
||||||
err_get_irq:
|
err_get_irq:
|
||||||
free_irq(ctx->irq, ctx);
|
free_irq(ctx->irq, ctx);
|
||||||
err_clk:
|
|
||||||
clk_put(ctx->sclk_fimc_clk);
|
|
||||||
clk_put(ctx->fimc_clk);
|
|
||||||
clk_put(ctx->wb_clk);
|
|
||||||
clk_put(ctx->wb_b_clk);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1890,11 +1868,6 @@ static int __devexit fimc_remove(struct platform_device *pdev)
|
|||||||
|
|
||||||
free_irq(ctx->irq, ctx);
|
free_irq(ctx->irq, ctx);
|
||||||
|
|
||||||
clk_put(ctx->sclk_fimc_clk);
|
|
||||||
clk_put(ctx->fimc_clk);
|
|
||||||
clk_put(ctx->wb_clk);
|
|
||||||
clk_put(ctx->wb_b_clk);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user