Merge branch 'liblockdep-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / sound / core / pcm_timer.c
index ca8068b63d6c1bc413d16a2309d7d33fbe378893..20ecd8f180808cf62b0b129902e3f89f7a59e5ff 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/time.h>
+#include <linux/gcd.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/timer.h>
  *  Timer functions
  */
 
-/* Greatest common divisor */
-static unsigned long gcd(unsigned long a, unsigned long b)
-{
-       unsigned long r;
-       if (a < b) {
-               r = a;
-               a = b;
-               b = r;
-       }
-       while ((r = a % b) != 0) {
-               a = b;
-               b = r;
-       }
-       return b;
-}
-
 void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream)
 {
        unsigned long rate, mult, fsize, l, post;
@@ -68,7 +53,9 @@ void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream)
                post *= 2;
        }
        if (rate == 0) {
-               snd_printk(KERN_ERR "pcm timer resolution out of range (rate = %u, period_size = %lu)\n", runtime->rate, runtime->period_size);
+               pcm_err(substream->pcm,
+                       "pcm timer resolution out of range (rate = %u, period_size = %lu)\n",
+                       runtime->rate, runtime->period_size);
                runtime->timer_resolution = -1;
                return;
        }