* [PATCH] ASoC: tegra: ADX: use of_device_get_match_data
@ 2026-05-22 1:58 Rosen Penev
2026-05-28 20:35 ` Thierry Reding
0 siblings, 1 reply; 4+ messages in thread
From: Rosen Penev @ 2026-05-22 1:58 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
Remove open coding of the function to simplify the code.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
sound/soc/tegra/tegra210_adx.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c
index 12371f895234..a2c28369fbc8 100644
--- a/sound/soc/tegra/tegra210_adx.c
+++ b/sound/soc/tegra/tegra210_adx.c
@@ -677,17 +677,16 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct tegra210_adx *adx;
- const struct of_device_id *match;
- struct tegra210_adx_soc_data *soc_data;
+ const struct tegra210_adx_soc_data *soc_data;
void __iomem *regs;
int err, i;
+ soc_data = of_device_get_match_data(dev);
+
adx = devm_kzalloc(dev, sizeof(*adx), GFP_KERNEL);
if (!adx)
return -ENOMEM;
- match = of_match_device(tegra210_adx_of_match, dev);
- soc_data = (struct tegra210_adx_soc_data *)match->data;
adx->soc_data = soc_data;
dev_set_drvdata(dev, adx);
--
2.54.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] ASoC: tegra: ADX: use of_device_get_match_data
2026-05-22 1:58 [PATCH] ASoC: tegra: ADX: use of_device_get_match_data Rosen Penev
@ 2026-05-28 20:35 ` Thierry Reding
2026-05-28 20:41 ` Rosen Penev
0 siblings, 1 reply; 4+ messages in thread
From: Thierry Reding @ 2026-05-28 20:35 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: 1361 bytes --]
On Thu, May 21, 2026 at 06:58:56PM -0700, Rosen Penev wrote:
> Remove open coding of the function to simplify the code.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> sound/soc/tegra/tegra210_adx.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c
> index 12371f895234..a2c28369fbc8 100644
> --- a/sound/soc/tegra/tegra210_adx.c
> +++ b/sound/soc/tegra/tegra210_adx.c
> @@ -677,17 +677,16 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct tegra210_adx *adx;
> - const struct of_device_id *match;
> - struct tegra210_adx_soc_data *soc_data;
> + const struct tegra210_adx_soc_data *soc_data;
> void __iomem *regs;
> int err, i;
>
> + soc_data = of_device_get_match_data(dev);
> +
> adx = devm_kzalloc(dev, sizeof(*adx), GFP_KERNEL);
> if (!adx)
> return -ENOMEM;
>
> - match = of_match_device(tegra210_adx_of_match, dev);
> - soc_data = (struct tegra210_adx_soc_data *)match->data;
> adx->soc_data = soc_data;
Why not just:
adx->soc_data = of_device_get_match_data(dev);
? That saves you a few temporary variables and since you're not moving
around the assignment needlessly, you get a much simpler diff, too.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ASoC: tegra: ADX: use of_device_get_match_data
2026-05-28 20:35 ` Thierry Reding
@ 2026-05-28 20:41 ` Rosen Penev
2026-05-28 21:00 ` Thierry Reding
0 siblings, 1 reply; 4+ messages in thread
From: Rosen Penev @ 2026-05-28 20:41 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, May 28, 2026 at 1:35 PM Thierry Reding
<thierry.reding@kernel.org> wrote:
>
> On Thu, May 21, 2026 at 06:58:56PM -0700, Rosen Penev wrote:
> > Remove open coding of the function to simplify the code.
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > ---
> > sound/soc/tegra/tegra210_adx.c | 7 +++----
> > 1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c
> > index 12371f895234..a2c28369fbc8 100644
> > --- a/sound/soc/tegra/tegra210_adx.c
> > +++ b/sound/soc/tegra/tegra210_adx.c
> > @@ -677,17 +677,16 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
> > {
> > struct device *dev = &pdev->dev;
> > struct tegra210_adx *adx;
> > - const struct of_device_id *match;
> > - struct tegra210_adx_soc_data *soc_data;
> > + const struct tegra210_adx_soc_data *soc_data;
> > void __iomem *regs;
> > int err, i;
> >
> > + soc_data = of_device_get_match_data(dev);
> > +
> > adx = devm_kzalloc(dev, sizeof(*adx), GFP_KERNEL);
> > if (!adx)
> > return -ENOMEM;
> >
> > - match = of_match_device(tegra210_adx_of_match, dev);
> > - soc_data = (struct tegra210_adx_soc_data *)match->data;
> > adx->soc_data = soc_data;
>
> Why not just:
>
> adx->soc_data = of_device_get_match_data(dev);
>
> ? That saves you a few temporary variables and since you're not moving
> around the assignment needlessly, you get a much simpler diff, too.
Because soc_data is used later on in this function. I'd have to add
adx-> everywhere.
>
> Thierry
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ASoC: tegra: ADX: use of_device_get_match_data
2026-05-28 20:41 ` Rosen Penev
@ 2026-05-28 21:00 ` Thierry Reding
0 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2026-05-28 21:00 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: 2028 bytes --]
On Thu, May 28, 2026 at 01:41:27PM -0700, Rosen Penev wrote:
> On Thu, May 28, 2026 at 1:35 PM Thierry Reding
> <thierry.reding@kernel.org> wrote:
> >
> > On Thu, May 21, 2026 at 06:58:56PM -0700, Rosen Penev wrote:
> > > Remove open coding of the function to simplify the code.
> > >
> > > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > > ---
> > > sound/soc/tegra/tegra210_adx.c | 7 +++----
> > > 1 file changed, 3 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c
> > > index 12371f895234..a2c28369fbc8 100644
> > > --- a/sound/soc/tegra/tegra210_adx.c
> > > +++ b/sound/soc/tegra/tegra210_adx.c
> > > @@ -677,17 +677,16 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
> > > {
> > > struct device *dev = &pdev->dev;
> > > struct tegra210_adx *adx;
> > > - const struct of_device_id *match;
> > > - struct tegra210_adx_soc_data *soc_data;
> > > + const struct tegra210_adx_soc_data *soc_data;
> > > void __iomem *regs;
> > > int err, i;
> > >
> > > + soc_data = of_device_get_match_data(dev);
> > > +
> > > adx = devm_kzalloc(dev, sizeof(*adx), GFP_KERNEL);
> > > if (!adx)
> > > return -ENOMEM;
> > >
> > > - match = of_match_device(tegra210_adx_of_match, dev);
> > > - soc_data = (struct tegra210_adx_soc_data *)match->data;
> > > adx->soc_data = soc_data;
> >
> > Why not just:
> >
> > adx->soc_data = of_device_get_match_data(dev);
> >
> > ? That saves you a few temporary variables and since you're not moving
> > around the assignment needlessly, you get a much simpler diff, too.
> Because soc_data is used later on in this function. I'd have to add
> adx-> everywhere.
Hm... I guess that's what we should've done in the first place. Maybe
just leave the assignment in the same place to keep the diff tidy, then.
Also makes it easier to spot what you're actually doing.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-28 21:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-22 1:58 [PATCH] ASoC: tegra: ADX: use of_device_get_match_data Rosen Penev
2026-05-28 20:35 ` Thierry Reding
2026-05-28 20:41 ` Rosen Penev
2026-05-28 21:00 ` Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox