* [PATCH v1 0/3] dmaengine: acpi: devm APIs and other cleanups
@ 2024-10-07 15:03 Andy Shevchenko
2024-10-07 15:03 ` [PATCH v1 1/3] dmaengine: acpi: Drop unused devm_acpi_dma_controller_free() Andy Shevchenko
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-10-07 15:03 UTC (permalink / raw)
To: Andy Shevchenko, linux-doc, linux-kernel, dmaengine
Cc: Jonathan Corbet, Vinod Koul
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(-)
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 1/3] dmaengine: acpi: Drop unused devm_acpi_dma_controller_free()
2024-10-07 15:03 [PATCH v1 0/3] dmaengine: acpi: devm APIs and other cleanups Andy Shevchenko
@ 2024-10-07 15:03 ` Andy Shevchenko
2024-10-07 15:03 ` [PATCH v1 2/3] dmaengine: acpi: Simplify devm_acpi_dma_controller_register() Andy Shevchenko
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-10-07 15:03 UTC (permalink / raw)
To: Andy Shevchenko, linux-doc, linux-kernel, dmaengine
Cc: Jonathan Corbet, Vinod Koul
After introduction a few years ago the devm_acpi_dma_controller_free()
was never used. Drop it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
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(-)
diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
index 5f2ee8d717b1..f23dbe5d6606 100644
--- a/Documentation/driver-api/driver-model/devres.rst
+++ b/Documentation/driver-api/driver-model/devres.rst
@@ -459,7 +459,6 @@ SERDEV
SLAVE DMA ENGINE
devm_acpi_dma_controller_register()
- devm_acpi_dma_controller_free()
SPI
devm_spi_alloc_master()
diff --git a/drivers/dma/acpi-dma.c b/drivers/dma/acpi-dma.c
index a58a1600dd65..d5beb96ef510 100644
--- a/drivers/dma/acpi-dma.c
+++ b/drivers/dma/acpi-dma.c
@@ -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
diff --git a/include/linux/acpi_dma.h b/include/linux/acpi_dma.h
index 72cedb916a9c..3ef1ec7a04cb 100644
--- a/include/linux/acpi_dma.h
+++ b/include/linux/acpi_dma.h
@@ -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)
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v1 2/3] dmaengine: acpi: Simplify devm_acpi_dma_controller_register()
2024-10-07 15:03 [PATCH v1 0/3] dmaengine: acpi: devm APIs and other cleanups Andy Shevchenko
2024-10-07 15:03 ` [PATCH v1 1/3] dmaengine: acpi: Drop unused devm_acpi_dma_controller_free() Andy Shevchenko
@ 2024-10-07 15:03 ` Andy Shevchenko
2024-10-07 15:03 ` [PATCH v1 3/3] dmaengine: acpi: Clean up headers Andy Shevchenko
2024-10-14 18:32 ` [PATCH v1 0/3] dmaengine: acpi: devm APIs and other cleanups Vinod Koul
3 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-10-07 15:03 UTC (permalink / raw)
To: Andy Shevchenko, linux-doc, linux-kernel, dmaengine
Cc: Jonathan Corbet, Vinod Koul
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>
---
drivers/dma/acpi-dma.c | 15 ++++-----------
1 file 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);
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v1 3/3] dmaengine: acpi: Clean up headers
2024-10-07 15:03 [PATCH v1 0/3] dmaengine: acpi: devm APIs and other cleanups Andy Shevchenko
2024-10-07 15:03 ` [PATCH v1 1/3] dmaengine: acpi: Drop unused devm_acpi_dma_controller_free() Andy Shevchenko
2024-10-07 15:03 ` [PATCH v1 2/3] dmaengine: acpi: Simplify devm_acpi_dma_controller_register() Andy Shevchenko
@ 2024-10-07 15:03 ` Andy Shevchenko
2024-10-14 18:32 ` [PATCH v1 0/3] dmaengine: acpi: devm APIs and other cleanups Vinod Koul
3 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-10-07 15:03 UTC (permalink / raw)
To: Andy Shevchenko, linux-doc, linux-kernel, dmaengine
Cc: Jonathan Corbet, Vinod Koul
There 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
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/dma/acpi-dma.c | 13 ++++++++-----
include/linux/acpi_dma.h | 5 +++--
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/dma/acpi-dma.c b/drivers/dma/acpi-dma.c
index f594ea265c76..2abbe11e797e 100644
--- a/drivers/dma/acpi-dma.c
+++ b/drivers/dma/acpi-dma.c
@@ -9,18 +9,21 @@
* Mika Westerberg <mika.westerberg@linux.intel.com>
*/
+#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);
diff --git a/include/linux/acpi_dma.h b/include/linux/acpi_dma.h
index 3ef1ec7a04cb..e748b2877602 100644
--- a/include/linux/acpi_dma.h
+++ b/include/linux/acpi_dma.h
@@ -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
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 0/3] dmaengine: acpi: devm APIs and other cleanups
2024-10-07 15:03 [PATCH v1 0/3] dmaengine: acpi: devm APIs and other cleanups Andy Shevchenko
` (2 preceding siblings ...)
2024-10-07 15:03 ` [PATCH v1 3/3] dmaengine: acpi: Clean up headers Andy Shevchenko
@ 2024-10-14 18:32 ` Vinod Koul
3 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2024-10-14 18:32 UTC (permalink / raw)
To: linux-doc, linux-kernel, dmaengine, Andy Shevchenko; +Cc: Jonathan Corbet
On Mon, 07 Oct 2024 18:03:22 +0300, Andy Shevchenko wrote:
> 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
>
> [...]
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: 662f045332addc961940e48eb920caa954abbf09
Best regards,
--
~Vinod
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-10-14 18:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 15:03 [PATCH v1 0/3] dmaengine: acpi: devm APIs and other cleanups Andy Shevchenko
2024-10-07 15:03 ` [PATCH v1 1/3] dmaengine: acpi: Drop unused devm_acpi_dma_controller_free() Andy Shevchenko
2024-10-07 15:03 ` [PATCH v1 2/3] dmaengine: acpi: Simplify devm_acpi_dma_controller_register() Andy Shevchenko
2024-10-07 15:03 ` [PATCH v1 3/3] dmaengine: acpi: Clean up headers Andy Shevchenko
2024-10-14 18:32 ` [PATCH v1 0/3] dmaengine: acpi: devm APIs and other cleanups Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).