aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-mxs.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2014-03-09 19:34:10 -0400
committerWolfram Sang <wsa@the-dreams.de>2014-03-10 03:29:37 -0400
commit0977f27338777fab04e20f769b869bc7726ab0ac (patch)
tree003b073cc51d864eb5630c1d18d9b8a9197966a8 /drivers/i2c/busses/i2c-mxs.c
parentae50b1df50ee3a4ed9a553eae906485918afd4c8 (diff)
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/busses/i2c-mxs.c')
-rw-r--r--drivers/i2c/busses/i2c-mxs.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 0cde4e6ab2b2..7170fc892829 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)
806 struct mxs_i2c_dev *i2c; 806 struct mxs_i2c_dev *i2c;
807 struct i2c_adapter *adap; 807 struct i2c_adapter *adap;
808 struct resource *res; 808 struct resource *res;
809 resource_size_t res_size;
810 int err, irq; 809 int err, irq;
811 810
812 i2c = devm_kzalloc(dev, sizeof(struct mxs_i2c_dev), GFP_KERNEL); 811 i2c = devm_kzalloc(dev, sizeof(struct mxs_i2c_dev), GFP_KERNEL);
@@ -819,18 +818,13 @@ static int mxs_i2c_probe(struct platform_device *pdev)
819 } 818 }
820 819
821 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 820 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
822 irq = platform_get_irq(pdev, 0); 821 i2c->regs = devm_ioremap_resource(&pdev->dev, res);
823 822 if (IS_ERR(i2c->regs))
824 if (!res || irq < 0) 823 return PTR_ERR(i2c->regs);
825 return -ENOENT;
826 824
827 res_size = resource_size(res); 825 irq = platform_get_irq(pdev, 0);
828 if (!devm_request_mem_region(dev, res->start, res_size, res->name)) 826 if (irq < 0)
829 return -EBUSY; 827 return irq;
830
831 i2c->regs = devm_ioremap_nocache(dev, res->start, res_size);
832 if (!i2c->regs)
833 return -EBUSY;
834 828
835 err = devm_request_irq(dev, irq, mxs_i2c_isr, 0, dev_name(dev), i2c); 829 err = devm_request_irq(dev, irq, mxs_i2c_isr, 0, dev_name(dev), i2c);
836 if (err) 830 if (err)