public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <florian@openwrt.org>
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
Date: Mon, 1 Jun 2009 13:57:09 +0200	[thread overview]
Message-ID: <200906011357.09966.florian@openwrt.org> (raw)

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;

             reply	other threads:[~2009-06-01 11:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-01 11:57 Florian Fainelli [this message]
2009-06-02  4:50 ` [PATCH 1/9] kernel: export sound/core/pcm_timer.c gcd implementation Andrew Morton
2009-06-02  7:15   ` Geert Uytterhoeven
2009-06-02  7:19   ` Florian Fainelli
2009-06-02  7:26     ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200906011357.09966.florian@openwrt.org \
    --to=florian@openwrt.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=mingo@elte.hu \
    --cc=ralf@linux-mips.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox