alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] device property: Replace custom implementation of COUNT_ARGS()
@ 2023-09-20 15:38 Andy Shevchenko
  2023-09-20 15:45 ` Takashi Iwai
  2023-09-20 16:50 ` Nick Desaulniers
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2023-09-20 15:38 UTC (permalink / raw)
  To: Andy Shevchenko, Greg Kroah-Hartman, linux-acpi, linux-kernel
  Cc: Rafael J. Wysocki, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Richard Fitzgerald, tiwai, llvm, alsa-devel, Nick Desaulniers

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

Fixes: e64b674bc9d7 ("software node: implement reference properties")
Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Closes: https://lore.kernel.org/r/ZQoILN6QCjzosCOs@google.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/property.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/property.h b/include/linux/property.h
index 1684fca930f7..55c2692ffa8c 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -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


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

* Re: [PATCH v1 1/1] device property: Replace custom implementation of COUNT_ARGS()
  2023-09-20 15:38 [PATCH v1 1/1] device property: Replace custom implementation of COUNT_ARGS() Andy Shevchenko
@ 2023-09-20 15:45 ` Takashi Iwai
  2023-09-20 16:50 ` Nick Desaulniers
  1 sibling, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2023-09-20 15:45 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, linux-acpi, linux-kernel, Rafael J. Wysocki,
	Daniel Scally, Heikki Krogerus, Sakari Ailus, Richard Fitzgerald,
	tiwai, llvm, alsa-devel, Nick Desaulniers

On Wed, 20 Sep 2023 17:38:19 +0200,
Andy Shevchenko wrote:
> 
> Replace custom and non-portable implementation of COUNT_ARGS().
> 
> Fixes: e64b674bc9d7 ("software node: implement reference properties")
> Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> Closes: https://lore.kernel.org/r/ZQoILN6QCjzosCOs@google.com
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  include/linux/property.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/property.h b/include/linux/property.h
> index 1684fca930f7..55c2692ffa8c 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -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__ },				\
>  }
>  

Reviewed-by: Takashi Iwai <tiwai@suse.de>

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


thanks,

Takashi

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

* Re: [PATCH v1 1/1] device property: Replace custom implementation of COUNT_ARGS()
  2023-09-20 15:38 [PATCH v1 1/1] device property: Replace custom implementation of COUNT_ARGS() Andy Shevchenko
  2023-09-20 15:45 ` Takashi Iwai
@ 2023-09-20 16:50 ` Nick Desaulniers
  2023-09-29 16:07   ` Nick Desaulniers
  2023-09-29 16:10   ` Nick Desaulniers
  1 sibling, 2 replies; 6+ messages in thread
From: Nick Desaulniers @ 2023-09-20 16:50 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, linux-acpi, linux-kernel, Rafael J. Wysocki,
	Daniel Scally, Heikki Krogerus, Sakari Ailus, Richard Fitzgerald,
	tiwai, llvm, alsa-devel

On Wed, Sep 20, 2023 at 8:38 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Replace custom and non-portable implementation of COUNT_ARGS().
>
> Fixes: e64b674bc9d7 ("software node: implement reference properties")
> Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> Closes: https://lore.kernel.org/r/ZQoILN6QCjzosCOs@google.com

Thanks for the patch!
Closes: https://github.com/ClangBuiltLinux/linux/issues/1935
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

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

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  include/linux/property.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/property.h b/include/linux/property.h
> index 1684fca930f7..55c2692ffa8c 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -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
>


-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH v1 1/1] device property: Replace custom implementation of COUNT_ARGS()
  2023-09-20 16:50 ` Nick Desaulniers
@ 2023-09-29 16:07   ` Nick Desaulniers
  2023-09-29 16:10   ` Nick Desaulniers
  1 sibling, 0 replies; 6+ messages in thread
From: Nick Desaulniers @ 2023-09-29 16:07 UTC (permalink / raw)
  To: tiwai, Rafael J. Wysocki
  Cc: Greg Kroah-Hartman, linux-acpi, linux-kernel, Daniel Scally,
	Heikki Krogerus, Sakari Ailus, Richard Fitzgerald, llvm,
	alsa-devel, Andy Shevchenko

On Wed, Sep 20, 2023 at 9:50 AM Nick Desaulniers <ndesaulniers@google.com>
wrote:

> On Wed, Sep 20, 2023 at 8:38 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > Replace custom and non-portable implementation of COUNT_ARGS().
> >
> > Fixes: e64b674bc9d7 ("software node: implement reference properties")
> > Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> > Closes: https://lore.kernel.org/r/ZQoILN6QCjzosCOs@google.com
>
> Thanks for the patch!
> Closes: https://github.com/ClangBuiltLinux/linux/issues/1935
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>

Can someone pick this up for linux-next?

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



>
> Of course Linux would have a macro for this!  I should have known.
> Trying to wrap my head around it. Awesome
>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  include/linux/property.h | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/linux/property.h b/include/linux/property.h
> > index 1684fca930f7..55c2692ffa8c 100644
> > --- a/include/linux/property.h
> > +++ b/include/linux/property.h
> > @@ -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
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers
>


-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH v1 1/1] device property: Replace custom implementation of COUNT_ARGS()
  2023-09-20 16:50 ` Nick Desaulniers
  2023-09-29 16:07   ` Nick Desaulniers
@ 2023-09-29 16:10   ` Nick Desaulniers
  2023-09-30  9:38     ` Greg Kroah-Hartman
  1 sibling, 1 reply; 6+ messages in thread
From: Nick Desaulniers @ 2023-09-29 16:10 UTC (permalink / raw)
  To: Rafael J. Wysocki, tiwai
  Cc: Greg Kroah-Hartman, linux-acpi, linux-kernel, Daniel Scally,
	Heikki Krogerus, Sakari Ailus, Richard Fitzgerald, llvm,
	alsa-devel, Andy Shevchenko

On Wed, Sep 20, 2023 at 9:50 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Wed, Sep 20, 2023 at 8:38 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > Replace custom and non-portable implementation of COUNT_ARGS().
> >
> > Fixes: e64b674bc9d7 ("software node: implement reference properties")
> > Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> > Closes: https://lore.kernel.org/r/ZQoILN6QCjzosCOs@google.com
>
> Thanks for the patch!
> Closes: https://github.com/ClangBuiltLinux/linux/issues/1935
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
> 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.

>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  include/linux/property.h | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/linux/property.h b/include/linux/property.h
> > index 1684fca930f7..55c2692ffa8c 100644
> > --- a/include/linux/property.h
> > +++ b/include/linux/property.h
> > @@ -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
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers



-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH v1 1/1] device property: Replace custom implementation of COUNT_ARGS()
  2023-09-29 16:10   ` Nick Desaulniers
@ 2023-09-30  9:38     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-09-30  9:38 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Rafael J. Wysocki, tiwai, linux-acpi, linux-kernel, Daniel Scally,
	Heikki Krogerus, Sakari Ailus, Richard Fitzgerald, llvm,
	alsa-devel, Andy Shevchenko

On Fri, Sep 29, 2023 at 09:10:11AM -0700, Nick Desaulniers wrote:
> On Wed, Sep 20, 2023 at 9:50 AM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
> >
> > On Wed, Sep 20, 2023 at 8:38 AM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > Replace custom and non-portable implementation of COUNT_ARGS().
> > >
> > > Fixes: e64b674bc9d7 ("software node: implement reference properties")
> > > Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> > > Closes: https://lore.kernel.org/r/ZQoILN6QCjzosCOs@google.com
> >
> > Thanks for the patch!
> > Closes: https://github.com/ClangBuiltLinux/linux/issues/1935
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> >
> > 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

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

end of thread, other threads:[~2023-09-30  9:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-20 15:38 [PATCH v1 1/1] device property: Replace custom implementation of COUNT_ARGS() Andy Shevchenko
2023-09-20 15:45 ` Takashi Iwai
2023-09-20 16:50 ` Nick Desaulniers
2023-09-29 16:07   ` Nick Desaulniers
2023-09-29 16:10   ` Nick Desaulniers
2023-09-30  9:38     ` Greg Kroah-Hartman

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).