* [PATCH v2 1/2] devres: Remove unused devm_free_percpu()
2025-11-11 14:49 [PATCH v2 0/2] devres: clean up and move percpu allocator Andy Shevchenko
@ 2025-11-11 14:49 ` Andy Shevchenko
2025-11-11 14:49 ` [PATCH v2 2/2] devres: Move devm_alloc_percpu() and related to devres.h Andy Shevchenko
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2025-11-11 14:49 UTC (permalink / raw)
To: Andy Shevchenko, Philipp Stanner, Greg Kroah-Hartman, linux-doc,
linux-kernel
Cc: Jonathan Corbet, Rafael J. Wysocki, Danilo Krummrich
Remove unused devm_free_percpu().
By the way, it was never used in the drivers/ from day 1.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
.../driver-api/driver-model/devres.rst | 1 -
drivers/base/devres.c | 25 -------------------
include/linux/device.h | 1 -
3 files changed, 27 deletions(-)
diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
index 2b36ebde9cec..0198ac65e874 100644
--- a/Documentation/driver-api/driver-model/devres.rst
+++ b/Documentation/driver-api/driver-model/devres.rst
@@ -383,7 +383,6 @@ NET
PER-CPU MEM
devm_alloc_percpu()
- devm_free_percpu()
PCI
devm_pci_alloc_host_bridge() : managed PCI host bridge allocation
diff --git a/drivers/base/devres.c b/drivers/base/devres.c
index c948c88d3956..f54db6d138ab 100644
--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -1222,13 +1222,6 @@ static void devm_percpu_release(struct device *dev, void *pdata)
free_percpu(p);
}
-static int devm_percpu_match(struct device *dev, void *data, void *p)
-{
- struct devres *devr = container_of(data, struct devres, data);
-
- return *(void **)devr->data == p;
-}
-
/**
* __devm_alloc_percpu - Resource-managed alloc_percpu
* @dev: Device to allocate per-cpu memory for
@@ -1264,21 +1257,3 @@ void __percpu *__devm_alloc_percpu(struct device *dev, size_t size,
return pcpu;
}
EXPORT_SYMBOL_GPL(__devm_alloc_percpu);
-
-/**
- * devm_free_percpu - Resource-managed free_percpu
- * @dev: Device this memory belongs to
- * @pdata: Per-cpu memory to free
- *
- * Free memory allocated with devm_alloc_percpu().
- */
-void devm_free_percpu(struct device *dev, void __percpu *pdata)
-{
- /*
- * Use devres_release() to prevent memory leakage as
- * devm_free_pages() does.
- */
- WARN_ON(devres_release(dev, devm_percpu_release, devm_percpu_match,
- (void *)(__force unsigned long)pdata));
-}
-EXPORT_SYMBOL_GPL(devm_free_percpu);
diff --git a/include/linux/device.h b/include/linux/device.h
index b031ff71a5bd..0c6377f6631c 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -298,7 +298,6 @@ void device_remove_bin_file(struct device *dev,
void __percpu *__devm_alloc_percpu(struct device *dev, size_t size,
size_t align);
-void devm_free_percpu(struct device *dev, void __percpu *pdata);
struct device_dma_parameters {
/*
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v2 2/2] devres: Move devm_alloc_percpu() and related to devres.h
2025-11-11 14:49 [PATCH v2 0/2] devres: clean up and move percpu allocator Andy Shevchenko
2025-11-11 14:49 ` [PATCH v2 1/2] devres: Remove unused devm_free_percpu() Andy Shevchenko
@ 2025-11-11 14:49 ` Andy Shevchenko
2025-11-11 15:00 ` [PATCH v2 0/2] devres: clean up and move percpu allocator Philipp Stanner
2025-11-19 12:29 ` Danilo Krummrich
3 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2025-11-11 14:49 UTC (permalink / raw)
To: Andy Shevchenko, Philipp Stanner, Greg Kroah-Hartman, linux-doc,
linux-kernel
Cc: Jonathan Corbet, Rafael J. Wysocki, Danilo Krummrich
Move devm_alloc_percpu() and related to devres.h where it belongs,
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
include/linux/device.h | 18 ------------------
include/linux/device/devres.h | 17 +++++++++++++++++
2 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/include/linux/device.h b/include/linux/device.h
index 0c6377f6631c..0be95294b6e6 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -281,24 +281,6 @@ int __must_check device_create_bin_file(struct device *dev,
void device_remove_bin_file(struct device *dev,
const struct bin_attribute *attr);
-/**
- * devm_alloc_percpu - Resource-managed alloc_percpu
- * @dev: Device to allocate per-cpu memory for
- * @type: Type to allocate per-cpu memory for
- *
- * Managed alloc_percpu. Per-cpu memory allocated with this function is
- * automatically freed on driver detach.
- *
- * RETURNS:
- * Pointer to allocated memory on success, NULL on failure.
- */
-#define devm_alloc_percpu(dev, type) \
- ((typeof(type) __percpu *)__devm_alloc_percpu((dev), sizeof(type), \
- __alignof__(type)))
-
-void __percpu *__devm_alloc_percpu(struct device *dev, size_t size,
- size_t align);
-
struct device_dma_parameters {
/*
* a low level driver may set these to teach IOMMU code about
diff --git a/include/linux/device/devres.h b/include/linux/device/devres.h
index 8c5f57e0d613..9c1e3d643d69 100644
--- a/include/linux/device/devres.h
+++ b/include/linux/device/devres.h
@@ -9,6 +9,7 @@
#include <linux/stdarg.h>
#include <linux/types.h>
#include <asm/bug.h>
+#include <asm/percpu.h>
struct device;
struct device_node;
@@ -96,6 +97,22 @@ devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, va_list ap);
char * __printf(3, 4) __malloc
devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...);
+/**
+ * devm_alloc_percpu - Resource-managed alloc_percpu
+ * @dev: Device to allocate per-cpu memory for
+ * @type: Type to allocate per-cpu memory for
+ *
+ * Managed alloc_percpu. Per-cpu memory allocated with this function is
+ * automatically freed on driver detach.
+ *
+ * RETURNS:
+ * Pointer to allocated memory on success, NULL on failure.
+ */
+#define devm_alloc_percpu(dev, type) \
+ ((typeof(type) __percpu *)__devm_alloc_percpu((dev), sizeof(type), __alignof__(type)))
+
+void __percpu *__devm_alloc_percpu(struct device *dev, size_t size, size_t align);
+
unsigned long devm_get_free_pages(struct device *dev, gfp_t gfp_mask, unsigned int order);
void devm_free_pages(struct device *dev, unsigned long addr);
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v2 0/2] devres: clean up and move percpu allocator
2025-11-11 14:49 [PATCH v2 0/2] devres: clean up and move percpu allocator Andy Shevchenko
2025-11-11 14:49 ` [PATCH v2 1/2] devres: Remove unused devm_free_percpu() Andy Shevchenko
2025-11-11 14:49 ` [PATCH v2 2/2] devres: Move devm_alloc_percpu() and related to devres.h Andy Shevchenko
@ 2025-11-11 15:00 ` Philipp Stanner
2025-11-11 17:00 ` Andy Shevchenko
2025-11-19 12:29 ` Danilo Krummrich
3 siblings, 1 reply; 7+ messages in thread
From: Philipp Stanner @ 2025-11-11 15:00 UTC (permalink / raw)
To: Andy Shevchenko, Philipp Stanner, Greg Kroah-Hartman, linux-doc,
linux-kernel
Cc: Jonathan Corbet, Rafael J. Wysocki, Danilo Krummrich
On Tue, 2025-11-11 at 15:49 +0100, Andy Shevchenko wrote:
> Clean up and move managed percpu allocator to devres.h.
>
> Changelog v2:
> - fixed build error by adding a missed inclusion
OK, didn't see v2. Documentation/ still missing, though.
But we only send new versions after waiting for >24h, don't we? :]
Greetings,
Philipp
>
> v1: <20251111144104.910241-1-andriy.shevchenko@linux.intel.com>
>
> Andy Shevchenko (2):
> devres: Remove unused devm_free_percpu()
> devres: Move devm_alloc_percpu() and related to devres.h
>
> .../driver-api/driver-model/devres.rst | 1 -
> drivers/base/devres.c | 25 -------------------
> include/linux/device.h | 19 --------------
> include/linux/device/devres.h | 17 +++++++++++++
> 4 files changed, 17 insertions(+), 45 deletions(-)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] devres: clean up and move percpu allocator
2025-11-11 15:00 ` [PATCH v2 0/2] devres: clean up and move percpu allocator Philipp Stanner
@ 2025-11-11 17:00 ` Andy Shevchenko
0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2025-11-11 17:00 UTC (permalink / raw)
To: phasta
Cc: Greg Kroah-Hartman, linux-doc, linux-kernel, Jonathan Corbet,
Rafael J. Wysocki, Danilo Krummrich
On Tue, Nov 11, 2025 at 04:00:28PM +0100, Philipp Stanner wrote:
> On Tue, 2025-11-11 at 15:49 +0100, Andy Shevchenko wrote:
> > Clean up and move managed percpu allocator to devres.h.
> >
> > Changelog v2:
> > - fixed build error by adding a missed inclusion
>
> OK, didn't see v2. Documentation/ still missing, though.
No, you are wrong.
> But we only send new versions after waiting for >24h, don't we? :]
No need for a new version.
> > .../driver-api/driver-model/devres.rst | 1 -
Again, please read this list carefully.
> > drivers/base/devres.c | 25 -------------------
> > include/linux/device.h | 19 --------------
> > include/linux/device/devres.h | 17 +++++++++++++
> > 4 files changed, 17 insertions(+), 45 deletions(-)
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] devres: clean up and move percpu allocator
2025-11-11 14:49 [PATCH v2 0/2] devres: clean up and move percpu allocator Andy Shevchenko
` (2 preceding siblings ...)
2025-11-11 15:00 ` [PATCH v2 0/2] devres: clean up and move percpu allocator Philipp Stanner
@ 2025-11-19 12:29 ` Danilo Krummrich
2025-11-19 13:56 ` Andy Shevchenko
3 siblings, 1 reply; 7+ messages in thread
From: Danilo Krummrich @ 2025-11-19 12:29 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Philipp Stanner, Greg Kroah-Hartman, linux-doc, linux-kernel,
Jonathan Corbet, Rafael J. Wysocki
On Wed Nov 12, 2025 at 3:49 AM NZDT, Andy Shevchenko wrote:
Applied to driver-core-testing, thanks!
> Andy Shevchenko (2):
> devres: Remove unused devm_free_percpu()
> devres: Move devm_alloc_percpu() and related to devres.h
[ Fix minor typo in commit message. - Danilo ]
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v2 0/2] devres: clean up and move percpu allocator
2025-11-19 12:29 ` Danilo Krummrich
@ 2025-11-19 13:56 ` Andy Shevchenko
0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2025-11-19 13:56 UTC (permalink / raw)
To: Danilo Krummrich
Cc: Philipp Stanner, Greg Kroah-Hartman, linux-doc, linux-kernel,
Jonathan Corbet, Rafael J. Wysocki
On Thu, Nov 20, 2025 at 01:29:59AM +1300, Danilo Krummrich wrote:
> On Wed Nov 12, 2025 at 3:49 AM NZDT, Andy Shevchenko wrote:
>
> Applied to driver-core-testing, thanks!
>
> > Andy Shevchenko (2):
> > devres: Remove unused devm_free_percpu()
> > devres: Move devm_alloc_percpu() and related to devres.h
>
> [ Fix minor typo in commit message. - Danilo ]
Thank you!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread