Skip to content

Commit 28c916a

Browse files
jwrdegoedebroonie
authored andcommitted
ASoC: soc-acpi: Set mach->id field on comp_ids matches
Commit dac7cbd ("ASoC: Intel: soc-acpi-byt: shrink tables using compatible IDs") and commit 959ae82 ("ASoC: Intel: soc-acpi-cht: shrink tables using compatible IDs") simplified the match tables in soc-acpi-intel-byt-match.c and soc-acpi-intel-cht-match.c by merging identical entries using the new .comp_ids snd_soc_acpi_mach field to point a single entry to multiple ACPI HIDs and clearing the previously unique per entry .id field. But various machine drivers from sound/soc/intel/boards rely on mach->id in one or more ways, e.g. some drivers contain the following snippets: adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1); pkg_found = snd_soc_acpi_find_package_from_hid(mach->id, ... if (!strncmp(snd_soc_cards[i].codec_id, mach->id, 8)) { ... All of which are broken by the match table shrinking. Make the snd_soc_acpi_mach.id field non const (the storage for the tables already is non const) and on a comps_ids match copy the matching HID to the id field to fix this. Fixes: dac7cbd ("ASoC: Intel: soc-acpi-byt: shrink tables using compatible IDs") Fixes: 959ae82 ("ASoC: Intel: soc-acpi-cht: shrink tables using compatible IDs") Suggested-by: Pierre-Louis Bossart <[email protected]> Cc: Pierre-Louis Bossart <[email protected]> Cc: Brent Lu <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 8cf72c4 commit 28c916a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

include/sound/soc-acpi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ struct snd_soc_acpi_link_adr {
147147
*/
148148
/* Descriptor for SST ASoC machine driver */
149149
struct snd_soc_acpi_mach {
150-
const u8 id[ACPI_ID_LEN];
150+
u8 id[ACPI_ID_LEN];
151151
const struct snd_soc_acpi_codecs *comp_ids;
152152
const u32 link_mask;
153153
const struct snd_soc_acpi_link_adr *links;

sound/soc/soc-acpi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ static bool snd_soc_acpi_id_present(struct snd_soc_acpi_mach *machine)
2020

2121
if (comp_ids) {
2222
for (i = 0; i < comp_ids->num_codecs; i++) {
23-
if (acpi_dev_present(comp_ids->codecs[i], NULL, -1))
23+
if (acpi_dev_present(comp_ids->codecs[i], NULL, -1)) {
24+
strscpy(machine->id, comp_ids->codecs[i], ACPI_ID_LEN);
2425
return true;
26+
}
2527
}
2628
}
2729

0 commit comments

Comments
 (0)