diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2019-08-20 16:15:43 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-01-29 12:21:47 +0300 |
commit | 5437f62fa2a9792711e576a87b0e1ab65ecf3a74 (patch) | |
tree | cebd4125de5ef0d86390d48083c4ccc420fbee97 | |
parent | a1800bbb992418c5572d7136b59624a967ccf055 (diff) | |
download | linux-5437f62fa2a9792711e576a87b0e1ab65ecf3a74.tar.xz |
dmaengine: dw: platform: Switch to acpi_dma_controller_register()
[ Upstream commit e7b8514e4d68bec21fc6385fa0a66797ddc34ac9 ]
There is a possibility to have registered ACPI DMA controller
while it has been gone already.
To avoid the potential crash, move to non-managed
acpi_dma_controller_register().
Fixes: 42c91ee71d6d ("dw_dmac: add ACPI support")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20190820131546.75744-8-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/dma/dw/platform.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c index 68a4815750b5..22d0cc1855b5 100644 --- a/drivers/dma/dw/platform.c +++ b/drivers/dma/dw/platform.c @@ -87,13 +87,20 @@ static void dw_dma_acpi_controller_register(struct dw_dma *dw) dma_cap_set(DMA_SLAVE, info->dma_cap); info->filter_fn = dw_dma_acpi_filter; - ret = devm_acpi_dma_controller_register(dev, acpi_dma_simple_xlate, - info); + ret = acpi_dma_controller_register(dev, acpi_dma_simple_xlate, info); if (ret) dev_err(dev, "could not register acpi_dma_controller\n"); } + +static void dw_dma_acpi_controller_free(struct dw_dma *dw) +{ + struct device *dev = dw->dma.dev; + + acpi_dma_controller_free(dev); +} #else /* !CONFIG_ACPI */ static inline void dw_dma_acpi_controller_register(struct dw_dma *dw) {} +static inline void dw_dma_acpi_controller_free(struct dw_dma *dw) {} #endif /* !CONFIG_ACPI */ #ifdef CONFIG_OF @@ -225,6 +232,9 @@ static int dw_remove(struct platform_device *pdev) { struct dw_dma_chip *chip = platform_get_drvdata(pdev); + if (ACPI_HANDLE(&pdev->dev)) + dw_dma_acpi_controller_free(chip->dw); + if (pdev->dev.of_node) of_dma_controller_free(pdev->dev.of_node); |