* [PATCH] ASoC: tegra: ADX: convert map to flexible array
@ 2026-08-14 20:50 Rosen Penev
2026-08-18 11:04 ` Thierry Reding
2026-08-31 21:55 ` Mark Brown
0 siblings, 2 replies; 6+ messages in thread
From: Rosen Penev @ 2026-08-14 20:50 UTC (permalink / raw)
To: linux-sound
Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Thierry Reding, Jonathan Hunter,
open list:TEGRA ARCHITECTURE SUPPORT, open list
Replace the pointer-based map allocation with a flexible array
member and use struct_size() for allocation. This simplifies
the code and avoid an extra allocation.
Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
sound/soc/tegra/tegra210_adx.c | 12 ++++--------
sound/soc/tegra/tegra210_adx.h | 2 +-
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c
index 9175598b52a7..d607ba4233b6 100644
--- a/sound/soc/tegra/tegra210_adx.c
+++ b/sound/soc/tegra/tegra210_adx.c
@@ -677,11 +677,13 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
void __iomem *regs;
int err, i;
- adx = devm_kzalloc(dev, sizeof(*adx), GFP_KERNEL);
+ soc_data = of_device_get_match_data(dev);
+ adx = devm_kzalloc(dev,
+ struct_size(adx, map, soc_data->ram_depth * TEGRA_ADX_SLOTS_PER_WORD),
+ GFP_KERNEL);
if (!adx)
return -ENOMEM;
- soc_data = of_device_get_match_data(dev);
adx->soc_data = soc_data;
dev_set_drvdata(dev, adx);
@@ -698,12 +700,6 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
regcache_cache_only(adx->regmap, true);
- adx->map = devm_kcalloc(dev,
- soc_data->ram_depth * TEGRA_ADX_SLOTS_PER_WORD,
- sizeof(*adx->map), GFP_KERNEL);
- if (!adx->map)
- return -ENOMEM;
-
adx->byte_mask = devm_kcalloc(dev, soc_data->byte_mask_size,
sizeof(*adx->byte_mask), GFP_KERNEL);
if (!adx->byte_mask)
diff --git a/sound/soc/tegra/tegra210_adx.h b/sound/soc/tegra/tegra210_adx.h
index a6298c3dcca5..e5f1b44b2e76 100644
--- a/sound/soc/tegra/tegra210_adx.h
+++ b/sound/soc/tegra/tegra210_adx.h
@@ -92,8 +92,8 @@ struct tegra210_adx_soc_data {
struct tegra210_adx {
struct regmap *regmap;
unsigned int *byte_mask;
- u16 *map;
const struct tegra210_adx_soc_data *soc_data;
+ u16 map[];
};
#endif
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: tegra: ADX: convert map to flexible array
2026-08-14 20:50 [PATCH] ASoC: tegra: ADX: convert map to flexible array Rosen Penev
@ 2026-08-18 11:04 ` Thierry Reding
2026-08-18 20:33 ` Rosen Penev
2026-08-31 21:55 ` Mark Brown
1 sibling, 1 reply; 6+ messages in thread
From: Thierry Reding @ 2026-08-18 11:04 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-sound, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Jonathan Hunter,
open list:TEGRA ARCHITECTURE SUPPORT, open list
[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]
On Fri, Aug 14, 2026 at 01:50:18PM -0700, Rosen Penev wrote:
> Replace the pointer-based map allocation with a flexible array
> member and use struct_size() for allocation. This simplifies
> the code and avoid an extra allocation.
>
> Assisted-by: opencode:big-pickle
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> sound/soc/tegra/tegra210_adx.c | 12 ++++--------
> sound/soc/tegra/tegra210_adx.h | 2 +-
> 2 files changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c
> index 9175598b52a7..d607ba4233b6 100644
> --- a/sound/soc/tegra/tegra210_adx.c
> +++ b/sound/soc/tegra/tegra210_adx.c
> @@ -677,11 +677,13 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
> void __iomem *regs;
> int err, i;
>
> - adx = devm_kzalloc(dev, sizeof(*adx), GFP_KERNEL);
> + soc_data = of_device_get_match_data(dev);
> + adx = devm_kzalloc(dev,
> + struct_size(adx, map, soc_data->ram_depth * TEGRA_ADX_SLOTS_PER_WORD),
> + GFP_KERNEL);
This is slightly hideous. Maybe add a temporary "count" variable for
readability?
Either way, though, this looks correct:
Reviewed-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: tegra: ADX: convert map to flexible array
2026-08-18 11:04 ` Thierry Reding
@ 2026-08-18 20:33 ` Rosen Penev
2026-08-20 10:20 ` Thierry Reding
0 siblings, 1 reply; 6+ messages in thread
From: Rosen Penev @ 2026-08-18 20:33 UTC (permalink / raw)
To: Thierry Reding, Rosen Penev
Cc: linux-sound, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Jonathan Hunter,
open list:TEGRA ARCHITECTURE SUPPORT, open list
On Tue Aug 18, 2026 at 4:04 AM PDT, Thierry Reding wrote:
> On Fri, Aug 14, 2026 at 01:50:18PM -0700, Rosen Penev wrote:
>> Replace the pointer-based map allocation with a flexible array
>> member and use struct_size() for allocation. This simplifies
>> the code and avoid an extra allocation.
>>
>> Assisted-by: opencode:big-pickle
>> Signed-off-by: Rosen Penev <rosenp@gmail.com>
>> ---
>> sound/soc/tegra/tegra210_adx.c | 12 ++++--------
>> sound/soc/tegra/tegra210_adx.h | 2 +-
>> 2 files changed, 5 insertions(+), 9 deletions(-)
>>
>> diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c
>> index 9175598b52a7..d607ba4233b6 100644
>> --- a/sound/soc/tegra/tegra210_adx.c
>> +++ b/sound/soc/tegra/tegra210_adx.c
>> @@ -677,11 +677,13 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
>> void __iomem *regs;
>> int err, i;
>>
>> - adx = devm_kzalloc(dev, sizeof(*adx), GFP_KERNEL);
>> + soc_data = of_device_get_match_data(dev);
>> + adx = devm_kzalloc(dev,
>> + struct_size(adx, map, soc_data->ram_depth * TEGRA_ADX_SLOTS_PER_WORD),
>> + GFP_KERNEL);
>
> This is slightly hideous. Maybe add a temporary "count" variable for
> readability?
The reason for this is to allow a treewide conversion of this when
devm_kzalloc_flex() gets introduced.
>
> Either way, though, this looks correct:
>
> Reviewed-by: Thierry Reding <treding@nvidia.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: tegra: ADX: convert map to flexible array
2026-08-18 20:33 ` Rosen Penev
@ 2026-08-20 10:20 ` Thierry Reding
2026-08-20 18:21 ` Rosen Penev
0 siblings, 1 reply; 6+ messages in thread
From: Thierry Reding @ 2026-08-20 10:20 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-sound, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Jonathan Hunter,
open list:TEGRA ARCHITECTURE SUPPORT, open list
[-- Attachment #1: Type: text/plain, Size: 1621 bytes --]
On Tue, Aug 18, 2026 at 01:33:45PM -0700, Rosen Penev wrote:
> On Tue Aug 18, 2026 at 4:04 AM PDT, Thierry Reding wrote:
> > On Fri, Aug 14, 2026 at 01:50:18PM -0700, Rosen Penev wrote:
> >> Replace the pointer-based map allocation with a flexible array
> >> member and use struct_size() for allocation. This simplifies
> >> the code and avoid an extra allocation.
> >>
> >> Assisted-by: opencode:big-pickle
> >> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> >> ---
> >> sound/soc/tegra/tegra210_adx.c | 12 ++++--------
> >> sound/soc/tegra/tegra210_adx.h | 2 +-
> >> 2 files changed, 5 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c
> >> index 9175598b52a7..d607ba4233b6 100644
> >> --- a/sound/soc/tegra/tegra210_adx.c
> >> +++ b/sound/soc/tegra/tegra210_adx.c
> >> @@ -677,11 +677,13 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
> >> void __iomem *regs;
> >> int err, i;
> >>
> >> - adx = devm_kzalloc(dev, sizeof(*adx), GFP_KERNEL);
> >> + soc_data = of_device_get_match_data(dev);
> >> + adx = devm_kzalloc(dev,
> >> + struct_size(adx, map, soc_data->ram_depth * TEGRA_ADX_SLOTS_PER_WORD),
> >> + GFP_KERNEL);
> >
> > This is slightly hideous. Maybe add a temporary "count" variable for
> > readability?
> The reason for this is to allow a treewide conversion of this when
> devm_kzalloc_flex() gets introduced.
Huh? Why not do this right away, then? It's a waste of everyone's time
to do these two-staged "cleanups". You're making maintainers do the work
twice for no benefit whatsoever.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: tegra: ADX: convert map to flexible array
2026-08-20 10:20 ` Thierry Reding
@ 2026-08-20 18:21 ` Rosen Penev
0 siblings, 0 replies; 6+ messages in thread
From: Rosen Penev @ 2026-08-20 18:21 UTC (permalink / raw)
To: Thierry Reding
Cc: linux-sound, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Jonathan Hunter,
open list:TEGRA ARCHITECTURE SUPPORT, open list
On Thu, Aug 20, 2026 at 3:20 AM Thierry Reding
<thierry.reding@kernel.org> wrote:
>
> On Tue, Aug 18, 2026 at 01:33:45PM -0700, Rosen Penev wrote:
> > On Tue Aug 18, 2026 at 4:04 AM PDT, Thierry Reding wrote:
> > > On Fri, Aug 14, 2026 at 01:50:18PM -0700, Rosen Penev wrote:
> > >> Replace the pointer-based map allocation with a flexible array
> > >> member and use struct_size() for allocation. This simplifies
> > >> the code and avoid an extra allocation.
> > >>
> > >> Assisted-by: opencode:big-pickle
> > >> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > >> ---
> > >> sound/soc/tegra/tegra210_adx.c | 12 ++++--------
> > >> sound/soc/tegra/tegra210_adx.h | 2 +-
> > >> 2 files changed, 5 insertions(+), 9 deletions(-)
> > >>
> > >> diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c
> > >> index 9175598b52a7..d607ba4233b6 100644
> > >> --- a/sound/soc/tegra/tegra210_adx.c
> > >> +++ b/sound/soc/tegra/tegra210_adx.c
> > >> @@ -677,11 +677,13 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
> > >> void __iomem *regs;
> > >> int err, i;
> > >>
> > >> - adx = devm_kzalloc(dev, sizeof(*adx), GFP_KERNEL);
> > >> + soc_data = of_device_get_match_data(dev);
> > >> + adx = devm_kzalloc(dev,
> > >> + struct_size(adx, map, soc_data->ram_depth * TEGRA_ADX_SLOTS_PER_WORD),
> > >> + GFP_KERNEL);
> > >
> > > This is slightly hideous. Maybe add a temporary "count" variable for
> > > readability?
> > The reason for this is to allow a treewide conversion of this when
> > devm_kzalloc_flex() gets introduced.
>
> Huh? Why not do this right away, then? It's a waste of everyone's time
> to do these two-staged "cleanups". You're making maintainers do the work
> twice for no benefit whatsoever.
I'm not handling that patchset. That's the linux hardening people.
>
> Thierry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: tegra: ADX: convert map to flexible array
2026-08-14 20:50 [PATCH] ASoC: tegra: ADX: convert map to flexible array Rosen Penev
2026-08-18 11:04 ` Thierry Reding
@ 2026-08-31 21:55 ` Mark Brown
1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2026-08-31 21:55 UTC (permalink / raw)
To: linux-sound, Rosen Penev
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Thierry Reding,
Jonathan Hunter, linux-tegra, linux-kernel
On Fri, 14 Aug 2026 13:50:18 -0700, Rosen Penev wrote:
> ASoC: tegra: ADX: convert map to flexible array
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4
Thanks!
[1/1] ASoC: tegra: ADX: convert map to flexible array
https://git.kernel.org/broonie/asoc/c/caae0e2d1718
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-01 18:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14 20:50 [PATCH] ASoC: tegra: ADX: convert map to flexible array Rosen Penev
2026-08-18 11:04 ` Thierry Reding
2026-08-18 20:33 ` Rosen Penev
2026-08-20 10:20 ` Thierry Reding
2026-08-20 18:21 ` Rosen Penev
2026-08-31 21:55 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.