Commit 2cd3d13c authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Vinod Koul

dmaengine: tegra-apb: Use devm_request_irq

Use resource-managed variant of request_irq for brevity.
Signed-off-by: default avatarDmitry Osipenko <digetx@gmail.com>
Acked-by: default avatarJon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20200209163356.6439-8-digetx@gmail.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent c55c745e
...@@ -182,7 +182,6 @@ struct tegra_dma_channel { ...@@ -182,7 +182,6 @@ struct tegra_dma_channel {
char name[12]; char name[12];
bool config_init; bool config_init;
int id; int id;
int irq;
void __iomem *chan_addr; void __iomem *chan_addr;
spinlock_t lock; spinlock_t lock;
bool busy; bool busy;
...@@ -1384,7 +1383,6 @@ static const struct tegra_dma_chip_data tegra148_dma_chip_data = { ...@@ -1384,7 +1383,6 @@ static const struct tegra_dma_chip_data tegra148_dma_chip_data = {
static int tegra_dma_probe(struct platform_device *pdev) static int tegra_dma_probe(struct platform_device *pdev)
{ {
struct resource *res;
struct tegra_dma *tdma; struct tegra_dma *tdma;
int ret; int ret;
int i; int i;
...@@ -1450,25 +1448,27 @@ static int tegra_dma_probe(struct platform_device *pdev) ...@@ -1450,25 +1448,27 @@ static int tegra_dma_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&tdma->dma_dev.channels); INIT_LIST_HEAD(&tdma->dma_dev.channels);
for (i = 0; i < cdata->nr_channels; i++) { for (i = 0; i < cdata->nr_channels; i++) {
struct tegra_dma_channel *tdc = &tdma->channels[i]; struct tegra_dma_channel *tdc = &tdma->channels[i];
int irq;
tdc->chan_addr = tdma->base_addr + tdc->chan_addr = tdma->base_addr +
TEGRA_APBDMA_CHANNEL_BASE_ADD_OFFSET + TEGRA_APBDMA_CHANNEL_BASE_ADD_OFFSET +
(i * cdata->channel_reg_size); (i * cdata->channel_reg_size);
res = platform_get_resource(pdev, IORESOURCE_IRQ, i); irq = platform_get_irq(pdev, i);
if (!res) { if (irq < 0) {
ret = -EINVAL; ret = irq;
dev_err(&pdev->dev, "No irq resource for chan %d\n", i); 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); 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) { if (ret) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"request_irq failed with err %d channel %d\n", "request_irq failed with err %d channel %d\n",
ret, i); ret, i);
goto err_irq; goto err_pm_disable;
} }
tdc->dma_chan.device = &tdma->dma_dev; tdc->dma_chan.device = &tdma->dma_dev;
...@@ -1521,7 +1521,7 @@ static int tegra_dma_probe(struct platform_device *pdev) ...@@ -1521,7 +1521,7 @@ static int tegra_dma_probe(struct platform_device *pdev)
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Tegra20 APB DMA driver registration failed %d\n", ret); "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, ret = of_dma_controller_register(pdev->dev.of_node,
...@@ -1538,13 +1538,7 @@ static int tegra_dma_probe(struct platform_device *pdev) ...@@ -1538,13 +1538,7 @@ static int tegra_dma_probe(struct platform_device *pdev)
err_unregister_dma_dev: err_unregister_dma_dev:
dma_async_device_unregister(&tdma->dma_dev); dma_async_device_unregister(&tdma->dma_dev);
err_irq: err_pm_disable:
while (--i >= 0) {
struct tegra_dma_channel *tdc = &tdma->channels[i];
free_irq(tdc->irq, tdc);
}
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
if (!pm_runtime_status_suspended(&pdev->dev)) if (!pm_runtime_status_suspended(&pdev->dev))
tegra_dma_runtime_suspend(&pdev->dev); tegra_dma_runtime_suspend(&pdev->dev);
...@@ -1554,16 +1548,9 @@ static int tegra_dma_probe(struct platform_device *pdev) ...@@ -1554,16 +1548,9 @@ static int tegra_dma_probe(struct platform_device *pdev)
static int tegra_dma_remove(struct platform_device *pdev) static int tegra_dma_remove(struct platform_device *pdev)
{ {
struct tegra_dma *tdma = platform_get_drvdata(pdev); struct tegra_dma *tdma = platform_get_drvdata(pdev);
int i;
struct tegra_dma_channel *tdc;
dma_async_device_unregister(&tdma->dma_dev); 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); pm_runtime_disable(&pdev->dev);
if (!pm_runtime_status_suspended(&pdev->dev)) if (!pm_runtime_status_suspended(&pdev->dev))
tegra_dma_runtime_suspend(&pdev->dev); tegra_dma_runtime_suspend(&pdev->dev);
......
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