Skip to content

Commit 2d42c03

Browse files
committed
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 <[email protected]>
1 parent be9a2e9 commit 2d42c03

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

sound/x86/intel_hdmi_audio.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,18 +1384,15 @@ static void had_process_hot_plug(struct snd_intelhad *intelhaddata)
13841384
__func__, __LINE__);
13851385
spin_unlock_irq(&intelhaddata->had_spinlock);
13861386

1387-
/* Safety check */
1387+
had_build_channel_allocation_map(intelhaddata);
1388+
1389+
/* Report to above ALSA layer */
13881390
substream = had_substream_get(intelhaddata);
13891391
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 */
13931392
snd_pcm_stop_xrun(substream);
13941393
had_substream_put(intelhaddata);
13951394
}
13961395

1397-
had_build_channel_allocation_map(intelhaddata);
1398-
13991396
snd_jack_report(intelhaddata->jack, SND_JACK_AVOUT);
14001397
}
14011398

@@ -1404,14 +1401,11 @@ static void had_process_hot_unplug(struct snd_intelhad *intelhaddata)
14041401
{
14051402
struct snd_pcm_substream *substream;
14061403

1407-
substream = had_substream_get(intelhaddata);
1408-
14091404
spin_lock_irq(&intelhaddata->had_spinlock);
1410-
14111405
if (!intelhaddata->connected) {
14121406
dev_dbg(intelhaddata->dev, "Device already disconnected\n");
14131407
spin_unlock_irq(&intelhaddata->had_spinlock);
1414-
goto out;
1408+
return;
14151409

14161410
}
14171411

@@ -1424,16 +1418,17 @@ static void had_process_hot_unplug(struct snd_intelhad *intelhaddata)
14241418
__func__, __LINE__);
14251419
spin_unlock_irq(&intelhaddata->had_spinlock);
14261420

1421+
kfree(intelhaddata->chmap->chmap);
1422+
intelhaddata->chmap->chmap = NULL;
1423+
14271424
/* Report to above ALSA layer */
1428-
if (substream)
1425+
substream = had_substream_get(intelhaddata);
1426+
if (substream) {
14291427
snd_pcm_stop_xrun(substream);
1428+
had_substream_put(intelhaddata);
1429+
}
14301430

1431-
out:
14321431
snd_jack_report(intelhaddata->jack, 0);
1433-
if (substream)
1434-
had_substream_put(intelhaddata);
1435-
kfree(intelhaddata->chmap->chmap);
1436-
intelhaddata->chmap->chmap = NULL;
14371432
}
14381433

14391434
/*

0 commit comments

Comments
 (0)