All of lore.kernel.org
 help / color / mirror / Atom feed
* CONFIG_GCD is never defined in the latest alsa-driver
@ 2009-12-26 10:55 Ozan Çağlayan
  2009-12-26 10:58 ` Ozan Çağlayan
  2009-12-26 11:36 ` Takashi Iwai
  0 siblings, 2 replies; 4+ messages in thread
From: Ozan Çağlayan @ 2009-12-26 10:55 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwa >> Takashi Iwai

Hi,

Compiling the latest alsa-driver with kernel > 2.6.31 results in gcd()
symbol duplication. Although there's a check in configure for
linux/gcd.h, no boolean is adjusted according to that.

In acore/wrappers.c, gcd() is exported if CONFIG_GCD is not defined
which seems always the case for now.

Something like the following fixes the problem for me:

Index: alsa-driver/acore/wrappers.c
===================================================================
--- alsa-driver.orig/acore/wrappers.c
+++ alsa-driver/acore/wrappers.c
@@ -339,7 +339,7 @@ char *compat_skip_spaces(const char *str
 EXPORT_SYMBOL(compat_skip_spaces);
 #endif /* < 2.6.33 */

-#ifndef CONFIG_GCD
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
 /* Greatest common divisor */
 unsigned long gcd(unsigned long a, unsigned long b)
 {
@@ -356,4 +356,4 @@ unsigned long gcd(unsigned long a, unsig
    return b;
 }
 EXPORT_SYMBOL(gcd);
-#endif /* !CONFIG_GCD */
+#endif

Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: CONFIG_GCD is never defined in the latest alsa-driver
  2009-12-26 10:55 CONFIG_GCD is never defined in the latest alsa-driver Ozan Çağlayan
@ 2009-12-26 10:58 ` Ozan Çağlayan
  2009-12-26 11:36 ` Takashi Iwai
  1 sibling, 0 replies; 4+ messages in thread
From: Ozan Çağlayan @ 2009-12-26 10:58 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwa >> Takashi Iwai

Ozan Çağlayan wrote:
> Hi,
>
> Compiling the latest alsa-driver with kernel > 2.6.31 results in gcd()
>   
that should be "with kernel >= 2.6.31"

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: CONFIG_GCD is never defined in the latest alsa-driver
  2009-12-26 10:55 CONFIG_GCD is never defined in the latest alsa-driver Ozan Çağlayan
  2009-12-26 10:58 ` Ozan Çağlayan
@ 2009-12-26 11:36 ` Takashi Iwai
  2009-12-26 12:04   ` Ozan Çağlayan
  1 sibling, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2009-12-26 11:36 UTC (permalink / raw)
  To: Ozan Çağlayan; +Cc: alsa-devel

At Sat, 26 Dec 2009 12:55:24 +0200,
Ozan Çağlayan wrote:
> 
> Hi,
> 
> Compiling the latest alsa-driver with kernel > 2.6.31 results in gcd()
> symbol duplication. Although there's a check in configure for
> linux/gcd.h, no boolean is adjusted according to that.
> 
> In acore/wrappers.c, gcd() is exported if CONFIG_GCD is not defined
> which seems always the case for now.

CONFIG_GCD looks new indeed.  For 2.6.31 and 32, we need more check.
I applied the following fix instead in case linux/gcd.h is defined
by vendor kernels.


thanks,

Takashi

===
From 68c3169b5f9aec19ade5a5619ee3dfa4be676855 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Sat, 26 Dec 2009 12:29:34 +0100
Subject: [PATCH] Don't define gcd() when already exists
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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@pardus.org.tr>
Signed-off-by: Takashi Iwai <tiwai@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

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: CONFIG_GCD is never defined in the latest alsa-driver
  2009-12-26 11:36 ` Takashi Iwai
@ 2009-12-26 12:04   ` Ozan Çağlayan
  0 siblings, 0 replies; 4+ messages in thread
From: Ozan Çağlayan @ 2009-12-26 12:04 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Takashi Iwai wrote:
> CONFIG_GCD looks new indeed.  For 2.6.31 and 32, we need more check.
> I applied the following fix instead in case linux/gcd.h is defined
> by vendor kernels.
>   

Tested and works well, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-26 12:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-26 10:55 CONFIG_GCD is never defined in the latest alsa-driver Ozan Çağlayan
2009-12-26 10:58 ` Ozan Çağlayan
2009-12-26 11:36 ` Takashi Iwai
2009-12-26 12:04   ` Ozan Çağlayan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.