2
0

860-v6.7-08-ASoC-mediatek-mt7986-remove-the-mt7986_wm8960_priv-s.patch 3.3 KB

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