5c596fc49c9b58fc5d2d301b3773ef088239cf43
[openwrt/staging/jow.git] /
1 From 98b8fb2cb4fcab1903d0baf611bf0c3f822a08dc Mon Sep 17 00:00:00 2001
2 From: Maso Huang <maso.huang@mediatek.com>
3 Date: Tue, 24 Oct 2023 11:50:18 +0800
4 Subject: [PATCH 8/9] ASoC: mediatek: mt7986: remove the mt7986_wm8960_priv
5 structure
6
7 Remove the mt7986_wm8960_priv structure.
8
9 Signed-off-by: Maso Huang <maso.huang@mediatek.com>
10 Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
11 Link: https://lore.kernel.org/r/20231024035019.11732-3-maso.huang@mediatek.com
12 Signed-off-by: Mark Brown <broonie@kernel.org>
13 ---
14 sound/soc/mediatek/mt7986/mt7986-wm8960.c | 33 +++++++++--------------
15 1 file changed, 12 insertions(+), 21 deletions(-)
16
17 --- a/sound/soc/mediatek/mt7986/mt7986-wm8960.c
18 +++ b/sound/soc/mediatek/mt7986/mt7986-wm8960.c
19 @@ -12,11 +12,6 @@
20
21 #include "mt7986-afe-common.h"
22
23 -struct mt7986_wm8960_priv {
24 - struct device_node *platform_node;
25 - struct device_node *codec_node;
26 -};
27 -
28 static const struct snd_soc_dapm_widget mt7986_wm8960_widgets[] = {
29 SND_SOC_DAPM_HP("Headphone", NULL),
30 SND_SOC_DAPM_MIC("AMIC", NULL),
31 @@ -92,20 +87,18 @@ static int mt7986_wm8960_machine_probe(s
32 struct snd_soc_card *card = &mt7986_wm8960_card;
33 struct snd_soc_dai_link *dai_link;
34 struct device_node *platform, *codec;
35 - struct mt7986_wm8960_priv *priv;
36 + struct device_node *platform_dai_node, *codec_dai_node;
37 int ret, i;
38
39 - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
40 - if (!priv)
41 - return -ENOMEM;
42 + card->dev = &pdev->dev;
43
44 platform = of_get_child_by_name(pdev->dev.of_node, "platform");
45
46 if (platform) {
47 - priv->platform_node = of_parse_phandle(platform, "sound-dai", 0);
48 + platform_dai_node = of_parse_phandle(platform, "sound-dai", 0);
49 of_node_put(platform);
50
51 - if (!priv->platform_node) {
52 + if (!platform_dai_node) {
53 dev_err(&pdev->dev, "Failed to parse platform/sound-dai property\n");
54 return -EINVAL;
55 }
56 @@ -117,24 +110,22 @@ static int mt7986_wm8960_machine_probe(s
57 for_each_card_prelinks(card, i, dai_link) {
58 if (dai_link->platforms->name)
59 continue;
60 - dai_link->platforms->of_node = priv->platform_node;
61 + dai_link->platforms->of_node = platform_dai_node;
62 }
63
64 - card->dev = &pdev->dev;
65 -
66 codec = of_get_child_by_name(pdev->dev.of_node, "codec");
67
68 if (codec) {
69 - priv->codec_node = of_parse_phandle(codec, "sound-dai", 0);
70 + codec_dai_node = of_parse_phandle(codec, "sound-dai", 0);
71 of_node_put(codec);
72
73 - if (!priv->codec_node) {
74 - of_node_put(priv->platform_node);
75 + if (!codec_dai_node) {
76 + of_node_put(platform_dai_node);
77 dev_err(&pdev->dev, "Failed to parse codec/sound-dai property\n");
78 return -EINVAL;
79 }
80 } else {
81 - of_node_put(priv->platform_node);
82 + of_node_put(platform_dai_node);
83 dev_err(&pdev->dev, "Property 'codec' missing or invalid\n");
84 return -EINVAL;
85 }
86 @@ -142,7 +133,7 @@ static int mt7986_wm8960_machine_probe(s
87 for_each_card_prelinks(card, i, dai_link) {
88 if (dai_link->codecs->name)
89 continue;
90 - dai_link->codecs->of_node = priv->codec_node;
91 + dai_link->codecs->of_node = codec_dai_node;
92 }
93
94 ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
95 @@ -158,8 +149,8 @@ static int mt7986_wm8960_machine_probe(s
96 }
97
98 err_of_node_put:
99 - of_node_put(priv->codec_node);
100 - of_node_put(priv->platform_node);
101 + of_node_put(platform_dai_node);
102 + of_node_put(codec_dai_node);
103 return ret;
104 }
105