Commit 3667a037 authored by Tzung-Bi Shih's avatar Tzung-Bi Shih Committed by Mark Brown

ASoC: mediatek: use of_device_get_match_data()

Uses of_device_get_match_data() helper to clean some boilerplate code.
Signed-off-by: default avatarTzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211227062153.3887447-1-tzungbi@google.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8f853172
...@@ -685,7 +685,6 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) ...@@ -685,7 +685,6 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev)
struct snd_soc_dai_link *dai_link; struct snd_soc_dai_link *dai_link;
struct mt8183_da7219_max98357_priv *priv; struct mt8183_da7219_max98357_priv *priv;
struct pinctrl *pinctrl; struct pinctrl *pinctrl;
const struct of_device_id *match;
int ret, i; int ret, i;
platform_node = of_parse_phandle(pdev->dev.of_node, platform_node = of_parse_phandle(pdev->dev.of_node,
...@@ -695,11 +694,9 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) ...@@ -695,11 +694,9 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev); card = (struct snd_soc_card *)of_device_get_match_data(&pdev->dev);
if (!match || !match->data) if (!card)
return -EINVAL; return -EINVAL;
card = (struct snd_soc_card *)match->data;
card->dev = &pdev->dev; card->dev = &pdev->dev;
hdmi_codec = of_parse_phandle(pdev->dev.of_node, hdmi_codec = of_parse_phandle(pdev->dev.of_node,
......
...@@ -637,7 +637,6 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) ...@@ -637,7 +637,6 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)
struct device_node *platform_node, *ec_codec, *hdmi_codec; struct device_node *platform_node, *ec_codec, *hdmi_codec;
struct snd_soc_dai_link *dai_link; struct snd_soc_dai_link *dai_link;
struct mt8183_mt6358_ts3a227_max98357_priv *priv; struct mt8183_mt6358_ts3a227_max98357_priv *priv;
const struct of_device_id *match;
int ret, i; int ret, i;
platform_node = of_parse_phandle(pdev->dev.of_node, platform_node = of_parse_phandle(pdev->dev.of_node,
...@@ -647,11 +646,9 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) ...@@ -647,11 +646,9 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev); card = (struct snd_soc_card *)of_device_get_match_data(&pdev->dev);
if (!match || !match->data) if (!card)
return -EINVAL; return -EINVAL;
card = (struct snd_soc_card *)match->data;
card->dev = &pdev->dev; card->dev = &pdev->dev;
ec_codec = of_parse_phandle(pdev->dev.of_node, "mediatek,ec-codec", 0); ec_codec = of_parse_phandle(pdev->dev.of_node, "mediatek,ec-codec", 0);
......
...@@ -1106,7 +1106,6 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) ...@@ -1106,7 +1106,6 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev)
struct device_node *platform_node, *hdmi_codec; struct device_node *platform_node, *hdmi_codec;
int ret, i; int ret, i;
struct snd_soc_dai_link *dai_link; struct snd_soc_dai_link *dai_link;
const struct of_device_id *match;
struct mt8192_mt6359_priv *priv; struct mt8192_mt6359_priv *priv;
platform_node = of_parse_phandle(pdev->dev.of_node, platform_node = of_parse_phandle(pdev->dev.of_node,
...@@ -1116,11 +1115,9 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) ...@@ -1116,11 +1115,9 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev); card = (struct snd_soc_card *)of_device_get_match_data(&pdev->dev);
if (!match || !match->data) if (!card)
return -EINVAL; return -EINVAL;
card = (struct snd_soc_card *)match->data;
card->dev = &pdev->dev; card->dev = &pdev->dev;
hdmi_codec = of_parse_phandle(pdev->dev.of_node, hdmi_codec = of_parse_phandle(pdev->dev.of_node,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment