Commit 84da042e authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Vinod Koul

dmaengine: dw: platform: Move handle check to dw_dma_acpi_controller_register()

Move ACPI handle check to the dw_dma_acpi_controller_register().

While here, convert it to has_acpi_companion() which is recommended way.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20190820131546.75744-9-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent e7b8514e
...@@ -76,6 +76,9 @@ static void dw_dma_acpi_controller_register(struct dw_dma *dw) ...@@ -76,6 +76,9 @@ static void dw_dma_acpi_controller_register(struct dw_dma *dw)
struct acpi_dma_filter_info *info; struct acpi_dma_filter_info *info;
int ret; int ret;
if (!has_acpi_companion(dev))
return;
info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
if (!info) if (!info)
return; return;
...@@ -93,6 +96,9 @@ static void dw_dma_acpi_controller_free(struct dw_dma *dw) ...@@ -93,6 +96,9 @@ static void dw_dma_acpi_controller_free(struct dw_dma *dw)
{ {
struct device *dev = dw->dma.dev; struct device *dev = dw->dma.dev;
if (!has_acpi_companion(dev))
return;
acpi_dma_controller_free(dev); acpi_dma_controller_free(dev);
} }
#else /* !CONFIG_ACPI */ #else /* !CONFIG_ACPI */
...@@ -239,8 +245,7 @@ static int dw_probe(struct platform_device *pdev) ...@@ -239,8 +245,7 @@ static int dw_probe(struct platform_device *pdev)
"could not register of_dma_controller\n"); "could not register of_dma_controller\n");
} }
if (ACPI_HANDLE(&pdev->dev)) dw_dma_acpi_controller_register(chip->dw);
dw_dma_acpi_controller_register(chip->dw);
return 0; return 0;
...@@ -256,8 +261,7 @@ static int dw_remove(struct platform_device *pdev) ...@@ -256,8 +261,7 @@ static int dw_remove(struct platform_device *pdev)
struct dw_dma_chip *chip = data->chip; struct dw_dma_chip *chip = data->chip;
int ret; int ret;
if (ACPI_HANDLE(&pdev->dev)) dw_dma_acpi_controller_free(chip->dw);
dw_dma_acpi_controller_free(chip->dw);
if (pdev->dev.of_node) if (pdev->dev.of_node)
of_dma_controller_free(pdev->dev.of_node); of_dma_controller_free(pdev->dev.of_node);
......
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