--- v1
+++ v6
@@ -1,106 +1,25 @@
-Use resource-managed variant of request_irq for brevity.
+Use devm_platform_ioremap_resource to keep code cleaner a tad.
+Acked-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
- drivers/dma/tegra20-apb-dma.c | 35 +++++++++++------------------------
- 1 file changed, 11 insertions(+), 24 deletions(-)
+ drivers/dma/tegra20-apb-dma.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
-index d2353f23b201..194a7faf12ba 100644
+index aafad50d075e..f44291207928 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
-@@ -182,7 +182,6 @@ struct tegra_dma_channel {
- char name[12];
- bool config_init;
- int id;
-- int irq;
- void __iomem *chan_addr;
- spinlock_t lock;
- bool busy;
-@@ -1383,7 +1382,6 @@ static const struct tegra_dma_chip_data tegra148_dma_chip_data = {
+@@ -1402,8 +1402,7 @@ static int tegra_dma_probe(struct platform_device *pdev)
+ tdma->chip_data = cdata;
+ platform_set_drvdata(pdev, tdma);
- static int tegra_dma_probe(struct platform_device *pdev)
- {
-- struct resource *res;
- struct tegra_dma *tdma;
- int ret;
- int i;
-@@ -1449,25 +1447,27 @@ static int tegra_dma_probe(struct platform_device *pdev)
- INIT_LIST_HEAD(&tdma->dma_dev.channels);
- for (i = 0; i < cdata->nr_channels; i++) {
- struct tegra_dma_channel *tdc = &tdma->channels[i];
-+ int irq;
+- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+- tdma->base_addr = devm_ioremap_resource(&pdev->dev, res);
++ tdma->base_addr = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(tdma->base_addr))
+ return PTR_ERR(tdma->base_addr);
- tdc->chan_addr = tdma->base_addr +
- TEGRA_APBDMA_CHANNEL_BASE_ADD_OFFSET +
- (i * cdata->channel_reg_size);
-
-- res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
-- if (!res) {
-- ret = -EINVAL;
-+ irq = platform_get_irq(pdev, i);
-+ if (irq < 0) {
-+ ret = irq;
- dev_err(&pdev->dev, "No irq resource for chan %d\n", i);
-- goto err_irq;
-+ goto err_pm_disable;
- }
-- tdc->irq = res->start;
-+
- snprintf(tdc->name, sizeof(tdc->name), "apbdma.%d", i);
-- ret = request_irq(tdc->irq, tegra_dma_isr, 0, tdc->name, tdc);
-+ ret = devm_request_irq(&pdev->dev, irq, tegra_dma_isr, 0,
-+ tdc->name, tdc);
- if (ret) {
- dev_err(&pdev->dev,
- "request_irq failed with err %d channel %d\n",
- ret, i);
-- goto err_irq;
-+ goto err_pm_disable;
- }
-
- tdc->dma_chan.device = &tdma->dma_dev;
-@@ -1520,7 +1520,7 @@ static int tegra_dma_probe(struct platform_device *pdev)
- if (ret < 0) {
- dev_err(&pdev->dev,
- "Tegra20 APB DMA driver registration failed %d\n", ret);
-- goto err_irq;
-+ goto err_pm_disable;
- }
-
- ret = of_dma_controller_register(pdev->dev.of_node,
-@@ -1537,13 +1537,7 @@ static int tegra_dma_probe(struct platform_device *pdev)
-
- err_unregister_dma_dev:
- dma_async_device_unregister(&tdma->dma_dev);
--err_irq:
-- while (--i >= 0) {
-- struct tegra_dma_channel *tdc = &tdma->channels[i];
--
-- free_irq(tdc->irq, tdc);
-- }
--
-+err_pm_disable:
- pm_runtime_disable(&pdev->dev);
- if (!pm_runtime_status_suspended(&pdev->dev))
- tegra_dma_runtime_suspend(&pdev->dev);
-@@ -1553,16 +1547,9 @@ static int tegra_dma_probe(struct platform_device *pdev)
- static int tegra_dma_remove(struct platform_device *pdev)
- {
- struct tegra_dma *tdma = platform_get_drvdata(pdev);
-- int i;
-- struct tegra_dma_channel *tdc;
-
- dma_async_device_unregister(&tdma->dma_dev);
-
-- for (i = 0; i < tdma->chip_data->nr_channels; ++i) {
-- tdc = &tdma->channels[i];
-- free_irq(tdc->irq, tdc);
-- }
--
- pm_runtime_disable(&pdev->dev);
- if (!pm_runtime_status_suspended(&pdev->dev))
- tegra_dma_runtime_suspend(&pdev->dev);
--
2.24.0