aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@avionic-design.de>2013-01-21 05:09:03 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-24 16:33:23 -0500
commit84dbf809fbae0591d319a7ea76e6032ff434824c (patch)
treeab744305093c72ec795d8f873229e5d9fbff0316 /drivers/i2c
parentf4a18312f46a6c6e0ba7b81776b01fc36edea9fc (diff)
i2c: Convert to devm_ioremap_resource()
Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling. devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-at91.c6
-rw-r--r--drivers/i2c/busses/i2c-imx.c6
-rw-r--r--drivers/i2c/busses/i2c-ocores.c7
-rw-r--r--drivers/i2c/busses/i2c-omap.c8
-rw-r--r--drivers/i2c/busses/i2c-rcar.c8
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c7
-rw-r--r--drivers/i2c/busses/i2c-sirf.c7
-rw-r--r--drivers/i2c/busses/i2c-stu300.c6
-rw-r--r--drivers/i2c/busses/i2c-tegra.c8
-rw-r--r--drivers/i2c/busses/i2c-xlr.c9
10 files changed, 32 insertions, 40 deletions
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 2bfc04d0a1b1..ebc224154695 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -723,9 +723,9 @@ static int at91_twi_probe(struct platform_device *pdev)
723 if (!dev->pdata) 723 if (!dev->pdata)
724 return -ENODEV; 724 return -ENODEV;
725 725
726 dev->base = devm_request_and_ioremap(&pdev->dev, mem); 726 dev->base = devm_ioremap_resource(&pdev->dev, mem);
727 if (!dev->base) 727 if (IS_ERR(dev->base))
728 return -EBUSY; 728 return PTR_ERR(dev->base);
729 729
730 dev->irq = platform_get_irq(pdev, 0); 730 dev->irq = platform_get_irq(pdev, 0);
731 if (dev->irq < 0) 731 if (dev->irq < 0)
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index b9734747d610..a71ece63e917 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -511,9 +511,9 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
511 return -ENOENT; 511 return -ENOENT;
512 } 512 }
513 513
514 base = devm_request_and_ioremap(&pdev->dev, res); 514 base = devm_ioremap_resource(&pdev->dev, res);
515 if (!base) 515 if (IS_ERR(base))
516 return -EBUSY; 516 return PTR_ERR(base);
517 517
518 i2c_imx = devm_kzalloc(&pdev->dev, sizeof(struct imx_i2c_struct), 518 i2c_imx = devm_kzalloc(&pdev->dev, sizeof(struct imx_i2c_struct),
519 GFP_KERNEL); 519 GFP_KERNEL);
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index a873d0ad1acb..a337d08a392d 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -12,6 +12,7 @@
12 * kind, whether express or implied. 12 * kind, whether express or implied.
13 */ 13 */
14 14
15#include <linux/err.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/module.h> 17#include <linux/module.h>
17#include <linux/init.h> 18#include <linux/init.h>
@@ -364,9 +365,9 @@ static int ocores_i2c_probe(struct platform_device *pdev)
364 if (!i2c) 365 if (!i2c)
365 return -ENOMEM; 366 return -ENOMEM;
366 367
367 i2c->base = devm_request_and_ioremap(&pdev->dev, res); 368 i2c->base = devm_ioremap_resource(&pdev->dev, res);
368 if (!i2c->base) 369 if (IS_ERR(i2c->base))
369 return -EADDRNOTAVAIL; 370 return PTR_ERR(i2c->base);
370 371
371 pdata = pdev->dev.platform_data; 372 pdata = pdev->dev.platform_data;
372 if (pdata) { 373 if (pdata) {
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 20d41bfa7c19..a9bf4ca78bb9 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1103,11 +1103,9 @@ omap_i2c_probe(struct platform_device *pdev)
1103 return -ENOMEM; 1103 return -ENOMEM;
1104 } 1104 }
1105 1105
1106 dev->base = devm_request_and_ioremap(&pdev->dev, mem); 1106 dev->base = devm_ioremap_resource(&pdev->dev, mem);
1107 if (!dev->base) { 1107 if (IS_ERR(dev->base))
1108 dev_err(&pdev->dev, "I2C region already claimed\n"); 1108 return PTR_ERR(dev->base);
1109 return -ENOMEM;
1110 }
1111 1109
1112 match = of_match_device(of_match_ptr(omap_i2c_of_match), &pdev->dev); 1110 match = of_match_device(of_match_ptr(omap_i2c_of_match), &pdev->dev);
1113 if (match) { 1111 if (match) {
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 9bd4d73d29e3..4ba4a95b6b26 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -642,11 +642,9 @@ static int rcar_i2c_probe(struct platform_device *pdev)
642 if (ret < 0) 642 if (ret < 0)
643 return ret; 643 return ret;
644 644
645 priv->io = devm_request_and_ioremap(dev, res); 645 priv->io = devm_ioremap_resource(dev, res);
646 if (!priv->io) { 646 if (IS_ERR(priv->io))
647 dev_err(dev, "cannot ioremap\n"); 647 return PTR_ERR(priv->io);
648 return -ENODEV;
649 }
650 648
651 priv->irq = platform_get_irq(pdev, 0); 649 priv->irq = platform_get_irq(pdev, 0);
652 init_waitqueue_head(&priv->wait); 650 init_waitqueue_head(&priv->wait);
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index a290d089ceaf..c807a6d14f0c 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -1042,11 +1042,10 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
1042 goto err_clk; 1042 goto err_clk;
1043 } 1043 }
1044 1044
1045 i2c->regs = devm_request_and_ioremap(&pdev->dev, res); 1045 i2c->regs = devm_ioremap_resource(&pdev->dev, res);
1046 1046
1047 if (i2c->regs == NULL) { 1047 if (IS_ERR(i2c->regs)) {
1048 dev_err(&pdev->dev, "cannot map IO\n"); 1048 ret = PTR_ERR(i2c->regs);
1049 ret = -ENXIO;
1050 goto err_clk; 1049 goto err_clk;
1051 } 1050 }
1052 1051
diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c
index 3f1818b87974..183cf05be1de 100644
--- a/drivers/i2c/busses/i2c-sirf.c
+++ b/drivers/i2c/busses/i2c-sirf.c
@@ -308,10 +308,9 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev)
308 goto out; 308 goto out;
309 } 309 }
310 310
311 siic->base = devm_request_and_ioremap(&pdev->dev, mem_res); 311 siic->base = devm_ioremap_resource(&pdev->dev, mem_res);
312 if (siic->base == NULL) { 312 if (IS_ERR(siic->base)) {
313 dev_err(&pdev->dev, "IO remap failed!\n"); 313 err = PTR_ERR(siic->base);
314 err = -ENOMEM;
315 goto out; 314 goto out;
316 } 315 }
317 316
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index 580a0c04cb42..60195b590637 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -888,11 +888,11 @@ stu300_probe(struct platform_device *pdev)
888 if (!res) 888 if (!res)
889 return -ENOENT; 889 return -ENOENT;
890 890
891 dev->virtbase = devm_request_and_ioremap(&pdev->dev, res); 891 dev->virtbase = devm_ioremap_resource(&pdev->dev, res);
892 dev_dbg(&pdev->dev, "initialize bus device I2C%d on virtual " 892 dev_dbg(&pdev->dev, "initialize bus device I2C%d on virtual "
893 "base %p\n", bus_nr, dev->virtbase); 893 "base %p\n", bus_nr, dev->virtbase);
894 if (!dev->virtbase) 894 if (IS_ERR(dev->virtbase))
895 return -ENOMEM; 895 return PTR_ERR(dev->virtbase);
896 896
897 dev->irq = platform_get_irq(pdev, 0); 897 dev->irq = platform_get_irq(pdev, 0);
898 ret = devm_request_irq(&pdev->dev, dev->irq, stu300_irh, 0, NAME, dev); 898 ret = devm_request_irq(&pdev->dev, dev->irq, stu300_irh, 0, NAME, dev);
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 7b38877ffec1..1fb30099dac4 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -669,11 +669,9 @@ static int tegra_i2c_probe(struct platform_device *pdev)
669 return -EINVAL; 669 return -EINVAL;
670 } 670 }
671 671
672 base = devm_request_and_ioremap(&pdev->dev, res); 672 base = devm_ioremap_resource(&pdev->dev, res);
673 if (!base) { 673 if (IS_ERR(base))
674 dev_err(&pdev->dev, "Cannot request/ioremap I2C registers\n"); 674 return PTR_ERR(base);
675 return -EADDRNOTAVAIL;
676 }
677 675
678 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 676 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
679 if (!res) { 677 if (!res) {
diff --git a/drivers/i2c/busses/i2c-xlr.c b/drivers/i2c/busses/i2c-xlr.c
index a005265461da..93f029e98c0d 100644
--- a/drivers/i2c/busses/i2c-xlr.c
+++ b/drivers/i2c/busses/i2c-xlr.c
@@ -7,6 +7,7 @@
7 * warranty of any kind, whether express or implied. 7 * warranty of any kind, whether express or implied.
8 */ 8 */
9 9
10#include <linux/err.h>
10#include <linux/kernel.h> 11#include <linux/kernel.h>
11#include <linux/module.h> 12#include <linux/module.h>
12#include <linux/slab.h> 13#include <linux/slab.h>
@@ -225,11 +226,9 @@ static int xlr_i2c_probe(struct platform_device *pdev)
225 return -ENOMEM; 226 return -ENOMEM;
226 227
227 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 228 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
228 priv->iobase = devm_request_and_ioremap(&pdev->dev, res); 229 priv->iobase = devm_ioremap_resource(&pdev->dev, res);
229 if (!priv->iobase) { 230 if (IS_ERR(priv->iobase))
230 dev_err(&pdev->dev, "devm_request_and_ioremap failed\n"); 231 return PTR_ERR(priv->iobase);
231 return -EBUSY;
232 }
233 232
234 priv->adap.dev.parent = &pdev->dev; 233 priv->adap.dev.parent = &pdev->dev;
235 priv->adap.owner = THIS_MODULE; 234 priv->adap.owner = THIS_MODULE;