aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorTushar Behera <tushar.behera@linaro.org>2013-01-24 15:41:07 +0530
committerWolfram Sang <w.sang@pengutronix.de>2013-01-28 05:26:44 +0100
commit2b255b947f39d9360662abf6667957add6064646 (patch)
treea98080692b10f0b6dce72d0828c0eb5e746698ac /drivers/i2c
parenti2c: s3c2410: Remove unnecessary label err_noclk (diff)
downloadlinux-dev-2b255b947f39d9360662abf6667957add6064646.tar.xz
linux-dev-2b255b947f39d9360662abf6667957add6064646.zip
i2c: s3c2410: Convert to use devm_* APIs
i2c-s3c2410 driver is modified to use devm_clk_get() and devm_request_irq(). This also simplifies the return path in driver's probe. Signed-off-by: Tushar Behera <tushar.behera@linaro.org> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index b7ca1f49d548..4b6cc130eb71 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -1022,7 +1022,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
/* find the clock and enable it */
i2c->dev = &pdev->dev;
- i2c->clk = clk_get(&pdev->dev, "i2c");
+ i2c->clk = devm_clk_get(&pdev->dev, "i2c");
if (IS_ERR(i2c->clk)) {
dev_err(&pdev->dev, "cannot get clock\n");
return -ENOENT;
@@ -1044,7 +1044,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
i2c->regs = devm_request_and_ioremap(&pdev->dev, res);
if (i2c->regs == NULL) {
- dev_err(&pdev->dev, "cannot map IO\n");
+ dev_err(&pdev->dev, "cannot request and map IO\n");
ret = -ENXIO;
goto err_clk;
}
@@ -1084,8 +1084,8 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
goto err_clk;
}
- ret = request_irq(i2c->irq, s3c24xx_i2c_irq, 0,
- dev_name(&pdev->dev), i2c);
+ ret = devm_request_irq(&pdev->dev, i2c->irq, s3c24xx_i2c_irq, 0,
+ dev_name(&pdev->dev), i2c);
if (ret != 0) {
dev_err(&pdev->dev, "cannot claim IRQ %d\n", i2c->irq);
@@ -1095,7 +1095,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
ret = s3c24xx_i2c_register_cpufreq(i2c);
if (ret < 0) {
dev_err(&pdev->dev, "failed to register cpufreq notifier\n");
- goto err_irq;
+ goto err_clk;
}
/* Note, previous versions of the driver used i2c_add_adapter()
@@ -1126,12 +1126,8 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
err_cpufreq:
s3c24xx_i2c_deregister_cpufreq(i2c);
- err_irq:
- free_irq(i2c->irq, i2c);
-
err_clk:
clk_disable_unprepare(i2c->clk);
- clk_put(i2c->clk);
return ret;
}
@@ -1150,10 +1146,8 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev)
s3c24xx_i2c_deregister_cpufreq(i2c);
i2c_del_adapter(&i2c->adap);
- free_irq(i2c->irq, i2c);
clk_disable_unprepare(i2c->clk);
- clk_put(i2c->clk);
if (pdev->dev.of_node && IS_ERR(i2c->pctrl))
s3c24xx_i2c_dt_gpio_free(i2c);