summaryrefslogtreecommitdiffstats
path: root/sound/x86
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-02-15 16:08:21 -0500
committerTakashi Iwai <tiwai@suse.de>2017-02-16 03:22:44 -0500
commit2d42c033aec9f8e7e175c551ae62ea3f4dc200b9 (patch)
tree1eebd5ec887e0824cc5d4ed6e94ec1b8f6b72db1 /sound/x86
parentbe9a2e933e301bec856d526516801e14247519c5 (diff)
ALSA: x86: Minor code rearrangement
Put the stuff in the right order; notification should be at the end of the action. Also dropped a superfluous debug print and incorrect comments. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/x86')
-rw-r--r--sound/x86/intel_hdmi_audio.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c
index 8d67031e8429..dd3baabd1e82 100644
--- a/sound/x86/intel_hdmi_audio.c
+++ b/sound/x86/intel_hdmi_audio.c
@@ -1384,18 +1384,15 @@ static void had_process_hot_plug(struct snd_intelhad *intelhaddata)
1384 __func__, __LINE__); 1384 __func__, __LINE__);
1385 spin_unlock_irq(&intelhaddata->had_spinlock); 1385 spin_unlock_irq(&intelhaddata->had_spinlock);
1386 1386
1387 /* Safety check */ 1387 had_build_channel_allocation_map(intelhaddata);
1388
1389 /* Report to above ALSA layer */
1388 substream = had_substream_get(intelhaddata); 1390 substream = had_substream_get(intelhaddata);
1389 if (substream) { 1391 if (substream) {
1390 dev_dbg(intelhaddata->dev,
1391 "Force to stop the active stream by disconnection\n");
1392 /* Set runtime->state to hw_params done */
1393 snd_pcm_stop_xrun(substream); 1392 snd_pcm_stop_xrun(substream);
1394 had_substream_put(intelhaddata); 1393 had_substream_put(intelhaddata);
1395 } 1394 }
1396 1395
1397 had_build_channel_allocation_map(intelhaddata);
1398
1399 snd_jack_report(intelhaddata->jack, SND_JACK_AVOUT); 1396 snd_jack_report(intelhaddata->jack, SND_JACK_AVOUT);
1400} 1397}
1401 1398
@@ -1404,14 +1401,11 @@ static void had_process_hot_unplug(struct snd_intelhad *intelhaddata)
1404{ 1401{
1405 struct snd_pcm_substream *substream; 1402 struct snd_pcm_substream *substream;
1406 1403
1407 substream = had_substream_get(intelhaddata);
1408
1409 spin_lock_irq(&intelhaddata->had_spinlock); 1404 spin_lock_irq(&intelhaddata->had_spinlock);
1410
1411 if (!intelhaddata->connected) { 1405 if (!intelhaddata->connected) {
1412 dev_dbg(intelhaddata->dev, "Device already disconnected\n"); 1406 dev_dbg(intelhaddata->dev, "Device already disconnected\n");
1413 spin_unlock_irq(&intelhaddata->had_spinlock); 1407 spin_unlock_irq(&intelhaddata->had_spinlock);
1414 goto out; 1408 return;
1415 1409
1416 } 1410 }
1417 1411
@@ -1424,16 +1418,17 @@ static void had_process_hot_unplug(struct snd_intelhad *intelhaddata)
1424 __func__, __LINE__); 1418 __func__, __LINE__);
1425 spin_unlock_irq(&intelhaddata->had_spinlock); 1419 spin_unlock_irq(&intelhaddata->had_spinlock);
1426 1420
1421 kfree(intelhaddata->chmap->chmap);
1422 intelhaddata->chmap->chmap = NULL;
1423
1427 /* Report to above ALSA layer */ 1424 /* Report to above ALSA layer */
1428 if (substream) 1425 substream = had_substream_get(intelhaddata);
1426 if (substream) {
1429 snd_pcm_stop_xrun(substream); 1427 snd_pcm_stop_xrun(substream);
1428 had_substream_put(intelhaddata);
1429 }
1430 1430
1431 out:
1432 snd_jack_report(intelhaddata->jack, 0); 1431 snd_jack_report(intelhaddata->jack, 0);
1433 if (substream)
1434 had_substream_put(intelhaddata);
1435 kfree(intelhaddata->chmap->chmap);
1436 intelhaddata->chmap->chmap = NULL;
1437} 1432}
1438 1433
1439/* 1434/*