summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2024-10-07 18:03:24 +0300
committerVinod Koul <vkoul@kernel.org>2024-10-14 23:27:57 +0530
commitc0fecce865535f77e7a8220175b126392dfe99dc (patch)
treeb2e87ffe79ab7dc3c00950256a5c904b216afd66
parent6e3ea06240adfef7b46e2338dd824541c31de06d (diff)
dmaengine: acpi: Simplify devm_acpi_dma_controller_register()
Use devm_add_action_or_reset() instead of devres_alloc() and devres_add(), which works the same. This will simplify the code. There is no functional changes. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20241007150436.2183575-3-andriy.shevchenko@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
-rw-r--r--drivers/dma/acpi-dma.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/dma/acpi-dma.c b/drivers/dma/acpi-dma.c
index d5beb96ef510..f594ea265c76 100644
--- a/drivers/dma/acpi-dma.c
+++ b/drivers/dma/acpi-dma.c
@@ -236,7 +236,7 @@ int acpi_dma_controller_free(struct device *dev)
}
EXPORT_SYMBOL_GPL(acpi_dma_controller_free);
-static void devm_acpi_dma_release(struct device *dev, void *res)
+static void devm_acpi_dma_free(void *dev)
{
acpi_dma_controller_free(dev);
}
@@ -259,20 +259,13 @@ int devm_acpi_dma_controller_register(struct device *dev,
(struct acpi_dma_spec *, struct acpi_dma *),
void *data)
{
- void *res;
int ret;
- res = devres_alloc(devm_acpi_dma_release, 0, GFP_KERNEL);
- if (!res)
- return -ENOMEM;
-
ret = acpi_dma_controller_register(dev, acpi_dma_xlate, data);
- if (ret) {
- devres_free(res);
+ if (ret)
return ret;
- }
- devres_add(dev, res);
- return 0;
+
+ return devm_add_action_or_reset(dev, devm_acpi_dma_free, dev);
}
EXPORT_SYMBOL_GPL(devm_acpi_dma_controller_register);