]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge branch 'fix/misc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 25 Aug 2009 16:47:06 +0000 (09:47 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 25 Aug 2009 16:47:06 +0000 (09:47 -0700)
* 'fix/misc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  sound: pcm_lib: fix unsorted list constraint handling
  sound: vx222: fix input level control range check
  ALSA: ali5451: fix timeout handling in snd_ali_{codecs,timer}_ready()

1  2 
sound/core/pcm_lib.c

diff --combined sound/core/pcm_lib.c
index 72cfd47af6b8b4196ba6a77d52002e3a52ab9e18,d8a7bb28cd83140488fe9db86fc83d5930b4c575..9db60d831bb25f67008824b18dab39bdf32b5073
@@@ -233,18 -233,6 +233,18 @@@ static int snd_pcm_update_hw_ptr_interr
                xrun(substream);
                return -EPIPE;
        }
 +      if (xrun_debug(substream, 8)) {
 +              char name[16];
 +              pcm_debug_name(substream, name, sizeof(name));
 +              snd_printd("period_update: %s: pos=0x%x/0x%x/0x%x, "
 +                         "hwptr=0x%lx, hw_base=0x%lx, hw_intr=0x%lx\n",
 +                         name, (unsigned int)pos,
 +                         (unsigned int)runtime->period_size,
 +                         (unsigned int)runtime->buffer_size,
 +                         (unsigned long)old_hw_ptr,
 +                         (unsigned long)runtime->hw_ptr_base,
 +                         (unsigned long)runtime->hw_ptr_interrupt);
 +      }
        hw_base = runtime->hw_ptr_base;
        new_hw_ptr = hw_base + pos;
        hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size;
                        delta = new_hw_ptr - hw_ptr_interrupt;
        }
        if (delta < 0) {
 -              delta += runtime->buffer_size;
 +              if (runtime->periods == 1 || new_hw_ptr < old_hw_ptr)
 +                      delta += runtime->buffer_size;
                if (delta < 0) {
                        hw_ptr_error(substream, 
                                     "Unexpected hw_pointer value "
                                     "(stream=%i, pos=%ld, intr_ptr=%ld)\n",
                                     substream->stream, (long)pos,
                                     (long)hw_ptr_interrupt);
 +#if 1
 +                      /* simply skipping the hwptr update seems more
 +                       * robust in some cases, e.g. on VMware with
 +                       * inaccurate timer source
 +                       */
 +                      return 0; /* skip this update */
 +#else
                        /* rebase to interrupt position */
                        hw_base = new_hw_ptr = hw_ptr_interrupt;
                        /* align hw_base to buffer_size */
                        hw_base -= hw_base % runtime->buffer_size;
                        delta = 0;
 +#endif
                } else {
                        hw_base += runtime->buffer_size;
                        if (hw_base >= runtime->boundary)
@@@ -365,19 -344,6 +365,19 @@@ int snd_pcm_update_hw_ptr(struct snd_pc
                xrun(substream);
                return -EPIPE;
        }
 +      if (xrun_debug(substream, 16)) {
 +              char name[16];
 +              pcm_debug_name(substream, name, sizeof(name));
 +              snd_printd("hw_update: %s: pos=0x%x/0x%x/0x%x, "
 +                         "hwptr=0x%lx, hw_base=0x%lx, hw_intr=0x%lx\n",
 +                         name, (unsigned int)pos,
 +                         (unsigned int)runtime->period_size,
 +                         (unsigned int)runtime->buffer_size,
 +                         (unsigned long)old_hw_ptr,
 +                         (unsigned long)runtime->hw_ptr_base,
 +                         (unsigned long)runtime->hw_ptr_interrupt);
 +      }
 +
        hw_base = runtime->hw_ptr_base;
        new_hw_ptr = hw_base + pos;
  
@@@ -943,47 -909,24 +943,24 @@@ static int snd_interval_ratden(struct s
  int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask)
  {
          unsigned int k;
-       int changed = 0;
+       struct snd_interval list_range;
  
        if (!count) {
                i->empty = 1;
                return -EINVAL;
        }
+       snd_interval_any(&list_range);
+       list_range.min = UINT_MAX;
+       list_range.max = 0;
          for (k = 0; k < count; k++) {
                if (mask && !(mask & (1 << k)))
                        continue;
-                 if (i->min == list[k] && !i->openmin)
-                         goto _l1;
-                 if (i->min < list[k]) {
-                         i->min = list[k];
-                       i->openmin = 0;
-                       changed = 1;
-                         goto _l1;
-                 }
-         }
-         i->empty = 1;
-         return -EINVAL;
-  _l1:
-         for (k = count; k-- > 0;) {
-               if (mask && !(mask & (1 << k)))
+               if (!snd_interval_test(i, list[k]))
                        continue;
-                 if (i->max == list[k] && !i->openmax)
-                         goto _l2;
-                 if (i->max > list[k]) {
-                         i->max = list[k];
-                       i->openmax = 0;
-                       changed = 1;
-                         goto _l2;
-                 }
+               list_range.min = min(list_range.min, list[k]);
+               list_range.max = max(list_range.max, list[k]);
          }
-         i->empty = 1;
-         return -EINVAL;
-  _l2:
-       if (snd_interval_checkempty(i)) {
-               i->empty = 1;
-               return -EINVAL;
-       }
-         return changed;
+       return snd_interval_refine(i, &list_range);
  }
  
  EXPORT_SYMBOL(snd_interval_list);