[alsa-devel] [PATCH v3 2/2] sis7019: add support to driver package

Dave Dillow dave at thedillows.org
Fri Dec 14 05:06:55 CET 2007


The sis7019 driver uses __ffs(), which first became available in kernel
2.5.2.6.  This adds that compatibility function for x86 to adriver.h,
and adds a more useful error message for other platforms that try to use
it. 

Signed-off-by: David Dillow <dave at thedillows.org>
---
This is against the alsa-driver hg repo. It builds against 2.6.23, but
I've not tested against earlier versions.

 pci/sis7019.c     |    2 ++
 include/adriver.h |   18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

diff -r 9eda190b55c3 include/adriver.h
--- a/include/adriver.h	Tue Dec 04 12:46:46 2007 +0100
+++ b/include/adriver.h	Thu Dec 13 22:50:16 2007 -0500
@@ -1445,4 +1445,22 @@ static inline unsigned char snd_pci_revi
 #endif
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 3)
+#if defined(__i386__)
+static inline unsigned long __ffs(unsigned long word)
+{
+	__asm__("bsfl %1,%0"
+		:"=r" (word)
+		:"rm" (word));
+	return word;
+}
+#else
+static inline unsigned long __ffs(unsigned long word)
+{
+	__asm__("need_asm_for_your_arch_in_adriver.h");
+	return word;
+}
+#endif
+#endif
+
 #endif /* __SOUND_LOCAL_DRIVER_H */
diff -r 9eda190b55c3 pci/sis7019.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pci/sis7019.c	Thu Dec 13 22:50:16 2007 -0500
@@ -0,0 +1,2 @@
+#include "../alsa-kernel/pci/sis7019.c"
+EXPORT_NO_SYMBOLS;



More information about the Alsa-devel mailing list