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>
This commit is contained in:
Родитель
f4a18312f4
Коммит
84dbf809fb
|
@ -723,9 +723,9 @@ static int at91_twi_probe(struct platform_device *pdev)
|
||||||
if (!dev->pdata)
|
if (!dev->pdata)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
dev->base = devm_request_and_ioremap(&pdev->dev, mem);
|
dev->base = devm_ioremap_resource(&pdev->dev, mem);
|
||||||
if (!dev->base)
|
if (IS_ERR(dev->base))
|
||||||
return -EBUSY;
|
return PTR_ERR(dev->base);
|
||||||
|
|
||||||
dev->irq = platform_get_irq(pdev, 0);
|
dev->irq = platform_get_irq(pdev, 0);
|
||||||
if (dev->irq < 0)
|
if (dev->irq < 0)
|
||||||
|
|
|
@ -511,9 +511,9 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
base = devm_request_and_ioremap(&pdev->dev, res);
|
base = devm_ioremap_resource(&pdev->dev, res);
|
||||||
if (!base)
|
if (IS_ERR(base))
|
||||||
return -EBUSY;
|
return PTR_ERR(base);
|
||||||
|
|
||||||
i2c_imx = devm_kzalloc(&pdev->dev, sizeof(struct imx_i2c_struct),
|
i2c_imx = devm_kzalloc(&pdev->dev, sizeof(struct imx_i2c_struct),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
* kind, whether express or implied.
|
* kind, whether express or implied.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/err.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
@ -364,9 +365,9 @@ static int ocores_i2c_probe(struct platform_device *pdev)
|
||||||
if (!i2c)
|
if (!i2c)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
i2c->base = devm_request_and_ioremap(&pdev->dev, res);
|
i2c->base = devm_ioremap_resource(&pdev->dev, res);
|
||||||
if (!i2c->base)
|
if (IS_ERR(i2c->base))
|
||||||
return -EADDRNOTAVAIL;
|
return PTR_ERR(i2c->base);
|
||||||
|
|
||||||
pdata = pdev->dev.platform_data;
|
pdata = pdev->dev.platform_data;
|
||||||
if (pdata) {
|
if (pdata) {
|
||||||
|
|
|
@ -1103,11 +1103,9 @@ omap_i2c_probe(struct platform_device *pdev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->base = devm_request_and_ioremap(&pdev->dev, mem);
|
dev->base = devm_ioremap_resource(&pdev->dev, mem);
|
||||||
if (!dev->base) {
|
if (IS_ERR(dev->base))
|
||||||
dev_err(&pdev->dev, "I2C region already claimed\n");
|
return PTR_ERR(dev->base);
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
match = of_match_device(of_match_ptr(omap_i2c_of_match), &pdev->dev);
|
match = of_match_device(of_match_ptr(omap_i2c_of_match), &pdev->dev);
|
||||||
if (match) {
|
if (match) {
|
||||||
|
|
|
@ -642,11 +642,9 @@ static int rcar_i2c_probe(struct platform_device *pdev)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
priv->io = devm_request_and_ioremap(dev, res);
|
priv->io = devm_ioremap_resource(dev, res);
|
||||||
if (!priv->io) {
|
if (IS_ERR(priv->io))
|
||||||
dev_err(dev, "cannot ioremap\n");
|
return PTR_ERR(priv->io);
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->irq = platform_get_irq(pdev, 0);
|
priv->irq = platform_get_irq(pdev, 0);
|
||||||
init_waitqueue_head(&priv->wait);
|
init_waitqueue_head(&priv->wait);
|
||||||
|
|
|
@ -1042,11 +1042,10 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
|
||||||
goto err_clk;
|
goto err_clk;
|
||||||
}
|
}
|
||||||
|
|
||||||
i2c->regs = devm_request_and_ioremap(&pdev->dev, res);
|
i2c->regs = devm_ioremap_resource(&pdev->dev, res);
|
||||||
|
|
||||||
if (i2c->regs == NULL) {
|
if (IS_ERR(i2c->regs)) {
|
||||||
dev_err(&pdev->dev, "cannot map IO\n");
|
ret = PTR_ERR(i2c->regs);
|
||||||
ret = -ENXIO;
|
|
||||||
goto err_clk;
|
goto err_clk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,10 +308,9 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
siic->base = devm_request_and_ioremap(&pdev->dev, mem_res);
|
siic->base = devm_ioremap_resource(&pdev->dev, mem_res);
|
||||||
if (siic->base == NULL) {
|
if (IS_ERR(siic->base)) {
|
||||||
dev_err(&pdev->dev, "IO remap failed!\n");
|
err = PTR_ERR(siic->base);
|
||||||
err = -ENOMEM;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -888,11 +888,11 @@ stu300_probe(struct platform_device *pdev)
|
||||||
if (!res)
|
if (!res)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
dev->virtbase = devm_request_and_ioremap(&pdev->dev, res);
|
dev->virtbase = devm_ioremap_resource(&pdev->dev, res);
|
||||||
dev_dbg(&pdev->dev, "initialize bus device I2C%d on virtual "
|
dev_dbg(&pdev->dev, "initialize bus device I2C%d on virtual "
|
||||||
"base %p\n", bus_nr, dev->virtbase);
|
"base %p\n", bus_nr, dev->virtbase);
|
||||||
if (!dev->virtbase)
|
if (IS_ERR(dev->virtbase))
|
||||||
return -ENOMEM;
|
return PTR_ERR(dev->virtbase);
|
||||||
|
|
||||||
dev->irq = platform_get_irq(pdev, 0);
|
dev->irq = platform_get_irq(pdev, 0);
|
||||||
ret = devm_request_irq(&pdev->dev, dev->irq, stu300_irh, 0, NAME, dev);
|
ret = devm_request_irq(&pdev->dev, dev->irq, stu300_irh, 0, NAME, dev);
|
||||||
|
|
|
@ -669,11 +669,9 @@ static int tegra_i2c_probe(struct platform_device *pdev)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
base = devm_request_and_ioremap(&pdev->dev, res);
|
base = devm_ioremap_resource(&pdev->dev, res);
|
||||||
if (!base) {
|
if (IS_ERR(base))
|
||||||
dev_err(&pdev->dev, "Cannot request/ioremap I2C registers\n");
|
return PTR_ERR(base);
|
||||||
return -EADDRNOTAVAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
|
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* warranty of any kind, whether express or implied.
|
* warranty of any kind, whether express or implied.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/err.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
@ -225,11 +226,9 @@ static int xlr_i2c_probe(struct platform_device *pdev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
priv->iobase = devm_request_and_ioremap(&pdev->dev, res);
|
priv->iobase = devm_ioremap_resource(&pdev->dev, res);
|
||||||
if (!priv->iobase) {
|
if (IS_ERR(priv->iobase))
|
||||||
dev_err(&pdev->dev, "devm_request_and_ioremap failed\n");
|
return PTR_ERR(priv->iobase);
|
||||||
return -EBUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->adap.dev.parent = &pdev->dev;
|
priv->adap.dev.parent = &pdev->dev;
|
||||||
priv->adap.owner = THIS_MODULE;
|
priv->adap.owner = THIS_MODULE;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче