]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ALSA: when card identification is changed, change also /proc/asound symlink
authorJaroslav Kysela <perex@perex.cz>
Wed, 12 Nov 2008 15:31:37 +0000 (16:31 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 12 Nov 2008 16:07:37 +0000 (17:07 +0100)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/info.h
sound/core/info.c
sound/core/init.c

index 8ae72e74f898714979e6d1f6d79ae32dd683343a..46f702a76e4ff0f8e4d97a2d3443a195a831c2fc 100644 (file)
@@ -126,6 +126,7 @@ int snd_info_card_create(struct snd_card * card);
 int snd_info_card_register(struct snd_card * card);
 int snd_info_card_free(struct snd_card * card);
 void snd_info_card_disconnect(struct snd_card * card);
+void snd_info_card_id_change(struct snd_card * card);
 int snd_info_register(struct snd_info_entry * entry);
 
 /* for card drivers */
@@ -160,6 +161,7 @@ static inline int snd_info_card_create(struct snd_card * card) { return 0; }
 static inline int snd_info_card_register(struct snd_card * card) { return 0; }
 static inline int snd_info_card_free(struct snd_card * card) { return 0; }
 static inline void snd_info_card_disconnect(struct snd_card * card) { }
+static inline void snd_info_card_id_change(struct snd_card * card) { }
 static inline int snd_info_register(struct snd_info_entry * entry) { return 0; }
 
 static inline int snd_card_proc_new(struct snd_card *card, const char *name,
index 527b207462b0849809f7843b5d6beace67966b66..70fa87189f3624694dc52ab3f04f48f13dba6fee 100644 (file)
@@ -652,6 +652,23 @@ int snd_info_card_register(struct snd_card *card)
        return 0;
 }
 
+/*
+ * called on card->id change
+ */
+void snd_info_card_id_change(struct snd_card *card)
+{
+       mutex_lock(&info_mutex);
+       if (card->proc_root_link) {
+               snd_remove_proc_entry(snd_proc_root, card->proc_root_link);
+               card->proc_root_link = NULL;
+       }
+       if (strcmp(card->id, card->proc_root->name))
+               card->proc_root_link = proc_symlink(card->id,
+                                                   snd_proc_root,
+                                                   card->proc_root->name);
+       mutex_unlock(&info_mutex);
+}
+
 /*
  * de-register the card proc file
  * called from init.c
index 5ff297d1d89ace5cac5ac5047c31b252a8e993d0..af1e407ca27f5f4f3c60b4d091d6aa052eacd512 100644 (file)
@@ -571,6 +571,7 @@ card_id_store_attr(struct device *dev, struct device_attribute *attr,
                        goto __exist;
        }
        strcpy(card->id, buf1);
+       snd_info_card_id_change(card);
        mutex_unlock(&snd_card_mutex);
 
        return count;