All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] devres: Move remaining devm_alloc_percpu and devm_device_add_group to devres.h
@ 2025-05-22  9:01 Pei Xiao
  2025-05-22 12:54 ` Andy Shevchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Pei Xiao @ 2025-05-22  9:01 UTC (permalink / raw)
  To: gregkh, linux-kernel, rafael, dakr, andriy.shevchenko,
	bartosz.golaszewski
  Cc: Pei Xiao

Since commit f5e5631df596("devres: Move devm_*_action*() APIs to
devres.h"), But devm_alloc_percpu() and devm_device_add_group didn't be
moved.

so move it.The changes improve header organization by keeping all
resource-managed device APIs in the dedicated devres.h header,
reducing cross-header dependencies and making the interfaces
easier to locate.

Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
 include/linux/device.h        | 21 ---------------------
 include/linux/device/devres.h | 24 ++++++++++++++++++++++++
 2 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index 4940db137fff..6dd6ae8f405b 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -281,25 +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);
-void devm_free_percpu(struct device *dev, void __percpu *pdata);
-
 struct device_dma_parameters {
 	/*
 	 * a low level driver may set these to teach IOMMU code about
@@ -1127,8 +1108,6 @@ static inline void device_remove_group(struct device *dev,
 	device_remove_groups(dev, groups);
 }
 
-int __must_check devm_device_add_group(struct device *dev,
-				       const struct attribute_group *grp);
 
 /*
  * get_device - atomically increment the reference count for the device.
diff --git a/include/linux/device/devres.h b/include/linux/device/devres.h
index ae696d10faff..624ba81d4d8b 100644
--- a/include/linux/device/devres.h
+++ b/include/linux/device/devres.h
@@ -7,8 +7,10 @@
 #include <linux/numa.h>
 #include <linux/overflow.h>
 #include <linux/stdarg.h>
+#include <linux/sysfs.h>
 #include <linux/types.h>
 #include <asm/bug.h>
+#include <asm/percpu.h>
 
 struct device;
 struct device_node;
@@ -167,4 +169,26 @@ static inline int __devm_add_action_or_reset(struct device *dev, void (*action)(
 
 bool devm_is_action_added(struct device *dev, void (*action)(void *), void *data);
 
+/**
+ * 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);
+void devm_free_percpu(struct device *dev, void __percpu *pdata);
+
+int __must_check devm_device_add_group(struct device *dev,
+				       const struct attribute_group *grp);
+
 #endif /* _DEVICE_DEVRES_H_ */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-05-28  9:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-22  9:01 [PATCH] devres: Move remaining devm_alloc_percpu and devm_device_add_group to devres.h Pei Xiao
2025-05-22 12:54 ` Andy Shevchenko
2025-05-23  3:08   ` Pei Xiao
2025-05-23 16:18     ` Andy Shevchenko
2025-05-27  9:41   ` Pei Xiao
2025-05-27 11:09     ` Andy Shevchenko
2025-05-28  3:07       ` Pei Xiao
2025-05-28  9:31         ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.