Skip to content

Commit ce780a4

Browse files
arnopobroonie
authored andcommitted
ASoC: sti: fix possible sleep-in-atomic
Change mutex and spinlock management to avoid sleep in atomic issue. Signed-off-by: Arnaud Pouliquen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent e0beec8 commit ce780a4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sound/soc/sti/uniperif_player.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ static void uni_player_set_channel_status(struct uniperif *player,
226226
* sampling frequency. If no sample rate is already specified, then
227227
* set one.
228228
*/
229-
mutex_lock(&player->ctrl_lock);
230229
if (runtime) {
231230
switch (runtime->rate) {
232231
case 22050:
@@ -303,7 +302,6 @@ static void uni_player_set_channel_status(struct uniperif *player,
303302
player->stream_settings.iec958.status[3 + (n * 4)] << 24;
304303
SET_UNIPERIF_CHANNEL_STA_REGN(player, n, status);
305304
}
306-
mutex_unlock(&player->ctrl_lock);
307305

308306
/* Update the channel status */
309307
if (player->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0)
@@ -365,8 +363,10 @@ static int uni_player_prepare_iec958(struct uniperif *player,
365363

366364
SET_UNIPERIF_CTRL_ZERO_STUFF_HW(player);
367365

366+
mutex_lock(&player->ctrl_lock);
368367
/* Update the channel status */
369368
uni_player_set_channel_status(player, runtime);
369+
mutex_unlock(&player->ctrl_lock);
370370

371371
/* Clear the user validity user bits */
372372
SET_UNIPERIF_USER_VALIDITY_VALIDITY_LR(player, 0);
@@ -598,7 +598,6 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol,
598598
iec958->status[1] = ucontrol->value.iec958.status[1];
599599
iec958->status[2] = ucontrol->value.iec958.status[2];
600600
iec958->status[3] = ucontrol->value.iec958.status[3];
601-
mutex_unlock(&player->ctrl_lock);
602601

603602
spin_lock_irqsave(&player->irq_lock, flags);
604603
if (player->substream && player->substream->runtime)
@@ -608,6 +607,8 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol,
608607
uni_player_set_channel_status(player, NULL);
609608

610609
spin_unlock_irqrestore(&player->irq_lock, flags);
610+
mutex_unlock(&player->ctrl_lock);
611+
611612
return 0;
612613
}
613614

0 commit comments

Comments
 (0)