Skip to content

Commit

Permalink
Revert "bcm2835: do not require substream for accessing chmap ctl"
Browse files Browse the repository at this point in the history
This reverts commit a05b481.
  • Loading branch information
popcornmix authored and Thadeu Lima de Souza Cascardo committed Jun 26, 2017
1 parent b5f29ee commit bbe5cbd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sound/arm/bcm2835-ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,8 @@ static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol,
{
struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
bcm2835_chip_t *chip = info->private_data;
unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx);
struct cea_channel_speaker_allocation *ch = NULL;
int res = 0;
int cur = 0;
Expand All @@ -497,6 +499,11 @@ static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol,
if (mutex_lock_interruptible(&chip->audio_mutex))
return -EINTR;

if (!substream || !substream->runtime) {
res = -ENODEV;
goto unlock;
}

for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) {
if (channel_allocations[i].ca_index == chip->cea_chmap)
ch = &channel_allocations[i];
Expand All @@ -514,6 +521,7 @@ static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol,
while (cur < 8)
ucontrol->value.integer.value[cur++] = SNDRV_CHMAP_NA;

unlock:
mutex_unlock(&chip->audio_mutex);
return res;
}
Expand All @@ -533,7 +541,7 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol,
return -EINTR;

if (!substream || !substream->runtime) {
/* ignore and return success for the sake of alsactl */
res = -ENODEV;
goto unlock;
}

Expand Down

0 comments on commit bbe5cbd

Please sign in to comment.