summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-08-15 15:42:51 -0400
committerTakashi Iwai <tiwai@suse.de>2019-08-15 15:43:05 -0400
commit246bb4aaa4f4314816ae6835f3c6cc6dc7a10f4f (patch)
tree7836e9fc30f5cae3ed257f3e8aaaf605bd974632
parentddf7cb83b0f45feb94ad89a987f600c766c463ca (diff)
Revert "ALSA: hda: Add codec on bus address table lately"
This reverts commit ee5f85d9290f ("ALSA: hda: Add codec on bus address table lately"). The commit caused several regression since I've overlooked that the function doesn't manage only the caddr_tbl but also the codec linked list that is referred indirectly in the other drivers. Revert for now to make everything back to work. Fixes: ee5f85d9290f ("ALSA: hda: Add codec on bus address table lately") Reported-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/hda/hdac_device.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index bf83d7062ef6..9f3e37511408 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -61,6 +61,10 @@ int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus,
61 pm_runtime_get_noresume(&codec->dev); 61 pm_runtime_get_noresume(&codec->dev);
62 atomic_set(&codec->in_pm, 0); 62 atomic_set(&codec->in_pm, 0);
63 63
64 err = snd_hdac_bus_add_device(bus, codec);
65 if (err < 0)
66 goto error;
67
64 /* fill parameters */ 68 /* fill parameters */
65 codec->vendor_id = snd_hdac_read_parm(codec, AC_NODE_ROOT, 69 codec->vendor_id = snd_hdac_read_parm(codec, AC_NODE_ROOT,
66 AC_PAR_VENDOR_ID); 70 AC_PAR_VENDOR_ID);
@@ -139,22 +143,15 @@ int snd_hdac_device_register(struct hdac_device *codec)
139 err = device_add(&codec->dev); 143 err = device_add(&codec->dev);
140 if (err < 0) 144 if (err < 0)
141 return err; 145 return err;
142 err = snd_hdac_bus_add_device(codec->bus, codec);
143 if (err < 0)
144 goto error;
145 mutex_lock(&codec->widget_lock); 146 mutex_lock(&codec->widget_lock);
146 err = hda_widget_sysfs_init(codec); 147 err = hda_widget_sysfs_init(codec);
147 mutex_unlock(&codec->widget_lock); 148 mutex_unlock(&codec->widget_lock);
148 if (err < 0) 149 if (err < 0) {
149 goto error_remove; 150 device_del(&codec->dev);
151 return err;
152 }
150 153
151 return 0; 154 return 0;
152
153 error_remove:
154 snd_hdac_bus_remove_device(codec->bus, codec);
155 error:
156 device_del(&codec->dev);
157 return err;
158} 155}
159EXPORT_SYMBOL_GPL(snd_hdac_device_register); 156EXPORT_SYMBOL_GPL(snd_hdac_device_register);
160 157
@@ -168,8 +165,8 @@ void snd_hdac_device_unregister(struct hdac_device *codec)
168 mutex_lock(&codec->widget_lock); 165 mutex_lock(&codec->widget_lock);
169 hda_widget_sysfs_exit(codec); 166 hda_widget_sysfs_exit(codec);
170 mutex_unlock(&codec->widget_lock); 167 mutex_unlock(&codec->widget_lock);
171 snd_hdac_bus_remove_device(codec->bus, codec);
172 device_del(&codec->dev); 168 device_del(&codec->dev);
169 snd_hdac_bus_remove_device(codec->bus, codec);
173 } 170 }
174} 171}
175EXPORT_SYMBOL_GPL(snd_hdac_device_unregister); 172EXPORT_SYMBOL_GPL(snd_hdac_device_unregister);