diff options
-rw-r--r-- | sound/pci/hda/hda_codec.c | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index f2ccb39a3788..6fecf57c8d7c 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -1191,28 +1191,6 @@ void snd_hda_codec_cleanup_for_unbind(struct hda_codec *codec) | |||
1191 | remove_conn_list(codec); | 1191 | remove_conn_list(codec); |
1192 | } | 1192 | } |
1193 | 1193 | ||
1194 | static void snd_hda_codec_free(struct hda_codec *codec) | ||
1195 | { | ||
1196 | if (!codec) | ||
1197 | return; | ||
1198 | codec->in_freeing = 1; | ||
1199 | if (device_is_registered(hda_codec_dev(codec))) | ||
1200 | device_del(hda_codec_dev(codec)); | ||
1201 | free_init_pincfgs(codec); | ||
1202 | list_del(&codec->list); | ||
1203 | codec->bus->caddr_tbl[codec->addr] = NULL; | ||
1204 | clear_bit(codec->addr, &codec->bus->codec_powered); | ||
1205 | snd_hda_sysfs_clear(codec); | ||
1206 | free_hda_cache(&codec->amp_cache); | ||
1207 | free_hda_cache(&codec->cmd_cache); | ||
1208 | kfree(codec->vendor_name); | ||
1209 | kfree(codec->chip_name); | ||
1210 | kfree(codec->modelname); | ||
1211 | kfree(codec->wcaps); | ||
1212 | codec->bus->num_codecs--; | ||
1213 | put_device(hda_codec_dev(codec)); | ||
1214 | } | ||
1215 | |||
1216 | static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, | 1194 | static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, |
1217 | hda_nid_t fg, unsigned int power_state); | 1195 | hda_nid_t fg, unsigned int power_state); |
1218 | 1196 | ||
@@ -1241,14 +1219,32 @@ static int snd_hda_codec_dev_disconnect(struct snd_device *device) | |||
1241 | 1219 | ||
1242 | static int snd_hda_codec_dev_free(struct snd_device *device) | 1220 | static int snd_hda_codec_dev_free(struct snd_device *device) |
1243 | { | 1221 | { |
1244 | snd_hda_codec_free(device->device_data); | 1222 | struct hda_codec *codec = device->device_data; |
1223 | |||
1224 | codec->in_freeing = 1; | ||
1225 | if (device_is_registered(hda_codec_dev(codec))) | ||
1226 | device_del(hda_codec_dev(codec)); | ||
1227 | put_device(hda_codec_dev(codec)); | ||
1245 | return 0; | 1228 | return 0; |
1246 | } | 1229 | } |
1247 | 1230 | ||
1248 | /* just free the container */ | ||
1249 | static void snd_hda_codec_dev_release(struct device *dev) | 1231 | static void snd_hda_codec_dev_release(struct device *dev) |
1250 | { | 1232 | { |
1251 | kfree(dev_to_hda_codec(dev)); | 1233 | struct hda_codec *codec = dev_to_hda_codec(dev); |
1234 | |||
1235 | free_init_pincfgs(codec); | ||
1236 | list_del(&codec->list); | ||
1237 | codec->bus->caddr_tbl[codec->addr] = NULL; | ||
1238 | clear_bit(codec->addr, &codec->bus->codec_powered); | ||
1239 | snd_hda_sysfs_clear(codec); | ||
1240 | free_hda_cache(&codec->amp_cache); | ||
1241 | free_hda_cache(&codec->cmd_cache); | ||
1242 | kfree(codec->vendor_name); | ||
1243 | kfree(codec->chip_name); | ||
1244 | kfree(codec->modelname); | ||
1245 | kfree(codec->wcaps); | ||
1246 | codec->bus->num_codecs--; | ||
1247 | kfree(codec); | ||
1252 | } | 1248 | } |
1253 | 1249 | ||
1254 | /** | 1250 | /** |
@@ -1362,7 +1358,7 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card, | |||
1362 | 1358 | ||
1363 | setup_fg_nodes(codec); | 1359 | setup_fg_nodes(codec); |
1364 | if (!codec->afg && !codec->mfg) { | 1360 | if (!codec->afg && !codec->mfg) { |
1365 | dev_err(card->dev, "no AFG or MFG node found\n"); | 1361 | codec_err(codec, "no AFG or MFG node found\n"); |
1366 | err = -ENODEV; | 1362 | err = -ENODEV; |
1367 | goto error; | 1363 | goto error; |
1368 | } | 1364 | } |
@@ -1408,7 +1404,7 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card, | |||
1408 | return 0; | 1404 | return 0; |
1409 | 1405 | ||
1410 | error: | 1406 | error: |
1411 | snd_hda_codec_free(codec); | 1407 | put_device(hda_codec_dev(codec)); |
1412 | return err; | 1408 | return err; |
1413 | } | 1409 | } |
1414 | EXPORT_SYMBOL_GPL(snd_hda_codec_new); | 1410 | EXPORT_SYMBOL_GPL(snd_hda_codec_new); |
@@ -2464,7 +2460,6 @@ void snd_hda_unlock_devices(struct hda_bus *bus) | |||
2464 | { | 2460 | { |
2465 | struct snd_card *card = bus->card; | 2461 | struct snd_card *card = bus->card; |
2466 | 2462 | ||
2467 | card = bus->card; | ||
2468 | spin_lock(&card->files_lock); | 2463 | spin_lock(&card->files_lock); |
2469 | card->shutdown = 0; | 2464 | card->shutdown = 0; |
2470 | spin_unlock(&card->files_lock); | 2465 | spin_unlock(&card->files_lock); |