diff options
author | Gerhard Sittig <gsi@denx.de> | 2013-07-01 18:54:41 +0200 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2013-08-23 23:18:57 +0200 |
commit | a5d7a6dea6ac289669a6e7e8c7e7d66893a5c0f5 (patch) | |
tree | 0f14ad80c12f927a53d3a56887ed4dc6494e20a5 /drivers/media | |
parent | 180890c74da72b5249f370edea426fbe076d37be (diff) | |
download | linux-stable-a5d7a6dea6ac289669a6e7e8c7e7d66893a5c0f5.tar.gz linux-stable-a5d7a6dea6ac289669a6e7e8c7e7d66893a5c0f5.tar.bz2 linux-stable-a5d7a6dea6ac289669a6e7e8c7e7d66893a5c0f5.zip |
fsl-viu: cleanup clock API use
use devm_clk_get() for automatic put after device close, check for and
propagate errors when enabling clocks, need to prepare clocks before
they can get enabled, adjust code paths to correctly balance get/put and
prepare/unprepare and enable/disable calls
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Gerhard Sittig <gsi@denx.de>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/fsl-viu.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c index 221ec428a01e..fe9898ca3c84 100644 --- a/drivers/media/platform/fsl-viu.c +++ b/drivers/media/platform/fsl-viu.c @@ -1485,6 +1485,7 @@ static int viu_of_probe(struct platform_device *op) struct viu_reg __iomem *viu_regs; struct i2c_adapter *ad; int ret, viu_irq; + struct clk *clk; ret = of_address_to_resource(op->dev.of_node, 0, &r); if (ret) { @@ -1577,14 +1578,18 @@ static int viu_of_probe(struct platform_device *op) } /* enable VIU clock */ - viu_dev->clk = clk_get(&op->dev, "viu_clk"); - if (IS_ERR(viu_dev->clk)) { - dev_err(&op->dev, "failed to find the clock module!\n"); - ret = -ENODEV; + clk = devm_clk_get(&op->dev, "viu_clk"); + if (IS_ERR(clk)) { + dev_err(&op->dev, "failed to lookup the clock!\n"); + ret = PTR_ERR(clk); + goto err_clk; + } + ret = clk_prepare_enable(clk); + if (ret) { + dev_err(&op->dev, "failed to enable the clock!\n"); goto err_clk; - } else { - clk_enable(viu_dev->clk); } + viu_dev->clk = clk; /* reset VIU module */ viu_reset(viu_dev->vr); @@ -1602,8 +1607,7 @@ static int viu_of_probe(struct platform_device *op) return ret; err_irq: - clk_disable(viu_dev->clk); - clk_put(viu_dev->clk); + clk_disable_unprepare(viu_dev->clk); err_clk: video_unregister_device(viu_dev->vdev); err_vdev: @@ -1626,8 +1630,7 @@ static int viu_of_remove(struct platform_device *op) free_irq(dev->irq, (void *)dev); irq_dispose_mapping(dev->irq); - clk_disable(dev->clk); - clk_put(dev->clk); + clk_disable_unprepare(dev->clk); video_unregister_device(dev->vdev); i2c_put_adapter(client->adapter); |