Skip to content

Commit 0f10adb

Browse files
Maso Huangbroonie
authored andcommitted
ASoC: mediatek: mt7986: remove the mt7986_wm8960_priv structure
Remove the mt7986_wm8960_priv structure. Signed-off-by: Maso Huang <maso.huang@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20231024035019.11732-3-maso.huang@mediatek.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 3e92ea2 commit 0f10adb

1 file changed

Lines changed: 12 additions & 21 deletions

File tree

sound/soc/mediatek/mt7986/mt7986-wm8960.c

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212

1313
#include "mt7986-afe-common.h"
1414

15-
struct mt7986_wm8960_priv {
16-
struct device_node *platform_node;
17-
struct device_node *codec_node;
18-
};
19-
2015
static const struct snd_soc_dapm_widget mt7986_wm8960_widgets[] = {
2116
SND_SOC_DAPM_HP("Headphone", NULL),
2217
SND_SOC_DAPM_MIC("AMIC", NULL),
@@ -92,20 +87,18 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev)
9287
struct snd_soc_card *card = &mt7986_wm8960_card;
9388
struct snd_soc_dai_link *dai_link;
9489
struct device_node *platform, *codec;
95-
struct mt7986_wm8960_priv *priv;
90+
struct device_node *platform_dai_node, *codec_dai_node;
9691
int ret, i;
9792

98-
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
99-
if (!priv)
100-
return -ENOMEM;
93+
card->dev = &pdev->dev;
10194

10295
platform = of_get_child_by_name(pdev->dev.of_node, "platform");
10396

10497
if (platform) {
105-
priv->platform_node = of_parse_phandle(platform, "sound-dai", 0);
98+
platform_dai_node = of_parse_phandle(platform, "sound-dai", 0);
10699
of_node_put(platform);
107100

108-
if (!priv->platform_node) {
101+
if (!platform_dai_node) {
109102
dev_err(&pdev->dev, "Failed to parse platform/sound-dai property\n");
110103
return -EINVAL;
111104
}
@@ -117,32 +110,30 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev)
117110
for_each_card_prelinks(card, i, dai_link) {
118111
if (dai_link->platforms->name)
119112
continue;
120-
dai_link->platforms->of_node = priv->platform_node;
113+
dai_link->platforms->of_node = platform_dai_node;
121114
}
122115

123-
card->dev = &pdev->dev;
124-
125116
codec = of_get_child_by_name(pdev->dev.of_node, "codec");
126117

127118
if (codec) {
128-
priv->codec_node = of_parse_phandle(codec, "sound-dai", 0);
119+
codec_dai_node = of_parse_phandle(codec, "sound-dai", 0);
129120
of_node_put(codec);
130121

131-
if (!priv->codec_node) {
132-
of_node_put(priv->platform_node);
122+
if (!codec_dai_node) {
123+
of_node_put(platform_dai_node);
133124
dev_err(&pdev->dev, "Failed to parse codec/sound-dai property\n");
134125
return -EINVAL;
135126
}
136127
} else {
137-
of_node_put(priv->platform_node);
128+
of_node_put(platform_dai_node);
138129
dev_err(&pdev->dev, "Property 'codec' missing or invalid\n");
139130
return -EINVAL;
140131
}
141132

142133
for_each_card_prelinks(card, i, dai_link) {
143134
if (dai_link->codecs->name)
144135
continue;
145-
dai_link->codecs->of_node = priv->codec_node;
136+
dai_link->codecs->of_node = codec_dai_node;
146137
}
147138

148139
ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
@@ -158,8 +149,8 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev)
158149
}
159150

160151
err_of_node_put:
161-
of_node_put(priv->codec_node);
162-
of_node_put(priv->platform_node);
152+
of_node_put(platform_dai_node);
153+
of_node_put(codec_dai_node);
163154
return ret;
164155
}
165156

0 commit comments

Comments
 (0)