dmaengine: acpi: devm APIs and other cleanups
Subsystems (3)
cover dmaengine: acpi: devm APIs and other cleanups
Here is a set of a few cleanups mostly related to ACPI DMA devm APIs. No functional changes intended.
Andy Shevchenko (3):
dmaengine: acpi: Drop unused devm_acpi_dma_controller_free()
dmaengine: acpi: Simplify devm_acpi_dma_controller_register()
dmaengine: acpi: Clean up headers
.../driver-api/driver-model/devres.rst | 1 - drivers/dma/acpi-dma.c | 43 ++++++------------- include/linux/acpi_dma.h | 9 ++-- 3 files changed, 15 insertions(+), 38 deletions(-)
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
PATCH 1/3 dmaengine: acpi: Drop unused devm_acpi_dma_controller_free()
After introduction a few years ago the devm_acpi_dma_controller_free() was never used. Drop it.
--- Documentation/driver-api/driver-model/devres.rst | 1 - drivers/dma/acpi-dma.c | 15 --------------- include/linux/acpi_dma.h | 4 ---- 3 files changed, 20 deletions(-)
Documentation/driver-api/driver-model/devres.rst +0 -1
@@ -459,7 +459,6 @@ SERDEV SLAVE DMA ENGINE devm_acpi_dma_controller_register() - devm_acpi_dma_controller_free() SPI devm_spi_alloc_master()
drivers/dma/acpi-dma.c +0 -15
@@ -276,21 +276,6 @@ int devm_acpi_dma_controller_register(struct device *dev, }EXPORT_SYMBOL_GPL (devm_acpi_dma_controller_register); -/** -* devm_acpi_dma_controller_free - resource managed acpi_dma_controller_free() -* @dev: device that is unregistering as DMA controller -* -* Unregister a DMA controller registered with -* devm_acpi_dma_controller_register(). Normally this function will not need to -* be called and the resource management code will ensure that the resource is -* freed. -*/ -void devm_acpi_dma_controller_free (struct device *dev) -{ -WARN_ON (devres_release (dev, devm_acpi_dma_release,NULL ,NULL )); -} -EXPORT_SYMBOL_GPL (devm_acpi_dma_controller_free); -/** * acpi_dma_update_dma_spec - prepare dma specifier to pass to translation function * @adma: struct acpi_dma of DMA controller
include/linux/acpi_dma.h +0 -4
@@ -65,7 +65,6 @@ int devm_acpi_dma_controller_register(struct device *dev,struct dma_chan *(*acpi_dma_xlate) (struct acpi_dma_spec *,struct acpi_dma *), void *data); -void devm_acpi_dma_controller_free (struct device *dev);struct dma_chan *acpi_dma_request_slave_chan_by_index (struct device *dev,size_t index);
@@ -94,9 +93,6 @@ static inline int devm_acpi_dma_controller_register(struct device *dev, {return -ENODEV ; } -static inline void devm_acpi_dma_controller_free (struct device *dev) -{ -}static inline struct dma_chan *acpi_dma_request_slave_chan_by_index (struct device *dev,size_t index)
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
PATCH 2/3 dmaengine: acpi: Simplify devm_acpi_dma_controller_register()
In reply to Andy ShevchenkoUse 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.
--- drivers/dma/acpi-dma.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/dma/acpi-dma.c +4 -11
@@ -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);
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
PATCH 3/3 dmaengine: acpi: Clean up headers
In reply to Andy ShevchenkoThere is a few things done:
- include only the headers we are direct user of
- when pointer is in use, provide a forward declaration
- add missing headers
- sort alphabetically
--- drivers/dma/acpi-dma.c | 13 ++++++++----- include/linux/acpi_dma.h | 5 +++-- 2 files changed, 11 insertions(+), 7 deletions(-)
drivers/dma/acpi-dma.c +8 -5
@@ -9,18 +9,21 @@* Mika Westerberg <[email protected]> */ +#include <linux/acpi.h> +#include <linux/acpi_dma.h> #include <linux/device.h> #include <linux/dma-mapping.h> #include <linux/err.h> -#include <linux/module.h> +#include <linux/errno.h> +#include <linux/export.h> +#include <linux/ioport.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/mutex.h> -#include <linux/slab.h> -#include <linux/ioport.h> -#include <linux/acpi.h> -#include <linux/acpi_dma.h> #include <linux/property.h> +#include <linux/slab.h> +#include <linux/string.h> +#include <linux/types.h> static LIST_HEAD (acpi_dma_list);static DEFINE_MUTEX (acpi_dma_lock);
include/linux/acpi_dma.h +3 -2
@@ -11,10 +11,11 @@#ifndef __LINUX_ACPI_DMA_H#define __LINUX_ACPI_DMA_H -#include <linux/list.h> -#include <linux/device.h> #include <linux/err.h> #include <linux/dmaengine.h> +#include <linux/types.h> + +struct device ;/** * struct acpi_dma_spec - slave device DMA resources
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Quoted 9 lines · Andy Shevchenko
Here is a set of a few cleanups mostly related to ACPI DMA devm APIs. No functional changes intended.
Andy Shevchenko (3):
dmaengine: acpi: Drop unuseddevm_acpi_dma_controller_free()
dmaengine: acpi: Simplifydevm_acpi_dma_controller_register()
dmaengine: acpi: Clean up headers[...]
Applied, thanks!
[1/3] dmaengine: acpi: Drop unused devm_acpi_dma_controller_free()
commit: 6e3ea06240adfef7b46e2338dd824541c31de06d
[2/3] dmaengine: acpi: Simplify devm_acpi_dma_controller_register()
commit: c0fecce865535f77e7a8220175b126392dfe99dc
[3/3] dmaengine: acpi: Clean up headers
commit: 662f045332addc961940e48eb920caa954abbf09Best regards,
Signature · 1 line
~Vinod