Commit 54108e56 authored by Jan Glauber's avatar Jan Glauber Committed by Wolfram Sang

i2c: octeon: Cleanup resource allocation code

Remove resource values from struct i2c_octeon and use
devm_ioremap_resource helper.
Signed-off-by: default avatarJan Glauber <jglauber@cavium.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent dfcd8212
...@@ -75,9 +75,7 @@ struct octeon_i2c { ...@@ -75,9 +75,7 @@ struct octeon_i2c {
int irq; int irq;
u32 twsi_freq; u32 twsi_freq;
int sys_freq; int sys_freq;
resource_size_t twsi_phys;
void __iomem *twsi_base; void __iomem *twsi_base;
resource_size_t regsize;
struct device *dev; struct device *dev;
}; };
...@@ -502,14 +500,11 @@ static int octeon_i2c_probe(struct platform_device *pdev) ...@@ -502,14 +500,11 @@ static int octeon_i2c_probe(struct platform_device *pdev)
i2c->dev = &pdev->dev; i2c->dev = &pdev->dev;
res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
i2c->twsi_base = devm_ioremap_resource(&pdev->dev, res_mem);
if (res_mem == NULL) { if (IS_ERR(i2c->twsi_base)) {
dev_err(i2c->dev, "found no memory resource\n"); result = PTR_ERR(i2c->twsi_base);
result = -ENXIO;
goto out; goto out;
} }
i2c->twsi_phys = res_mem->start;
i2c->regsize = resource_size(res_mem);
/* /*
* "clock-rate" is a legacy binding, the official binding is * "clock-rate" is a legacy binding, the official binding is
...@@ -526,13 +521,6 @@ static int octeon_i2c_probe(struct platform_device *pdev) ...@@ -526,13 +521,6 @@ static int octeon_i2c_probe(struct platform_device *pdev)
i2c->sys_freq = octeon_get_io_clock_rate(); i2c->sys_freq = octeon_get_io_clock_rate();
if (!devm_request_mem_region(&pdev->dev, i2c->twsi_phys, i2c->regsize,
res_mem->name)) {
dev_err(i2c->dev, "request_mem_region failed\n");
goto out;
}
i2c->twsi_base = devm_ioremap(&pdev->dev, i2c->twsi_phys, i2c->regsize);
init_waitqueue_head(&i2c->queue); init_waitqueue_head(&i2c->queue);
i2c->irq = irq; i2c->irq = irq;
......
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