Skip to contentSkip to conversation

sis7019: add support for pre-2.6 kernels

PATCH Superseded Dave Dillow 3 participants 6 messages Dec 8, 2007 – Dec 13, 2007

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 sis7019: add support for pre-2.6 kernels

The sis7019 driver uses __ffs(), which is available in 2.6 kernels, but not in most earlier ones. This patches the driver to use a local version assembly version, as the hardware is SiS 55x only (i486/Pentium-ish).

---
This is against the alsa-driver hg repo. It has been compiled and tested under 2.6.23.

 pci/sis7019.patch   |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 pci/Makefile        |    3 ++-
 2 files changed, 54 insertions(+), 1 deletion(-)
pci/Makefile +2 -1
diff -r 9eda190b55c3 pci/Makefile
@@ -10,7 +10,7 @@ include $(SND_TOPDIR)/Makefile.conf
 #
 
 clean-files := ad1889.c atiixp.c atiixp_modem.c bt87x.c cmipci.c ens1370.c \
-	fm801.c intel8x0.c maestro3.c via82xx.c via82xx_modem.c
+	fm801.c intel8x0.c maestro3.c sis7019.c via82xx.c via82xx_modem.c
 
 obj-$(CONFIG_SND) += pdplus/ asihpi/ oxygen/
 
@@ -31,5 +31,6 @@ fm801.c: fm801.patch $(SND_TOPDIR)/alsa-
 fm801.c: fm801.patch $(SND_TOPDIR)/alsa-kernel/pci/fm801.c
 intel8x0.c: intel8x0.patch $(SND_TOPDIR)/alsa-kernel/pci/intel8x0.c
 maestro3.c: maestro3.patch $(SND_TOPDIR)/alsa-kernel/pci/maestro3.c
+sis7019.c: sis7019.patch $(SND_TOPDIR)/alsa-kernel/pci/sis7019.c
 via82xx.c: via82xx.patch $(SND_TOPDIR)/alsa-kernel/pci/via82xx.c
 via82xx_modem.c: via82xx_modem.patch $(SND_TOPDIR)/alsa-kernel/pci/via82xx_modem.c
pci/sis7019.patch new file +52 -0

52 lines not on this page · raw message

#1 lore raw
Quoted 4 lines · Dave Dillow

The sis7019 driver uses __ffs(), which is available in 2.6 kernels, but not in most earlier ones. This patches the driver to use a local version assembly version, as the hardware is SiS 55x only (i486/Pentium-ish).

Quoted 9 lines

++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++static inline unsigned long sis_ffs(unsigned long word) ++{
++ __asm__("bsfl %1,%0"
++ :"=r" (word)
++ :"rm" (word));
++ return word;
++}
++#endif

This should go into alsa-driver/include/adriver.h.

Regards,
Clemens

#2 lore raw
Quoted 15 lines · Clemens Ladisch
Quoted 4 lines · Dave Dillow

The sis7019 driver uses __ffs(), which is available in 2.6 kernels, but not in most earlier ones. This patches the driver to use a local version assembly version, as the hardware is SiS 55x only (i486/Pentium-ish).

Quoted 9 lines

++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++static inline unsigned long sis_ffs(unsigned long word) ++{
++ __asm__("bsfl %1,%0"
++ :"=r" (word)
++ :"rm" (word));
++ return word;
++}
++#endif

Quoted 1 line

This should go into alsa-driver/include/adriver.h.

I'm not sure -- there's no other inline assembly there, and if I provide an x86 _ffs() fallback, then it'll break on other architectures...

I suppose I could put a generic implementation there, but I'd rather take advantage of the hardware I'm on -- which will always be x86 for this driver.

Dave

#3 lore raw
Quoted 16 lines · Dave Dillow
Quoted 15 lines · Clemens Ladisch
Quoted 13 lines · Dave Dillow

The sis7019 driver uses __ffs(), which is available in 2.6 kernels, but not in most earlier ones. This patches the driver to use a local version assembly version, as the hardware is SiS 55x only (i486/Pentium-ish).

++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++static inline unsigned long sis_ffs(unsigned long word) ++{
++ __asm__("bsfl %1,%0"
++ :"=r" (word)
++ :"rm" (word));
++ return word;
++}
++#endif

Quoted 4 lines
Quoted 1 line

This should go into alsa-driver/include/adriver.h.

I'm not sure -- there's no other inline assembly there, and if I provide an x86 _ffs() fallback, then it'll break on other architectures...

It won't break unless another driver actually uses __ffs(), and then we can still add a generic implementation.

Regards,
Clemens

#4 lore raw

At Mon, 10 Dec 2007 15:48:44 +0100,

Quoted 18 lines · Clemens Ladisch
Quoted 16 lines · Dave Dillow
Quoted 15 lines · Clemens Ladisch
Quoted 13 lines · Dave Dillow

The sis7019 driver uses __ffs(), which is available in 2.6 kernels, but not in most earlier ones. This patches the driver to use a local version assembly version, as the hardware is SiS 55x only (i486/Pentium-ish).

++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++static inline unsigned long sis_ffs(unsigned long word) ++{
++ __asm__("bsfl %1,%0"
++ :"=r" (word)
++ :"rm" (word));
++ return word;
++}
++#endif

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

This should go into alsa-driver/include/adriver.h.

I'm not sure -- there's no other inline assembly there, and if I provide an x86 _ffs() fallback, then it'll break on other architectures...

It won't break unless another driver actually uses __ffs(), and then we can still add a generic implementation.

Yep, it seems so. The invalid asm codes becomes an error only at assembler -> binary level, so it's harmless unless it's really used in the driver code.

Anyway, uninitialized_var() should be ported to adriver.h as well. Then we'll have a clean sis7019.c in alsa-driver tree, too.

Takashi

#5 lore raw
Quoted 6 lines · Takashi Iwai

Yep, it seems so. The invalid asm codes becomes an error only at assembler -> binary level, so it's harmless unless it's really used in the driver code.

Anyway, uninitialized_var() should be ported to adriver.h as well. Then we'll have a clean sis7019.c in alsa-driver tree, too.

I'll do the ffs() as suggested, but I rewrote the area that had the uninitialized_var(), so I don't need them any longer.

Dave