Skip to content

Commit 7b558de

Browse files
marcanjannau
authored andcommitted
macaudio: Set the card name explicitly
This might fix a udev race, and also makes it possible to switch to a more descriptive "AppleJxxx" name (but before that we need to update userspace to avoid breaking users). Signed-off-by: Hector Martin <marcan@marcan.st>
1 parent 815a3f3 commit 7b558de

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

sound/soc/apple/macaudio.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,14 @@ static int macaudio_set_speaker(struct snd_soc_card *card, const char *prefix, b
12301230
static int macaudio_fixup_controls(struct snd_soc_card *card)
12311231
{
12321232
struct macaudio_snd_data *ma = snd_soc_card_get_drvdata(card);
1233+
const char *p;
1234+
1235+
/* Set the card ID early to avoid races with udev */
1236+
p = strrchr(card->name, ' ');
1237+
if (p) {
1238+
snprintf(card->snd_card->id, sizeof(card->snd_card->id),
1239+
"%s", p + 1);
1240+
}
12331241

12341242
if (!ma->has_speakers)
12351243
return 0;

0 commit comments

Comments
 (0)