Skip to content

Commit 3667a03

Browse files
Tzung-Bi Shihbroonie
authored andcommitted
ASoC: mediatek: use of_device_get_match_data()
Uses of_device_get_match_data() helper to clean some boilerplate code. Signed-off-by: Tzung-Bi Shih <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 8f85317 commit 3667a03

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,6 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev)
685685
struct snd_soc_dai_link *dai_link;
686686
struct mt8183_da7219_max98357_priv *priv;
687687
struct pinctrl *pinctrl;
688-
const struct of_device_id *match;
689688
int ret, i;
690689

691690
platform_node = of_parse_phandle(pdev->dev.of_node,
@@ -695,11 +694,9 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev)
695694
return -EINVAL;
696695
}
697696

698-
match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
699-
if (!match || !match->data)
697+
card = (struct snd_soc_card *)of_device_get_match_data(&pdev->dev);
698+
if (!card)
700699
return -EINVAL;
701-
702-
card = (struct snd_soc_card *)match->data;
703700
card->dev = &pdev->dev;
704701

705702
hdmi_codec = of_parse_phandle(pdev->dev.of_node,

sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,6 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)
637637
struct device_node *platform_node, *ec_codec, *hdmi_codec;
638638
struct snd_soc_dai_link *dai_link;
639639
struct mt8183_mt6358_ts3a227_max98357_priv *priv;
640-
const struct of_device_id *match;
641640
int ret, i;
642641

643642
platform_node = of_parse_phandle(pdev->dev.of_node,
@@ -647,11 +646,9 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)
647646
return -EINVAL;
648647
}
649648

650-
match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
651-
if (!match || !match->data)
649+
card = (struct snd_soc_card *)of_device_get_match_data(&pdev->dev);
650+
if (!card)
652651
return -EINVAL;
653-
654-
card = (struct snd_soc_card *)match->data;
655652
card->dev = &pdev->dev;
656653

657654
ec_codec = of_parse_phandle(pdev->dev.of_node, "mediatek,ec-codec", 0);

sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,6 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev)
11061106
struct device_node *platform_node, *hdmi_codec;
11071107
int ret, i;
11081108
struct snd_soc_dai_link *dai_link;
1109-
const struct of_device_id *match;
11101109
struct mt8192_mt6359_priv *priv;
11111110

11121111
platform_node = of_parse_phandle(pdev->dev.of_node,
@@ -1116,11 +1115,9 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev)
11161115
return -EINVAL;
11171116
}
11181117

1119-
match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
1120-
if (!match || !match->data)
1118+
card = (struct snd_soc_card *)of_device_get_match_data(&pdev->dev);
1119+
if (!card)
11211120
return -EINVAL;
1122-
1123-
card = (struct snd_soc_card *)match->data;
11241121
card->dev = &pdev->dev;
11251122

11261123
hdmi_codec = of_parse_phandle(pdev->dev.of_node,

0 commit comments

Comments
 (0)