summaryrefslogtreecommitdiff
path: root/sound/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-04-08 12:41:59 +0300
committerTakashi Iwai <tiwai@suse.de>2015-04-08 12:41:59 +0300
commit142267c9e026827ca5fa622f1f13780b6db26cf8 (patch)
tree09ae08237b4effe5510a00dd86b0c098123aab2d /sound/hda
parente1e62b98ebddc3234f3259019d3236f66fc667f8 (diff)
downloadlinux-142267c9e026827ca5fa622f1f13780b6db26cf8.tar.xz
ALSA: hda - Create AFG sysfs node at last
... so that user-space can know that the whole nodes have been created. Unfortunately, this can't be implemented easily in race-free way, so it's a kind of compromise. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/hda')
-rw-r--r--sound/hda/hdac_sysfs.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sound/hda/hdac_sysfs.c b/sound/hda/hdac_sysfs.c
index b358d5157802..18aea43d230d 100644
--- a/sound/hda/hdac_sysfs.c
+++ b/sound/hda/hdac_sysfs.c
@@ -313,12 +313,12 @@ static void widget_tree_free(struct hdac_device *codec)
if (!tree)
return;
+ free_widget_node(tree->afg, &widget_afg_group);
if (tree->nodes) {
for (p = tree->nodes; *p; p++)
free_widget_node(*p, &widget_node_group);
kfree(tree->nodes);
}
- free_widget_node(tree->afg, &widget_afg_group);
if (tree->root)
kobject_put(tree->root);
kfree(tree);
@@ -362,13 +362,6 @@ static int widget_tree_create(struct hdac_device *codec)
if (!tree->root)
return -ENOMEM;
- if (codec->afg) {
- err = add_widget_node(tree->root, codec->afg,
- &widget_afg_group, &tree->afg);
- if (err < 0)
- return err;
- }
-
tree->nodes = kcalloc(codec->num_nodes + 1, sizeof(*tree->nodes),
GFP_KERNEL);
if (!tree->nodes)
@@ -381,6 +374,13 @@ static int widget_tree_create(struct hdac_device *codec)
return err;
}
+ if (codec->afg) {
+ err = add_widget_node(tree->root, codec->afg,
+ &widget_afg_group, &tree->afg);
+ if (err < 0)
+ return err;
+ }
+
kobject_uevent(tree->root, KOBJ_CHANGE);
return 0;
}