0311-Revert-bcm2835-do-not-require-substream-for-accessin.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From 9c6c1cef21569d9a0ef62b7d621f864e5db89994 Mon Sep 17 00:00:00 2001
  2. From: popcornmix <popcornmix@gmail.com>
  3. Date: Fri, 29 Apr 2016 17:27:36 +0100
  4. Subject: [PATCH] Revert "bcm2835: do not require substream for accessing chmap
  5. ctl"
  6. This reverts commit a05b4815196018c329ea98c24205bc6fa9c097e0.
  7. ---
  8. sound/arm/bcm2835-ctl.c | 10 +++++++++-
  9. 1 file changed, 9 insertions(+), 1 deletion(-)
  10. --- a/sound/arm/bcm2835-ctl.c
  11. +++ b/sound/arm/bcm2835-ctl.c
  12. @@ -489,6 +489,8 @@ static int snd_bcm2835_chmap_ctl_get(str
  13. {
  14. struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
  15. bcm2835_chip_t *chip = info->private_data;
  16. + unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
  17. + struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx);
  18. struct cea_channel_speaker_allocation *ch = NULL;
  19. int res = 0;
  20. int cur = 0;
  21. @@ -497,6 +499,11 @@ static int snd_bcm2835_chmap_ctl_get(str
  22. if (mutex_lock_interruptible(&chip->audio_mutex))
  23. return -EINTR;
  24. + if (!substream || !substream->runtime) {
  25. + res = -ENODEV;
  26. + goto unlock;
  27. + }
  28. +
  29. for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) {
  30. if (channel_allocations[i].ca_index == chip->cea_chmap)
  31. ch = &channel_allocations[i];
  32. @@ -514,6 +521,7 @@ static int snd_bcm2835_chmap_ctl_get(str
  33. while (cur < 8)
  34. ucontrol->value.integer.value[cur++] = SNDRV_CHMAP_NA;
  35. +unlock:
  36. mutex_unlock(&chip->audio_mutex);
  37. return res;
  38. }
  39. @@ -533,7 +541,7 @@ static int snd_bcm2835_chmap_ctl_put(str
  40. return -EINTR;
  41. if (!substream || !substream->runtime) {
  42. - /* ignore and return success for the sake of alsactl */
  43. + res = -ENODEV;
  44. goto unlock;
  45. }