ASoC: intel: sof_sdw: Minor tidy up of mc_probe
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Mon, 31 Jul 2023 21:42:49 +0000 (16:42 -0500)
committerMark Brown <broonie@kernel.org>
Mon, 31 Jul 2023 22:22:35 +0000 (23:22 +0100)
Shuffle things around to group operations a little more, and
consistently use card->dev.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230731214257.444605-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/sof_sdw.c

index fc67029b3a6481ba8358ddf763ea1edfaa19f2e5..d4f2711b6f26b3ca1f96185ed754e8ef7e3925f3 100644 (file)
@@ -1964,34 +1964,34 @@ static void mc_dailink_exit_loop(struct snd_soc_card *card)
 static int mc_probe(struct platform_device *pdev)
 {
        struct snd_soc_card *card = &card_sof_sdw;
-       struct snd_soc_acpi_mach *mach;
+       struct snd_soc_acpi_mach *mach = dev_get_platdata(&pdev->dev);
        struct mc_private *ctx;
        int amp_num = 0, i;
        int ret;
 
-       dev_dbg(&pdev->dev, "Entry\n");
+       card->dev = &pdev->dev;
+
+       dev_dbg(card->dev, "Entry\n");
 
-       ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
+       ctx = devm_kzalloc(card->dev, sizeof(*ctx), GFP_KERNEL);
        if (!ctx)
                return -ENOMEM;
 
+       INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
+
+       snd_soc_card_set_drvdata(card, ctx);
+
        dmi_check_system(sof_sdw_quirk_table);
 
        if (quirk_override != -1) {
-               dev_info(&pdev->dev, "Overriding quirk 0x%lx => 0x%x\n",
+               dev_info(card->dev, "Overriding quirk 0x%lx => 0x%x\n",
                         sof_sdw_quirk, quirk_override);
                sof_sdw_quirk = quirk_override;
        }
-       log_quirks(&pdev->dev);
-
-       INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
 
-       card->dev = &pdev->dev;
-       snd_soc_card_set_drvdata(card, ctx);
+       log_quirks(card->dev);
 
-       mach = pdev->dev.platform_data;
-       ret = sof_card_dai_links_create(&pdev->dev, mach,
-                                       card);
+       ret = sof_card_dai_links_create(card->dev, mach, card);
        if (ret < 0)
                return ret;
 
@@ -2022,7 +2022,7 @@ static int mc_probe(struct platform_device *pdev)
        card->long_name = sdw_card_long_name;
 
        /* Register the card */
-       ret = devm_snd_soc_register_card(&pdev->dev, card);
+       ret = devm_snd_soc_register_card(card->dev, card);
        if (ret) {
                dev_err(card->dev, "snd_soc_register_card failed %d\n", ret);
                mc_dailink_exit_loop(card);