Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84dbf809 authored by Thierry Reding's avatar Thierry Reding Committed by Greg Kroah-Hartman
Browse files

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: default avatarThierry Reding <thierry.reding@avionic-design.de>
Acked-by: default avatarWolfram Sang <w.sang@pengutronix.de>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f4a18312
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -723,9 +723,9 @@ static int at91_twi_probe(struct platform_device *pdev)
	if (!dev->pdata)
		return -ENODEV;

	dev->base = devm_request_and_ioremap(&pdev->dev, mem);
	if (!dev->base)
		return -EBUSY;
	dev->base = devm_ioremap_resource(&pdev->dev, mem);
	if (IS_ERR(dev->base))
		return PTR_ERR(dev->base);

	dev->irq = platform_get_irq(pdev, 0);
	if (dev->irq < 0)
+3 −3
Original line number Diff line number Diff line
@@ -511,9 +511,9 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
		return -ENOENT;
	}

	base = devm_request_and_ioremap(&pdev->dev, res);
	if (!base)
		return -EBUSY;
	base = devm_ioremap_resource(&pdev->dev, res);
	if (IS_ERR(base))
		return PTR_ERR(base);

	i2c_imx = devm_kzalloc(&pdev->dev, sizeof(struct imx_i2c_struct),
				GFP_KERNEL);
+4 −3
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
 * kind, whether express or implied.
 */

#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -364,9 +365,9 @@ static int ocores_i2c_probe(struct platform_device *pdev)
	if (!i2c)
		return -ENOMEM;

	i2c->base = devm_request_and_ioremap(&pdev->dev, res);
	if (!i2c->base)
		return -EADDRNOTAVAIL;
	i2c->base = devm_ioremap_resource(&pdev->dev, res);
	if (IS_ERR(i2c->base))
		return PTR_ERR(i2c->base);

	pdata = pdev->dev.platform_data;
	if (pdata) {
+3 −5
Original line number Diff line number Diff line
@@ -1103,11 +1103,9 @@ omap_i2c_probe(struct platform_device *pdev)
		return -ENOMEM;
	}

	dev->base = devm_request_and_ioremap(&pdev->dev, mem);
	if (!dev->base) {
		dev_err(&pdev->dev, "I2C region already claimed\n");
		return -ENOMEM;
	}
	dev->base = devm_ioremap_resource(&pdev->dev, mem);
	if (IS_ERR(dev->base))
		return PTR_ERR(dev->base);

	match = of_match_device(of_match_ptr(omap_i2c_of_match), &pdev->dev);
	if (match) {
+3 −5
Original line number Diff line number Diff line
@@ -642,11 +642,9 @@ static int rcar_i2c_probe(struct platform_device *pdev)
	if (ret < 0)
		return ret;

	priv->io = devm_request_and_ioremap(dev, res);
	if (!priv->io) {
		dev_err(dev, "cannot ioremap\n");
		return -ENODEV;
	}
	priv->io = devm_ioremap_resource(dev, res);
	if (IS_ERR(priv->io))
		return PTR_ERR(priv->io);

	priv->irq = platform_get_irq(pdev, 0);
	init_waitqueue_head(&priv->wait);
Loading