Skip to content

Commit 930375d

Browse files
jwrdegoedebroonie
authored andcommitted
ASoC: Intel: cht_bsw_rt5645: Cleanup codec_name handling
4 fixes / cleanups to the rt5645 mc driver's codec_name handling: 1. In the for loop looking for the dai_index for the codec, replace card->dai_link[i] with cht_dailink[i]. The for loop already uses ARRAY_SIZE(cht_dailink) as bound and card->dai_link is just a pointer to cht_dailink using card->dai_link only obfuscates that cht_dailink is being modified directly rather then say a copy of cht_dailink. Using cht_dailink[i] also makes the code consistent with other machine drivers. 2. Don't set cht_dailink[dai_index].codecs->name in the for loop, this immediately gets overridden using acpi_dev_name(adev) directly below the loop. 3. Add a missing break to the loop. 4. Remove the now no longer used (only set, never read) codec_name field from struct cht_mc_private. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20240210134400.24913-3-hdegoede@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 7d99a70 commit 930375d

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

sound/soc/intel/boards/cht_bsw_rt5645.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ struct cht_acpi_card {
4040
struct cht_mc_private {
4141
struct snd_soc_jack jack;
4242
struct cht_acpi_card *acpi_card;
43-
char codec_name[SND_ACPI_I2C_ID_LEN];
4443
struct clk *mclk;
4544
};
4645

@@ -567,15 +566,14 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
567566
}
568567

569568
card->dev = &pdev->dev;
570-
sprintf(drv->codec_name, "i2c-%s:00", drv->acpi_card->codec_id);
571569

572570
/* set correct codec name */
573571
for (i = 0; i < ARRAY_SIZE(cht_dailink); i++)
574-
if (card->dai_link[i].codecs->name &&
575-
!strcmp(card->dai_link[i].codecs->name,
572+
if (cht_dailink[i].codecs->name &&
573+
!strcmp(cht_dailink[i].codecs->name,
576574
"i2c-10EC5645:00")) {
577-
card->dai_link[i].codecs->name = drv->codec_name;
578575
dai_index = i;
576+
break;
579577
}
580578

581579
/* fixup codec name based on HID */

0 commit comments

Comments
 (0)