diff options
author | Jingoo Han <jg1.han@samsung.com> | 2014-03-10 08:34:10 +0900 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2014-03-10 08:29:37 +0100 |
commit | 0977f27338777fab04e20f769b869bc7726ab0ac (patch) | |
tree | 003b073cc51d864eb5630c1d18d9b8a9197966a8 /drivers/i2c | |
parent | ae50b1df50ee3a4ed9a553eae906485918afd4c8 (diff) | |
download | op-kernel-dev-0977f27338777fab04e20f769b869bc7726ab0ac.zip op-kernel-dev-0977f27338777fab04e20f769b869bc7726ab0ac.tar.gz |
i2c: mxs: Use devm_ioremap_resource()
Use devm_ioremap_resource() in order to make the code simpler,
and remove redundant return value check of platform_get_resource()
because the value is checked by devm_ioremap_resource().
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-mxs.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 0cde4e6..7170fc8 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c @@ -806,7 +806,6 @@ static int mxs_i2c_probe(struct platform_device *pdev) struct mxs_i2c_dev *i2c; struct i2c_adapter *adap; struct resource *res; - resource_size_t res_size; int err, irq; i2c = devm_kzalloc(dev, sizeof(struct mxs_i2c_dev), GFP_KERNEL); @@ -819,18 +818,13 @@ static int mxs_i2c_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - irq = platform_get_irq(pdev, 0); - - if (!res || irq < 0) - return -ENOENT; + i2c->regs = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(i2c->regs)) + return PTR_ERR(i2c->regs); - res_size = resource_size(res); - if (!devm_request_mem_region(dev, res->start, res_size, res->name)) - return -EBUSY; - - i2c->regs = devm_ioremap_nocache(dev, res->start, res_size); - if (!i2c->regs) - return -EBUSY; + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; err = devm_request_irq(dev, irq, mxs_i2c_isr, 0, dev_name(dev), i2c); if (err) |