summaryrefslogtreecommitdiff
path: root/sound/hda/local.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-10-18 15:51:59 +0200
committerTakashi Iwai <tiwai@suse.de>2017-10-19 13:58:36 +0200
commit9780ded39bef5d22a84bdc39112df93f70a58bdd (patch)
tree312c860555df48fda2450d833a2cb1a7a7cd5b0e /sound/hda/local.h
parent28d1d6d2f314ff395ff67565d1145742614b21c8 (diff)
ALSA: hda: Avoid racy recreation of widget kobjects
The refresh of HD-audio widget sysfs kobjects via snd_hdac_refresh_widget_sysfs() is slightly racy. The driver recreates the whole tree from scratch after deleting the whole. When CONFIG_DEBUG_KOBJECT_RELEASE option is used, kobject release doesn't happen immediately but delayed, while the re-creation of the same named kobject happens soon after invoking kobject_put(). This may end up with the conflicts of duplicated kobjects, as found in the bug report below. In this patch, we take another approach to refresh the tree: instead of recreating the whole tree, just add the new nodes and delete the non-existing nodes. Since the refresh happens only once at initialization, no longer race would happen. Along with the code change, merge snd_hdac_refresh_widget_sysfs() with the existing snd_hdac_refresh_widgets() with an additional bool flag for simplifying the code. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=197307 Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/hda/local.h')
-rw-r--r--sound/hda/local.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/hda/local.h b/sound/hda/local.h
index 0d5bb159d538..c586ea62d49e 100644
--- a/sound/hda/local.h
+++ b/sound/hda/local.h
@@ -28,6 +28,8 @@ static inline unsigned int get_wcaps_channels(u32 wcaps)
extern const struct attribute_group *hdac_dev_attr_groups[];
int hda_widget_sysfs_init(struct hdac_device *codec);
+int hda_widget_sysfs_reinit(struct hdac_device *codec, hda_nid_t start_nid,
+ int num_nodes);
void hda_widget_sysfs_exit(struct hdac_device *codec);
#endif /* __HDAC_LOCAL_H */