Skip to contentSkip to conversation

device property: Replace custom implementation of COUNT_ARGS()

PATCH In review Andy Shevchenko 4 participants 6 messages Sep 20, 2023 – Sep 30, 2023

Subsystems (3)
lore
Share & tools
lore

Andy Shevchenko

author reviewer
#0 lore raw

PATCH 1/1 device property: Replace custom implementation of COUNT_ARGS()

Replace custom and non-portable implementation of COUNT_ARGS().

Fixes e64b674bc9d7 ("software node: implement reference properties")
---
 include/linux/property.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/property.h +2 -1
index 1684fca930f7..55c2692ffa8c 100644
@@ -10,6 +10,7 @@
 #ifndef _LINUX_PROPERTY_H_
 #define _LINUX_PROPERTY_H_
 
+#include <linux/args.h>
 #include <linux/bits.h>
 #include <linux/fwnode.h>
 #include <linux/stddef.h>
@@ -314,7 +315,7 @@ struct software_node_ref_args {
 #define SOFTWARE_NODE_REFERENCE(_ref_, ...)			\
 (const struct software_node_ref_args) {				\
 	.node = _ref_,						\
-	.nargs = ARRAY_SIZE(((u64[]){ 0, ##__VA_ARGS__ })) - 1,	\
+	.nargs = COUNT_ARGS(__VA_ARGS__),			\
 	.args = { __VA_ARGS__ },				\
 }
 
Signature · 1 line
2.40.0.1.gaa8946217a0b
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Andy Shevchenko

Replace custom and non-portable implementation of COUNT_ARGS().

Fixes e64b674bc9d7 ("software node: implement reference properties")
---
 include/linux/property.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/property.h +1 -0
index 1684fca930f7..55c2692ffa8c 100644
@@ -10,6 +10,7 @@
 #ifndef _LINUX_PROPERTY_H_
 #define _LINUX_PROPERTY_H_
 
+#include <linux/args.h>
 #include <linux/bits.h>
 #include <linux/fwnode.h>
 #include <linux/stddef.h>

include/linux/property.h struct software_node_ref_args { · line 321

Quoted 8 lines
include/linux/property.h +1 -1
@@ -314,7 +315,7 @@ struct software_node_ref_args {
 #define SOFTWARE_NODE_REFERENCE(_ref_, ...)			\
 (const struct software_node_ref_args) {				\
 	.node = _ref_,						\
-	.nargs = ARRAY_SIZE(((u64[]){ 0, ##__VA_ARGS__ })) - 1,	\
+	.nargs = COUNT_ARGS(__VA_ARGS__),			\
 	.args = { __VA_ARGS__ },				\
 }
 

NR_FWNODE_REFERENCE_ARGS is 8, so the COUNT_ARGS() macro should suffice.

thanks,

Takashi

Reviewed-by on v1 1/1
#2 lore raw
In reply to Andy Shevchenko
Quoted 6 lines · Andy Shevchenko

Replace custom and non-portable implementation of COUNT_ARGS().

Fixes e64b674bc9d7 ("software node: implement reference properties")

Thanks for the patch!

Of course Linux would have a macro for this! I should have known. Trying to wrap my head around it. Awesome

Quoted 29 lines
---
 include/linux/property.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/property.h +2 -2
index 1684fca930f7..55c2692ffa8c 100644
@@ -10,6 +10,7 @@
 #ifndef _LINUX_PROPERTY_H_
 #define _LINUX_PROPERTY_H_
 
+#include <linux/args.h>
 #include <linux/bits.h>
 #include <linux/fwnode.h>
 #include <linux/stddef.h>
@@ -314,7 +315,7 @@ struct software_node_ref_args {
 #define SOFTWARE_NODE_REFERENCE(_ref_, ...)                    \
 (const struct software_node_ref_args) {                                \
        .node = _ref_,                                          \
-       .nargs = ARRAY_SIZE(((u64[]){ 0, ##__VA_ARGS__ })) - 1, \
+       .nargs = COUNT_ARGS(__VA_ARGS__),                       \
        .args = { __VA_ARGS__ },                                \
 }
 
--

2.40.0.1.gaa8946217a0b

Signature · 2 lines
Thanks,
~Nick Desaulniers
#3 lore raw
Quoted 5 lines · Nick Desaulniers
Quoted 3 lines · Andy Shevchenko

Replace custom and non-portable implementation of COUNT_ARGS().

Quoted 8 lines
Quoted 3 lines
Fixes e64b674bc9d7 ("software node: implement reference properties")

Thanks for the patch!

Can someone pick this up for linux-next?

CI for linux-next has been red for days over this.

Quoted 39 lines

Of course Linux would have a macro for this! I should have known. Trying to wrap my head around it. Awesome

Quoted 27 lines
---
 include/linux/property.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/property.h +2 -2
index 1684fca930f7..55c2692ffa8c 100644
@@ -10,6 +10,7 @@
 #ifndef _LINUX_PROPERTY_H_
 #define _LINUX_PROPERTY_H_
 
+#include <linux/args.h>
 #include <linux/bits.h>
 #include <linux/fwnode.h>
 #include <linux/stddef.h>
@@ -314,7 +315,7 @@ struct software_node_ref_args {
 #define SOFTWARE_NODE_REFERENCE(_ref_, ...)                    \
 (const struct software_node_ref_args) {                                \
        .node = _ref_,                                          \
-       .nargs = ARRAY_SIZE(((u64[]){ 0, ##__VA_ARGS__ })) - 1, \
+       .nargs = COUNT_ARGS(__VA_ARGS__),                       \
        .args = { __VA_ARGS__ },                                \
 }
 
--
Quoted 2 lines

2.40.0.1.gaa8946217a0b

--
Thanks,
~Nick Desaulniers

Signature · 2 lines
Thanks,
~Nick Desaulniers
#4 lore raw
In reply to Nick Desaulniers
Quoted 10 lines · Nick Desaulniers
Quoted 6 lines · Andy Shevchenko

Replace custom and non-portable implementation of COUNT_ARGS().

Fixes e64b674bc9d7 ("software node: implement reference properties")
Quoted 6 lines

Thanks for the patch!

Of course Linux would have a macro for this! I should have known. Trying to wrap my head around it. Awesome

(resending as text/plain)

Can someone pick this up for linux-next?

CI for linux-next has been red for days over this.

Quoted 35 lines
Quoted 28 lines
---
 include/linux/property.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/property.h +2 -2
index 1684fca930f7..55c2692ffa8c 100644
@@ -10,6 +10,7 @@
 #ifndef _LINUX_PROPERTY_H_
 #define _LINUX_PROPERTY_H_
 
+#include <linux/args.h>
 #include <linux/bits.h>
 #include <linux/fwnode.h>
 #include <linux/stddef.h>
@@ -314,7 +315,7 @@ struct software_node_ref_args {
 #define SOFTWARE_NODE_REFERENCE(_ref_, ...)                    \
 (const struct software_node_ref_args) {                                \
        .node = _ref_,                                          \
-       .nargs = ARRAY_SIZE(((u64[]){ 0, ##__VA_ARGS__ })) - 1, \
+       .nargs = COUNT_ARGS(__VA_ARGS__),                       \
        .args = { __VA_ARGS__ },                                \
 }
 
--
Quoted 2 lines

2.40.0.1.gaa8946217a0b

--
Thanks,
~Nick Desaulniers

Signature · 2 lines
Thanks,
~Nick Desaulniers
#5 lore raw
Quoted 16 lines · Nick Desaulniers
Quoted 14 lines · Nick Desaulniers
Quoted 6 lines · Andy Shevchenko

Replace custom and non-portable implementation of COUNT_ARGS().

Fixes e64b674bc9d7 ("software node: implement reference properties")

Thanks for the patch!

Quoted 8 lines
Quoted 2 lines

Of course Linux would have a macro for this! I should have known. Trying to wrap my head around it. Awesome

(resending as text/plain)

Can someone pick this up for linux-next?

CI for linux-next has been red for days over this.

Will do, give me a chance to catch up...

greg k-h