Commit 9f87d6f2 authored by Jingoo Han's avatar Jingoo Han Committed by Mark Brown

spi: atmel: Use devm_*() functions

Use devm_*() functions to make cleanup paths simpler.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 6ce4eac1
...@@ -1510,7 +1510,7 @@ static int atmel_spi_probe(struct platform_device *pdev) ...@@ -1510,7 +1510,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
if (irq < 0) if (irq < 0)
return irq; return irq;
clk = clk_get(&pdev->dev, "spi_clk"); clk = devm_clk_get(&pdev->dev, "spi_clk");
if (IS_ERR(clk)) if (IS_ERR(clk))
return PTR_ERR(clk); return PTR_ERR(clk);
...@@ -1570,14 +1570,14 @@ static int atmel_spi_probe(struct platform_device *pdev) ...@@ -1570,14 +1570,14 @@ static int atmel_spi_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "Atmel SPI Controller using PIO only\n"); dev_info(&pdev->dev, "Atmel SPI Controller using PIO only\n");
if (as->use_pdc) { if (as->use_pdc) {
ret = request_irq(irq, atmel_spi_pdc_interrupt, 0, ret = devm_request_irq(&pdev->dev, irq, atmel_spi_pdc_interrupt,
dev_name(&pdev->dev), master); 0, dev_name(&pdev->dev), master);
} else { } else {
tasklet_init(&as->tasklet, atmel_spi_tasklet_func, tasklet_init(&as->tasklet, atmel_spi_tasklet_func,
(unsigned long)master); (unsigned long)master);
ret = request_irq(irq, atmel_spi_pio_interrupt, 0, ret = devm_request_irq(&pdev->dev, irq, atmel_spi_pio_interrupt,
dev_name(&pdev->dev), master); 0, dev_name(&pdev->dev), master);
} }
if (ret) if (ret)
goto out_unmap_regs; goto out_unmap_regs;
...@@ -1603,7 +1603,7 @@ static int atmel_spi_probe(struct platform_device *pdev) ...@@ -1603,7 +1603,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "Atmel SPI Controller at 0x%08lx (irq %d)\n", dev_info(&pdev->dev, "Atmel SPI Controller at 0x%08lx (irq %d)\n",
(unsigned long)regs->start, irq); (unsigned long)regs->start, irq);
ret = spi_register_master(master); ret = devm_spi_register_master(&pdev->dev, master);
if (ret) if (ret)
goto out_free_dma; goto out_free_dma;
...@@ -1617,7 +1617,6 @@ static int atmel_spi_probe(struct platform_device *pdev) ...@@ -1617,7 +1617,6 @@ static int atmel_spi_probe(struct platform_device *pdev)
spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
clk_disable_unprepare(clk); clk_disable_unprepare(clk);
out_free_irq: out_free_irq:
free_irq(irq, master);
out_unmap_regs: out_unmap_regs:
out_free_buffer: out_free_buffer:
if (!as->use_pdc) if (!as->use_pdc)
...@@ -1625,7 +1624,6 @@ static int atmel_spi_probe(struct platform_device *pdev) ...@@ -1625,7 +1624,6 @@ static int atmel_spi_probe(struct platform_device *pdev)
dma_free_coherent(&pdev->dev, BUFFER_SIZE, as->buffer, dma_free_coherent(&pdev->dev, BUFFER_SIZE, as->buffer,
as->buffer_dma); as->buffer_dma);
out_free: out_free:
clk_put(clk);
spi_master_put(master); spi_master_put(master);
return ret; return ret;
} }
...@@ -1668,10 +1666,6 @@ static int atmel_spi_remove(struct platform_device *pdev) ...@@ -1668,10 +1666,6 @@ static int atmel_spi_remove(struct platform_device *pdev)
as->buffer_dma); as->buffer_dma);
clk_disable_unprepare(as->clk); clk_disable_unprepare(as->clk);
clk_put(as->clk);
free_irq(as->irq, master);
spi_unregister_master(master);
return 0; return 0;
} }
......
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