diff mbox series

[next] ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

Message ID YzIcZ11k8RiQtS2T@work (mailing list archive)
State Mainlined
Commit b264ef796959cb65cdbc811da5ab950e33df4162
Headers show
Series [next] ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper | expand

Commit Message

Gustavo A. R. Silva Sept. 26, 2022, 9:40 p.m. UTC
Zero-length arrays are deprecated and we are moving towards adopting
C99 flexible-array members, instead. So, replace zero-length arrays
declarations in anonymous union with the new DECLARE_FLEX_ARRAY()
helper macro.

This helper allows for flexible-array members in unions.

Link: https://github.com/KSPP/linux/issues/193
Link: https://github.com/KSPP/linux/issues/211
Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 include/sound/sof/control.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Kees Cook Sept. 26, 2022, 10 p.m. UTC | #1
On Mon, Sep 26, 2022 at 04:40:55PM -0500, Gustavo A. R. Silva wrote:
> Zero-length arrays are deprecated and we are moving towards adopting
> C99 flexible-array members, instead. So, replace zero-length arrays
> declarations in anonymous union with the new DECLARE_FLEX_ARRAY()
> helper macro.
> 
> This helper allows for flexible-array members in unions.
> 
> Link: https://github.com/KSPP/linux/issues/193
> Link: https://github.com/KSPP/linux/issues/211
> Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Reviewed-by: Kees Cook <keescook@chromium.org>
Mark Brown Sept. 26, 2022, 10:12 p.m. UTC | #2
On Mon, Sep 26, 2022 at 04:40:55PM -0500, Gustavo A. R. Silva wrote:
> Zero-length arrays are deprecated and we are moving towards adopting
> C99 flexible-array members, instead. So, replace zero-length arrays
> declarations in anonymous union with the new DECLARE_FLEX_ARRAY()
> helper macro.
> 
> This helper allows for flexible-array members in unions.

As documented in submitting-patches.rst please send patches to the 
maintainers for the code you would like to change.  The normal kernel
workflow is that people apply patches from their inboxes, if they aren't
copied they are likely to not see the patch at all and it is much more
difficult to apply patches.
Gustavo A. R. Silva Sept. 26, 2022, 10:27 p.m. UTC | #3
On 9/26/22 17:12, Mark Brown wrote:
> On Mon, Sep 26, 2022 at 04:40:55PM -0500, Gustavo A. R. Silva wrote:
>> Zero-length arrays are deprecated and we are moving towards adopting
>> C99 flexible-array members, instead. So, replace zero-length arrays
>> declarations in anonymous union with the new DECLARE_FLEX_ARRAY()
>> helper macro.
>>
>> This helper allows for flexible-array members in unions.
> 
> As documented in submitting-patches.rst please send patches to the
> maintainers for the code you would like to change.  The normal kernel
> workflow is that people apply patches from their inboxes, if they aren't
> copied they are likely to not see the patch at all and it is much more
> difficult to apply patches.

That's exactly what I intended to do:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/sound/sof/control.h

Jaroslav Kysela <perex@perex.cz> (maintainer:SOUND)

Takashi Iwai <tiwai@suse.com> (maintainer:SOUND)

alsa-devel@alsa-project.org (moderated list:SOUND)

linux-kernel@vger.kernel.org (open list)

Did you see anything wrong with this or something...?

Thanks
--
Gustavo
Mark Brown Sept. 26, 2022, 10:39 p.m. UTC | #4
On Mon, Sep 26, 2022 at 05:27:41PM -0500, Gustavo A. R. Silva wrote:
> On 9/26/22 17:12, Mark Brown wrote:
> > On Mon, Sep 26, 2022 at 04:40:55PM -0500, Gustavo A. R. Silva wrote:

> > As documented in submitting-patches.rst please send patches to the
> > maintainers for the code you would like to change.  The normal kernel
> > workflow is that people apply patches from their inboxes, if they aren't
> > copied they are likely to not see the patch at all and it is much more
> > difficult to apply patches.

> That's exactly what I intended to do:

> $ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/sound/sof/control.h
> 
> Jaroslav Kysela <perex@perex.cz> (maintainer:SOUND)
> 
> Takashi Iwai <tiwai@suse.com> (maintainer:SOUND)
> 
> alsa-devel@alsa-project.org (moderated list:SOUND)
> 
> linux-kernel@vger.kernel.org (open list)
> 
> Did you see anything wrong with this or something...?

Yes, you should've also included me and the SOF maintainers.  It looks
like the MAINTAINERS patterns aren't entirely up to date there
unfortunately.  Though that said given that you'd picked up on the
subject line I'd have expected the signoffs on the commits to also be
pointing at the right tree as well.
Kees Cook Sept. 27, 2022, 3:16 a.m. UTC | #5
On Mon, Sep 26, 2022 at 11:39:50PM +0100, Mark Brown wrote:
> On Mon, Sep 26, 2022 at 05:27:41PM -0500, Gustavo A. R. Silva wrote:
> > On 9/26/22 17:12, Mark Brown wrote:
> > > On Mon, Sep 26, 2022 at 04:40:55PM -0500, Gustavo A. R. Silva wrote:
> 
> > > As documented in submitting-patches.rst please send patches to the
> > > maintainers for the code you would like to change.  The normal kernel
> > > workflow is that people apply patches from their inboxes, if they aren't
> > > copied they are likely to not see the patch at all and it is much more
> > > difficult to apply patches.
> 
> > That's exactly what I intended to do:
> > 
> > $ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/sound/sof/control.h
> > Jaroslav Kysela <perex@perex.cz> (maintainer:SOUND)
> > Takashi Iwai <tiwai@suse.com> (maintainer:SOUND)
> > alsa-devel@alsa-project.org (moderated list:SOUND)
> > linux-kernel@vger.kernel.org (open list)
> > 
> > Did you see anything wrong with this or something...?
> 
> Yes, you should've also included me and the SOF maintainers.  It looks
> like the MAINTAINERS patterns aren't entirely up to date there
> unfortunately.  Though that said given that you'd picked up on the
> subject line I'd have expected the signoffs on the commits to also be
> pointing at the right tree as well.

Subject line heuristics look at X-many commits, but it looks like
get_maintainers stops looking at git history by default after 1 year,
which seems kind of odd. I had to work at it to get it to emit your
name. :)

scripts/get_maintainer.pl --git --git-since=3-years-ago

Seems like it's worth getting the MAINTAINERS regex updated? Is this
right?

diff --git a/MAINTAINERS b/MAINTAINERS
index a34ec41fbf7a..2560dded0e3e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -19261,6 +19261,7 @@ F:	Documentation/devicetree/bindings/sound/
 F:	Documentation/sound/soc/
 F:	include/dt-bindings/sound/
 F:	include/sound/soc*
+F:	include/sound/sof/
 F:	sound/soc/
 
 SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS
@@ -19275,6 +19276,7 @@ L:	sound-open-firmware@alsa-project.org (moderated for non-subscribers)
 S:	Supported
 W:	https://github.com/thesofproject/linux/
 F:	sound/soc/sof/
+F:	include/sound/sof/
 
 SOUNDWIRE SUBSYSTEM
 M:	Vinod Koul <vkoul@kernel.org>
Mark Brown Sept. 27, 2022, 10:27 a.m. UTC | #6
On Mon, Sep 26, 2022 at 08:16:16PM -0700, Kees Cook wrote:

> Seems like it's worth getting the MAINTAINERS regex updated? Is this
> right?

Yes, looks about right.
Mark Brown Sept. 27, 2022, 12:59 p.m. UTC | #7
On Mon, 26 Sep 2022 16:40:55 -0500, Gustavo A. R. Silva wrote:
> Zero-length arrays are deprecated and we are moving towards adopting
> C99 flexible-array members, instead. So, replace zero-length arrays
> declarations in anonymous union with the new DECLARE_FLEX_ARRAY()
> helper macro.
> 
> This helper allows for flexible-array members in unions.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper
      commit: b264ef796959cb65cdbc811da5ab950e33df4162

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/include/sound/sof/control.h b/include/sound/sof/control.h
index 7379a33d7247..983d374fe511 100644
--- a/include/sound/sof/control.h
+++ b/include/sound/sof/control.h
@@ -117,11 +117,11 @@  struct sof_ipc_ctrl_data {
 	/* control data - add new types if needed */
 	union {
 		/* channel values can be used by volume type controls */
-		struct sof_ipc_ctrl_value_chan chanv[0];
+		DECLARE_FLEX_ARRAY(struct sof_ipc_ctrl_value_chan, chanv);
 		/* component values used by routing controls like mux, mixer */
-		struct sof_ipc_ctrl_value_comp compv[0];
+		DECLARE_FLEX_ARRAY(struct sof_ipc_ctrl_value_comp, compv);
 		/* data can be used by binary controls */
-		struct sof_abi_hdr data[0];
+		DECLARE_FLEX_ARRAY(struct sof_abi_hdr, data);
 	};
 } __packed;