[PATCH] fixup! base: add class device support

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Jul 1 00:28:50 PDT 2024


driver: wrap class macro arguments in parenthesis

Without the parenthesis, using & in the macro argument will lead to
issues.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 include/device.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/device.h b/include/device.h
index d8d1f7c329c1..8550544ca807 100644
--- a/include/device.h
+++ b/include/device.h
@@ -121,8 +121,8 @@ int class_add_device(struct class *class, struct device *dev);
 void class_remove_device(struct class *class, struct device *dev);
 
 extern struct list_head class_list;
-#define class_for_each_device(class, dev) list_for_each_entry(dev, &class->devices, class_list)
-#define class_for_each(class) list_for_each_entry(class, &class_list, list)
+#define class_for_each_device(class, dev) list_for_each_entry((dev), &(class)->devices, class_list)
+#define class_for_each(class) list_for_each_entry((class), &class_list, list)
 
 struct device_alias {
 	struct device *dev;
-- 
2.39.2




More information about the barebox mailing list