Commit 188fe480 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Wolfram Sang

i2c: designware: Use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() instead of
platform_get_resource() + devm_ioremap_resource().
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 2fd6cbf4
...@@ -157,12 +157,10 @@ static int mscc_twi_set_sda_hold_time(struct dw_i2c_dev *dev) ...@@ -157,12 +157,10 @@ static int mscc_twi_set_sda_hold_time(struct dw_i2c_dev *dev)
static int dw_i2c_of_configure(struct platform_device *pdev) static int dw_i2c_of_configure(struct platform_device *pdev)
{ {
struct dw_i2c_dev *dev = platform_get_drvdata(pdev); struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
struct resource *mem;
switch (dev->flags & MODEL_MASK) { switch (dev->flags & MODEL_MASK) {
case MODEL_MSCC_OCELOT: case MODEL_MSCC_OCELOT:
mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); dev->ext = devm_platform_ioremap_resource(pdev, 1);
dev->ext = devm_ioremap_resource(&pdev->dev, mem);
if (!IS_ERR(dev->ext)) if (!IS_ERR(dev->ext))
dev->set_sda_hold_time = mscc_twi_set_sda_hold_time; dev->set_sda_hold_time = mscc_twi_set_sda_hold_time;
break; break;
...@@ -241,7 +239,6 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) ...@@ -241,7 +239,6 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
struct dw_i2c_dev *dev; struct dw_i2c_dev *dev;
struct i2c_timings *t; struct i2c_timings *t;
u32 acpi_speed; u32 acpi_speed;
struct resource *mem;
int i, irq, ret; int i, irq, ret;
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
...@@ -252,8 +249,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) ...@@ -252,8 +249,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); dev->base = devm_platform_ioremap_resource(pdev, 0);
dev->base = devm_ioremap_resource(&pdev->dev, mem);
if (IS_ERR(dev->base)) if (IS_ERR(dev->base))
return PTR_ERR(dev->base); return PTR_ERR(dev->base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment