Skip to contentSkip to conversation

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

PATCH In review Gustavo A. R. Silva 4 participants 8 messages Sep 26, 2022 – Sep 27, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

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.

---
 include/sound/sof/control.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/sound/sof/control.h +3 -3
index 7379a33d7247..983d374fe511 100644
@@ -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;
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Gustavo A. R. Silva

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.

Signature · 1 line
Kees Cook
maintainer
#2 lore raw
In reply to Gustavo A. R. Silva
Quoted 6 lines · Gustavo A. R. Silva

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.

#3 lore raw
Quoted 6 lines · Mark Brown
Quoted 5 lines · Gustavo A. R. Silva

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.

Quoted 7 lines
Quoted 1 line

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 <[email protected]> (maintainer:SOUND)

Takashi Iwai <[email protected]> (maintainer:SOUND)

[email protected] (moderated list:SOUND)

[email protected] (open list)

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

Thanks
--
Gustavo

maintainer
#4 lore raw
Quoted 15 lines · Gustavo A. R. Silva
Quoted 7 lines · Mark Brown

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 <[email protected]> (maintainer:SOUND)

Quoted 7 lines

Takashi Iwai <[email protected]> (maintainer:SOUND)

[email protected] (moderated list:SOUND)

[email protected] (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.

#5 lore raw
Quoted 18 lines · Mark Brown
Quoted 17 lines · Gustavo A. R. Silva
Quoted 7 lines · Mark Brown

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 <[email protected]> (maintainer:SOUND)
Takashi Iwai <[email protected]> (maintainer:SOUND)
[email protected] (moderated list:SOUND)
[email protected] (open list)
Quoted 7 lines
Quoted 1 line

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?

MAINTAINERS +2 -0
index a34ec41fbf7a..2560dded0e3e 100644
@@ -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:	[email protected] (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 <[email protected]>
Signature · 1 line
Kees Cook
maintainer
#6 lore raw
Quoted 2 lines · Kees Cook

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

Yes, looks about right.

maintainer
#7 lore raw
In reply to Gustavo A. R. Silva
Quoted 8 lines · Gustavo A. R. Silva

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