Merge remote-tracking branch 'spi/topic/orion' into spi-next

This commit is contained in:
Mark Brown 2013-09-01 13:49:02 +01:00
commit 11c28cfc1e
1 changed files with 5 additions and 17 deletions

View File

@ -447,30 +447,22 @@ static int orion_spi_probe(struct platform_device *pdev)
spi->min_speed = DIV_ROUND_UP(tclk_hz, 30); spi->min_speed = DIV_ROUND_UP(tclk_hz, 30);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (r == NULL) { spi->base = devm_ioremap_resource(&pdev->dev, r);
status = -ENODEV; if (IS_ERR(spi->base)) {
status = PTR_ERR(spi->base);
goto out_rel_clk; 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) if (orion_spi_reset(spi) < 0)
goto out_rel_mem; goto out_rel_clk;
master->dev.of_node = pdev->dev.of_node; master->dev.of_node = pdev->dev.of_node;
status = spi_register_master(master); status = spi_register_master(master);
if (status < 0) if (status < 0)
goto out_rel_mem; goto out_rel_clk;
return status; return status;
out_rel_mem:
release_mem_region(r->start, resource_size(r));
out_rel_clk: out_rel_clk:
clk_disable_unprepare(spi->clk); clk_disable_unprepare(spi->clk);
clk_put(spi->clk); clk_put(spi->clk);
@ -483,7 +475,6 @@ out:
static int orion_spi_remove(struct platform_device *pdev) static int orion_spi_remove(struct platform_device *pdev)
{ {
struct spi_master *master; struct spi_master *master;
struct resource *r;
struct orion_spi *spi; struct orion_spi *spi;
master = platform_get_drvdata(pdev); master = platform_get_drvdata(pdev);
@ -492,9 +483,6 @@ static int orion_spi_remove(struct platform_device *pdev)
clk_disable_unprepare(spi->clk); clk_disable_unprepare(spi->clk);
clk_put(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); spi_unregister_master(master);
return 0; return 0;