summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-07-28 13:38:06 (GMT)
committerMark Brown <broonie@linaro.org>2013-07-29 11:41:01 (GMT)
commit1729ce3441ad849e63403fa4347fa86e052559a5 (patch)
treed1da14aba35bed8dea1adfe5f60097dfd642dd99 /drivers
parent3b2f64d00c46e1e4e9bd0bb9bb12619adac27a4b (diff)
downloadlinux-1729ce3441ad849e63403fa4347fa86e052559a5.tar.xz
spi/orion: Convert to devm_ioremap_resource()
Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Andrew Lunn <andrew@lunn.ch>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/spi-orion.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
index 5d90beb..551bea7 100644
--- a/drivers/spi/spi-orion.c
+++ b/drivers/spi/spi-orion.c
@@ -446,30 +446,22 @@ static int orion_spi_probe(struct platform_device *pdev)
spi->min_speed = DIV_ROUND_UP(tclk_hz, 30);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (r == NULL) {
- status = -ENODEV;
+ spi->base = devm_ioremap_resource(&pdev->dev, r);
+ if (IS_ERR(spi->base)) {
+ status = PTR_ERR(spi->base);
goto out_rel_clk;
}
- if (!request_mem_region(r->start, resource_size(r),
- dev_name(&pdev->dev))) {
- status = -EBUSY;
- goto out_rel_clk;
- }
- spi->base = ioremap(r->start, SZ_1K);
-
if (orion_spi_reset(spi) < 0)
- goto out_rel_mem;
+ goto out_rel_clk;
master->dev.of_node = pdev->dev.of_node;
status = spi_register_master(master);
if (status < 0)
- goto out_rel_mem;
+ goto out_rel_clk;
return status;
-out_rel_mem:
- release_mem_region(r->start, resource_size(r));
out_rel_clk:
clk_disable_unprepare(spi->clk);
clk_put(spi->clk);
@@ -482,7 +474,6 @@ out:
static int orion_spi_remove(struct platform_device *pdev)
{
struct spi_master *master;
- struct resource *r;
struct orion_spi *spi;
master = platform_get_drvdata(pdev);
@@ -491,9 +482,6 @@ static int orion_spi_remove(struct platform_device *pdev)
clk_disable_unprepare(spi->clk);
clk_put(spi->clk);
- r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- release_mem_region(r->start, resource_size(r));
-
spi_unregister_master(master);
return 0;