[PATCH] Don't define gcd() when already exists

Takashi Iwai tiwai at suse.de
Sat Dec 26 12:29:34 CET 2009


Define compatible gcd() only when linux/gcd. doesn't exist.
CONFIG_GCD isn't defined for 2.6.31/32, so it can'be used reliablty
as the compile condition.

Reported-by: Ozan Çağlayan <ozan at pardus.org.tr>
Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
 acore/wrappers.c     |    3 +++
 include/gcd_compat.h |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/acore/wrappers.c b/acore/wrappers.c
index e9478bd..68750a7 100644
--- a/acore/wrappers.c
+++ b/acore/wrappers.c
@@ -340,6 +340,8 @@ EXPORT_SYMBOL(compat_skip_spaces);
 #endif /* < 2.6.33 */
 
 #ifndef CONFIG_GCD
+#include <linux/gcd.h>
+#ifdef CONFIG_SND_COMPAT_GCD
 /* Greatest common divisor */
 unsigned long gcd(unsigned long a, unsigned long b)
 {
@@ -356,4 +358,5 @@ unsigned long gcd(unsigned long a, unsigned long b)
 	return b;
 }
 EXPORT_SYMBOL(gcd);
+#endif /* CONFIG_SND_COMPAT_GCD */
 #endif /* !CONFIG_GCD */
diff --git a/include/gcd_compat.h b/include/gcd_compat.h
index beeda05..daedab1 100644
--- a/include/gcd_compat.h
+++ b/include/gcd_compat.h
@@ -1,6 +1,7 @@
 #ifndef _LINUX_GCD_H
 #define _LINUX_GCD_H
 
+#define CONFIG_SND_COMPAT_GCD
 unsigned long gcd(unsigned long a, unsigned long b);
 
 #endif /* _LINUX_GCD_H */
-- 
1.6.5.7



More information about the Alsa-devel mailing list