mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
ALSA: hda: Simplify snd_hdac_refresh_widgets()
Along with the recent fix for the races of snd_hdac_refresh_widgets()
it turned out that the instantiation of widgets sysfs at
snd_hdac_sysfs_reinit() could cause a race. The race itself was
already covered later by extending the mutex protection range, the
commit 98482377dc ("ALSA: hda: Fix widget_mutex incomplete
protection"), but this also indicated that the call of *_reinit() is
basically superfluous, as the widgets shall be created sooner or later
from snd_hdac_device_register().
This patch removes the redundant call of snd_hdac_sysfs_reinit() at
first. By this removal, the sysfs argument itself in
snd_hdac_refresh_widgets() becomes superfluous, too, because the only
case sysfs=false is always with codec->widgets=NULL. So, we drop this
redundant argument as well.
Signed-off-by: Takashi Iwai <[email protected]>
This commit is contained in:
parent
3450121997
commit
774a075ab5
5 changed files with 9 additions and 12 deletions
|
|
@ -89,7 +89,7 @@ int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus,
|
|||
|
||||
fg = codec->afg ? codec->afg : codec->mfg;
|
||||
|
||||
err = snd_hdac_refresh_widgets(codec, false);
|
||||
err = snd_hdac_refresh_widgets(codec);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
|
||||
|
|
@ -394,9 +394,8 @@ static void setup_fg_nodes(struct hdac_device *codec)
|
|||
/**
|
||||
* snd_hdac_refresh_widgets - Reset the widget start/end nodes
|
||||
* @codec: the codec object
|
||||
* @sysfs: re-initialize sysfs tree, too
|
||||
*/
|
||||
int snd_hdac_refresh_widgets(struct hdac_device *codec, bool sysfs)
|
||||
int snd_hdac_refresh_widgets(struct hdac_device *codec)
|
||||
{
|
||||
hda_nid_t start_nid;
|
||||
int nums, err = 0;
|
||||
|
|
@ -414,11 +413,9 @@ int snd_hdac_refresh_widgets(struct hdac_device *codec, bool sysfs)
|
|||
goto unlock;
|
||||
}
|
||||
|
||||
if (sysfs) {
|
||||
err = hda_widget_sysfs_reinit(codec, start_nid, nums);
|
||||
if (err < 0)
|
||||
goto unlock;
|
||||
}
|
||||
err = hda_widget_sysfs_reinit(codec, start_nid, nums);
|
||||
if (err < 0)
|
||||
goto unlock;
|
||||
|
||||
codec->num_nodes = nums;
|
||||
codec->start_nid = start_nid;
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ int hda_widget_sysfs_reinit(struct hdac_device *codec,
|
|||
int i;
|
||||
|
||||
if (!codec->widgets)
|
||||
return hda_widget_sysfs_init(codec);
|
||||
return 0;
|
||||
|
||||
tree = kmemdup(codec->widgets, sizeof(*tree), GFP_KERNEL);
|
||||
if (!tree)
|
||||
|
|
|
|||
Loading…
Reference in a new issue