Commit 142267c9 authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarTakashi Iwai <tiwai@suse.de>
parent e1e62b98
...@@ -313,12 +313,12 @@ static void widget_tree_free(struct hdac_device *codec) ...@@ -313,12 +313,12 @@ static void widget_tree_free(struct hdac_device *codec)
if (!tree) if (!tree)
return; return;
free_widget_node(tree->afg, &widget_afg_group);
if (tree->nodes) { if (tree->nodes) {
for (p = tree->nodes; *p; p++) for (p = tree->nodes; *p; p++)
free_widget_node(*p, &widget_node_group); free_widget_node(*p, &widget_node_group);
kfree(tree->nodes); kfree(tree->nodes);
} }
free_widget_node(tree->afg, &widget_afg_group);
if (tree->root) if (tree->root)
kobject_put(tree->root); kobject_put(tree->root);
kfree(tree); kfree(tree);
...@@ -362,13 +362,6 @@ static int widget_tree_create(struct hdac_device *codec) ...@@ -362,13 +362,6 @@ static int widget_tree_create(struct hdac_device *codec)
if (!tree->root) if (!tree->root)
return -ENOMEM; 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), tree->nodes = kcalloc(codec->num_nodes + 1, sizeof(*tree->nodes),
GFP_KERNEL); GFP_KERNEL);
if (!tree->nodes) if (!tree->nodes)
...@@ -381,6 +374,13 @@ static int widget_tree_create(struct hdac_device *codec) ...@@ -381,6 +374,13 @@ static int widget_tree_create(struct hdac_device *codec)
return err; 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); kobject_uevent(tree->root, KOBJ_CHANGE);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment