2021-02-13 10:23:11

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 0/4] drop unneeded snd_soc_dai_set_drvdata

snd_soc_dai_set_drvdata is not needed when the set data comes from
snd_soc_dai_get_drvdata or dev_get_drvdata.

---

sound/soc/fsl/fsl_micfil.c | 2 --
sound/soc/fsl/fsl_sai.c | 2 --
sound/soc/fsl/fsl_xcvr.c | 1 -
sound/soc/mxs/mxs-saif.c | 10 ----------
sound/soc/pxa/mmp-sspa.c | 1 -
sound/soc/sunxi/sun4i-i2s.c | 2 --
6 files changed, 18 deletions(-)


2021-02-13 10:24:20

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 4/4] ASoC: fsl: drop unneeded snd_soc_dai_set_drvdata

snd_soc_dai_set_drvdata is not needed when the set data comes from
snd_soc_dai_get_drvdata or dev_get_drvdata. The problem was fixed
usingthe following semantic patch: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,y,e;
@@
x = dev_get_drvdata(y->dev)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);

@@
expression x,y,e;
@@
x = snd_soc_dai_get_drvdata(y)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);
// </smpl>

Signed-off-by: Julia Lawall <[email protected]>

---
sound/soc/fsl/fsl_micfil.c | 2 --
sound/soc/fsl/fsl_sai.c | 2 --
sound/soc/fsl/fsl_xcvr.c | 1 -
3 files changed, 5 deletions(-)

diff --git a/sound/soc/fsl/fsl_micfil.c b/sound/soc/fsl/fsl_micfil.c
index 8aedf6590b28..fd21017fa2bd 100644
--- a/sound/soc/fsl/fsl_micfil.c
+++ b/sound/soc/fsl/fsl_micfil.c
@@ -423,8 +423,6 @@ static int fsl_micfil_dai_probe(struct snd_soc_dai *cpu_dai)
return ret;
}

- snd_soc_dai_set_drvdata(cpu_dai, micfil);
-
return 0;
}

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 5e65b456d3e2..8876d0ed37d9 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -727,8 +727,6 @@ static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai)
snd_soc_dai_init_dma_data(cpu_dai, &sai->dma_params_tx,
&sai->dma_params_rx);

- snd_soc_dai_set_drvdata(cpu_dai, sai);
-
return 0;
}

diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c
index dd228b421e2c..8a3bde718697 100644
--- a/sound/soc/fsl/fsl_xcvr.c
+++ b/sound/soc/fsl/fsl_xcvr.c
@@ -869,7 +869,6 @@ static int fsl_xcvr_dai_probe(struct snd_soc_dai *dai)
struct fsl_xcvr *xcvr = snd_soc_dai_get_drvdata(dai);

snd_soc_dai_init_dma_data(dai, &xcvr->dma_prms_tx, &xcvr->dma_prms_rx);
- snd_soc_dai_set_drvdata(dai, xcvr);

snd_soc_add_dai_controls(dai, &fsl_xcvr_mode_kctl, 1);
snd_soc_add_dai_controls(dai, &fsl_xcvr_arc_mode_kctl, 1);

2021-02-13 10:24:46

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 3/4] ASoC: sun4i-i2s: drop unneeded snd_soc_dai_set_drvdata

snd_soc_dai_set_drvdata is not needed when the set data comes from
snd_soc_dai_get_drvdata or dev_get_drvdata. The problem was fixed
usingthe following semantic patch: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,y,e;
@@
x = dev_get_drvdata(y->dev)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);

@@
expression x,y,e;
@@
x = snd_soc_dai_get_drvdata(y)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);
// </smpl>

Signed-off-by: Julia Lawall <[email protected]>

---
sound/soc/sunxi/sun4i-i2s.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c
index 78506c3811dc..c57feae3396e 100644
--- a/sound/soc/sunxi/sun4i-i2s.c
+++ b/sound/soc/sunxi/sun4i-i2s.c
@@ -1079,8 +1079,6 @@ static int sun4i_i2s_dai_probe(struct snd_soc_dai *dai)
&i2s->playback_dma_data,
&i2s->capture_dma_data);

- snd_soc_dai_set_drvdata(dai, i2s);
-
return 0;
}


2021-02-13 10:25:14

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 2/4] ASoC: mxs-saif: drop unneeded snd_soc_dai_set_drvdata

snd_soc_dai_set_drvdata is not needed when the set data comes from
snd_soc_dai_get_drvdata or dev_get_drvdata. The problem was fixed
usingthe following semantic patch: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,y,e;
@@
x = dev_get_drvdata(y->dev)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);

@@
expression x,y,e;
@@
x = snd_soc_dai_get_drvdata(y)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);
// </smpl>

In this case, the whole probe function then does nothing, so drop it.

Signed-off-by: Julia Lawall <[email protected]>

---
sound/soc/mxs/mxs-saif.c | 10 ----------
1 file changed, 10 deletions(-)

diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 07f8cf9980e3..6a2d24d48964 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -642,18 +642,8 @@ static const struct snd_soc_dai_ops mxs_saif_dai_ops = {
.set_fmt = mxs_saif_set_dai_fmt,
};

-static int mxs_saif_dai_probe(struct snd_soc_dai *dai)
-{
- struct mxs_saif *saif = dev_get_drvdata(dai->dev);
-
- snd_soc_dai_set_drvdata(dai, saif);
-
- return 0;
-}
-
static struct snd_soc_dai_driver mxs_saif_dai = {
.name = "mxs-saif",
- .probe = mxs_saif_dai_probe,
.playback = {
.channels_min = 2,
.channels_max = 2,

2021-02-18 06:44:45

by Nicolin Chen

[permalink] [raw]
Subject: Re: [PATCH 4/4] ASoC: fsl: drop unneeded snd_soc_dai_set_drvdata

On Sat, Feb 13, 2021 at 11:19:07AM +0100, Julia Lawall wrote:
> snd_soc_dai_set_drvdata is not needed when the set data comes from
> snd_soc_dai_get_drvdata or dev_get_drvdata. The problem was fixed
> usingthe following semantic patch: (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression x,y,e;
> @@
> x = dev_get_drvdata(y->dev)
> ... when != x = e
> - snd_soc_dai_set_drvdata(y,x);
>
> @@
> expression x,y,e;
> @@
> x = snd_soc_dai_get_drvdata(y)
> ... when != x = e
> - snd_soc_dai_set_drvdata(y,x);
> // </smpl>
>
> Signed-off-by: Julia Lawall <[email protected]>

Acked-by: Nicolin Chen <[email protected]>

2021-03-02 18:19:01

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 0/4] drop unneeded snd_soc_dai_set_drvdata

On Sat, 13 Feb 2021 11:19:03 +0100, Julia Lawall wrote:
> snd_soc_dai_set_drvdata is not needed when the set data comes from
> snd_soc_dai_get_drvdata or dev_get_drvdata.

Applied to

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

Thanks!

[1/4] ASoC: mmp-sspa: drop unneeded snd_soc_dai_set_drvdata
commit: 131036ffae211a9cc3bfb053fadce87484e13fc5
[2/4] ASoC: mxs-saif: drop unneeded snd_soc_dai_set_drvdata
commit: 7150186f1edb2fa94554be1bec26aa65a7df3388
[3/4] ASoC: sun4i-i2s: drop unneeded snd_soc_dai_set_drvdata
commit: 0c34af2d5c9ba5103637c33c4f52d658172b991d
[4/4] ASoC: fsl: drop unneeded snd_soc_dai_set_drvdata
commit: eb9db3066cdb57dbfd1fb3d85ca143ad5d719bfb

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