linux-mips
[Top] [All Lists]

[PATCH 1/9] kernel: export sound/core/pcm_timer.c gcd implementation

To: linux-kernel@vger.kernel.org, Takashi Iwai <tiwai@suse.de>, akpm <akpm@linux-foundation.org>, linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>, Ingo Molnar <mingo@elte.hu>
Subject: [PATCH 1/9] kernel: export sound/core/pcm_timer.c gcd implementation
From: Florian Fainelli <florian@openwrt.org>
Date: Mon, 1 Jun 2009 13:57:09 +0200
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:date:subject :mime-version:x-uid:x-length:to:content-type :content-transfer-encoding:content-disposition:message-id; bh=9jO9s7URUGIRtgsaw4G+EAosg5/XL2zy+XcCCVlhtpI=; b=xqUzi7yOA7ybpk9o9OeKMxB9PvxxgQmTO61BwXxvShUWTq5UxegNQR0ua6Q2ltkXNJ YSiAhnAxR4UnrXuOYL0GTnDtAOybJ2BgpK/lP23W3Uk4kXxCsvrbcPd+0VgNDZH4d4lP qnoFzBIZA1uFHLnezAbeozkHWlhGQmKNTouqo=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:date:subject:mime-version:x-uid:x-length:to :content-type:content-transfer-encoding:content-disposition :message-id; b=IDGWa0450o96NOM/9QnpH38usDfTS16RCctdMdFpPTkkzTa6sWGHIp+0UZhGmaHjSL jofYC8pNV52Mam9AD94y1CacsXM2JiQraHJZvpskc7AJo3QK0IdY9sQbhs3/yoxe7dxI j/rj3pi6c0vO7Rub6791327C66JwKAECI4xNU=
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
This patch exports the gcd implementation from
sound/core/pcm_timer.c into include/linux/kernel.h.
AR7 uses it in its clock routines.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 883cd44..878a27a 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -147,6 +147,22 @@ extern int _cond_resched(void);
                (__x < 0) ? -__x : __x;         \
        })
 
+/* Greatest common divisor */
+static inline 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;
+}
+
 #ifdef CONFIG_PROVE_LOCKING
 void might_fault(void);
 #else
diff --git a/sound/core/pcm_timer.c b/sound/core/pcm_timer.c
index ca8068b..e9dbf62 100644
--- a/sound/core/pcm_timer.c
+++ b/sound/core/pcm_timer.c
@@ -20,6 +20,7 @@
  */
 
 #include <linux/time.h>
+#include <linux/kernel.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/timer.h>
@@ -28,22 +29,6 @@
  *  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;

<Prev in Thread] Current Thread [Next in Thread>