diff options
author | Jan Glauber <jglauber@cavium.com> | 2016-03-18 04:46:27 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2016-03-18 10:50:27 -0400 |
commit | 54108e56a8339018284c81cf8dcde66afc7e42c1 (patch) | |
tree | 49ea1368c402bf6228f3b48affbd2110f73b13f1 | |
parent | dfcd821218c958dbc3e74566ccf5f362f517e279 (diff) |
i2c: octeon: Cleanup resource allocation code
Remove resource values from struct i2c_octeon and use
devm_ioremap_resource helper.
Signed-off-by: Jan Glauber <jglauber@cavium.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r-- | drivers/i2c/busses/i2c-octeon.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c index 9787379dbfe7..9240037e10ee 100644 --- a/drivers/i2c/busses/i2c-octeon.c +++ b/drivers/i2c/busses/i2c-octeon.c | |||
@@ -75,9 +75,7 @@ struct octeon_i2c { | |||
75 | int irq; | 75 | int irq; |
76 | u32 twsi_freq; | 76 | u32 twsi_freq; |
77 | int sys_freq; | 77 | int sys_freq; |
78 | resource_size_t twsi_phys; | ||
79 | void __iomem *twsi_base; | 78 | void __iomem *twsi_base; |
80 | resource_size_t regsize; | ||
81 | struct device *dev; | 79 | struct device *dev; |
82 | }; | 80 | }; |
83 | 81 | ||
@@ -502,14 +500,11 @@ static int octeon_i2c_probe(struct platform_device *pdev) | |||
502 | i2c->dev = &pdev->dev; | 500 | i2c->dev = &pdev->dev; |
503 | 501 | ||
504 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 502 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
505 | 503 | i2c->twsi_base = devm_ioremap_resource(&pdev->dev, res_mem); | |
506 | if (res_mem == NULL) { | 504 | if (IS_ERR(i2c->twsi_base)) { |
507 | dev_err(i2c->dev, "found no memory resource\n"); | 505 | result = PTR_ERR(i2c->twsi_base); |
508 | result = -ENXIO; | ||
509 | goto out; | 506 | goto out; |
510 | } | 507 | } |
511 | i2c->twsi_phys = res_mem->start; | ||
512 | i2c->regsize = resource_size(res_mem); | ||
513 | 508 | ||
514 | /* | 509 | /* |
515 | * "clock-rate" is a legacy binding, the official binding is | 510 | * "clock-rate" is a legacy binding, the official binding is |
@@ -526,13 +521,6 @@ static int octeon_i2c_probe(struct platform_device *pdev) | |||
526 | 521 | ||
527 | i2c->sys_freq = octeon_get_io_clock_rate(); | 522 | i2c->sys_freq = octeon_get_io_clock_rate(); |
528 | 523 | ||
529 | if (!devm_request_mem_region(&pdev->dev, i2c->twsi_phys, i2c->regsize, | ||
530 | res_mem->name)) { | ||
531 | dev_err(i2c->dev, "request_mem_region failed\n"); | ||
532 | goto out; | ||
533 | } | ||
534 | i2c->twsi_base = devm_ioremap(&pdev->dev, i2c->twsi_phys, i2c->regsize); | ||
535 | |||
536 | init_waitqueue_head(&i2c->queue); | 524 | init_waitqueue_head(&i2c->queue); |
537 | 525 | ||
538 | i2c->irq = irq; | 526 | i2c->irq = irq; |