* [PATCH 2/2] sis7019: add support for pre-2.6 kernels
@ 2007-12-08 23:54 Dave Dillow
2007-12-10 7:53 ` Clemens Ladisch
0 siblings, 1 reply; 10+ messages in thread
From: Dave Dillow @ 2007-12-08 23:54 UTC (permalink / raw)
To: alsa-devel
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).
Signed-off-by: David Dillow <dave@thedillows.org>
---
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(-)
diff -r 9eda190b55c3 pci/Makefile
--- a/pci/Makefile Tue Dec 04 12:46:46 2007 +0100
+++ b/pci/Makefile Sat Dec 08 18:45:46 2007 -0500
@@ -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
diff -r 9eda190b55c3 pci/sis7019.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pci/sis7019.patch Sat Dec 08 18:45:46 2007 -0500
@@ -0,0 +1,52 @@
+--- sis7019.c.orig 2007-12-08 18:32:09.000000000 -0500
++++ sis7019.c 2007-12-08 18:31:35.000000000 -0500
+@@ -31,7 +31,17 @@
+ #include <sound/core.h>
+ #include <sound/ac97_codec.h>
+ #include <sound/initval.h>
+-#include "sis7019.h"
++#include "../alsa-kernel/pci/sis7019.h"
++
++#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
+
+ MODULE_AUTHOR("David Dillow <dave@thedillows.org>");
+ MODULE_DESCRIPTION("SiS 7019");
+@@ -290,7 +300,11 @@
+ int bit;
+
+ while (status) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
++ bit = sis_ffs(status);
++#else
+ bit = __ffs(status);
++#endif
+ status >>= bit + 1;
+ voice += bit;
+ sis_update_voice(voice);
+@@ -791,9 +805,9 @@
+
+ /* The following variables are only used if there is a timing channel.
+ */
+- u32 uninitialized_var(timing_ctrl);
+- u32 uninitialized_var(sso_eso);
+- u32 uninitialized_var(delta);
++ u32 timing_ctrl = 0;
++ u32 sso_eso = 0;
++ u32 delta = 0;
+
+ /* We rely on the PCM core to ensure that the parameters for this
+ * substream do not change on us while we're programming the HW.
+@@ -1460,3 +1474,5 @@
+
+ module_init(sis7019_init);
+ module_exit(sis7019_exit);
++
++EXPORT_NO_SYMBOLS
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 2/2] sis7019: add support for pre-2.6 kernels
2007-12-08 23:54 [PATCH 2/2] sis7019: add support for pre-2.6 kernels Dave Dillow
@ 2007-12-10 7:53 ` Clemens Ladisch
2007-12-10 14:24 ` Dave Dillow
0 siblings, 1 reply; 10+ messages in thread
From: Clemens Ladisch @ 2007-12-10 7:53 UTC (permalink / raw)
To: Dave Dillow, alsa-devel
Dave Dillow wrote:
> 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
This should go into alsa-driver/include/adriver.h.
Regards,
Clemens
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 2/2] sis7019: add support for pre-2.6 kernels
2007-12-10 7:53 ` Clemens Ladisch
@ 2007-12-10 14:24 ` Dave Dillow
2007-12-10 14:48 ` Clemens Ladisch
0 siblings, 1 reply; 10+ messages in thread
From: Dave Dillow @ 2007-12-10 14:24 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: alsa-devel
On Mon, 2007-12-10 at 08:53 +0100, Clemens Ladisch wrote:
> Dave Dillow wrote:
> > 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
>
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 2/2] sis7019: add support for pre-2.6 kernels
2007-12-10 14:24 ` Dave Dillow
@ 2007-12-10 14:48 ` Clemens Ladisch
2007-12-13 15:50 ` Takashi Iwai
0 siblings, 1 reply; 10+ messages in thread
From: Clemens Ladisch @ 2007-12-10 14:48 UTC (permalink / raw)
To: Dave Dillow; +Cc: alsa-devel
Dave Dillow wrote:
> On Mon, 2007-12-10 at 08:53 +0100, Clemens Ladisch wrote:
> > Dave Dillow wrote:
> > > 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
> >
> > 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
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 2/2] sis7019: add support for pre-2.6 kernels
2007-12-10 14:48 ` Clemens Ladisch
@ 2007-12-13 15:50 ` Takashi Iwai
2007-12-13 17:43 ` Dave Dillow
0 siblings, 1 reply; 10+ messages in thread
From: Takashi Iwai @ 2007-12-13 15:50 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: alsa-devel, Dave Dillow
At Mon, 10 Dec 2007 15:48:44 +0100,
Clemens Ladisch wrote:
>
> Dave Dillow wrote:
> > On Mon, 2007-12-10 at 08:53 +0100, Clemens Ladisch wrote:
> > > Dave Dillow wrote:
> > > > 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
> > >
> > > 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
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 2/2] sis7019: add support for pre-2.6 kernels
2007-12-13 15:50 ` Takashi Iwai
@ 2007-12-13 17:43 ` Dave Dillow
0 siblings, 0 replies; 10+ messages in thread
From: Dave Dillow @ 2007-12-13 17:43 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
On Thu, Dec 13, 2007 at 04:50:56PM +0100, Takashi Iwai wrote:
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/2] sis7019: add support for pre-2.6 kernels
@ 2007-11-28 7:19 Dave Dillow
2007-11-28 9:41 ` Takashi Iwai
0 siblings, 1 reply; 10+ messages in thread
From: Dave Dillow @ 2007-11-28 7:19 UTC (permalink / raw)
To: alsa-devel
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).
Signed-off-by: David Dillow <dave@thedillows.org>
---
This is against the alsa-driver hg repo. I've not build tested this
version, as the build system currently hates me. However, this is 95%
identical to what I was using against 1.0.13. Only the location of the
__ffs -> sis_ffs change is different.
pci/sis7019.patch | 32 ++++++++++++++++++++++++++++++++
pci/Makefile | 3 ++-
2 files changed, 34 insertions(+), 1 deletion(-)
diff -r ab42d23439ef pci/Makefile
--- a/pci/Makefile Tue Nov 27 16:05:25 2007 +0100
+++ b/pci/Makefile Wed Nov 28 01:39:04 2007 -0500
@@ -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
diff -r ab42d23439ef pci/sis7019.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pci/sis7019.patch Wed Nov 28 01:39:04 2007 -0500
@@ -0,0 +1,32 @@
+--- ../alsa-kernel/pci/sis7019.c 2007-11-28 01:02:26.000000000 -0500
++++ sis7019.c 2007-11-28 01:36:27.000000000 -0500
+@@ -33,6 +33,14 @@
+ #include <sound/initval.h>
+ #include "sis7019.h"
+
++static inline unsigned long sis_ffs(unsigned long word)
++{
++ __asm__("bsfl %1,%0"
++ :"=r" (word)
++ :"rm" (word));
++ return word;
++}
++
+ MODULE_AUTHOR("David Dillow <dave@thedillows.org>");
+ MODULE_DESCRIPTION("SiS 7019");
+ MODULE_LICENSE("GPL");
+@@ -289,7 +297,7 @@
+ int bit;
+
+ while (status) {
+- bit = __ffs(status);
++ bit = sis_ffs(status);
+ status >>= bit + 1;
+ voice += bit;
+ sis_update_voice(voice);
+@@ -1464,3 +1472,5 @@
+
+ module_init(sis7019_init);
+ module_exit(sis7019_exit);
++
++EXPORT_NO_SYMBOLS
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 2/2] sis7019: add support for pre-2.6 kernels
2007-11-28 7:19 Dave Dillow
@ 2007-11-28 9:41 ` Takashi Iwai
2007-11-28 13:18 ` Dave Dillow
0 siblings, 1 reply; 10+ messages in thread
From: Takashi Iwai @ 2007-11-28 9:41 UTC (permalink / raw)
To: Dave Dillow; +Cc: alsa-devel
At Wed, 28 Nov 2007 02:19:12 -0500,
Dave Dillow wrote:
>
> 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).
Then it'd be better to add the dependency on CONFIG_X86_32 so that it
won't be compiled on other architectures.
Also, replace __ffs() only for 2.4 kernels, e.g.
#if LINUX_VERSION_CODE >= KERNE_VERSION(2, 6, 0)
bit = __ffs(status);
#else
bit = sis_ffs(status);
#endif
Thanks,
Takashi
> Signed-off-by: David Dillow <dave@thedillows.org>
> ---
> This is against the alsa-driver hg repo. I've not build tested this
> version, as the build system currently hates me. However, this is 95%
> identical to what I was using against 1.0.13. Only the location of the
> __ffs -> sis_ffs change is different.
>
> pci/sis7019.patch | 32 ++++++++++++++++++++++++++++++++
> pci/Makefile | 3 ++-
> 2 files changed, 34 insertions(+), 1 deletion(-)
>
> diff -r ab42d23439ef pci/Makefile
> --- a/pci/Makefile Tue Nov 27 16:05:25 2007 +0100
> +++ b/pci/Makefile Wed Nov 28 01:39:04 2007 -0500
> @@ -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
> diff -r ab42d23439ef pci/sis7019.patch
> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
> +++ b/pci/sis7019.patch Wed Nov 28 01:39:04 2007 -0500
> @@ -0,0 +1,32 @@
> +--- ../alsa-kernel/pci/sis7019.c 2007-11-28 01:02:26.000000000 -0500
> ++++ sis7019.c 2007-11-28 01:36:27.000000000 -0500
> +@@ -33,6 +33,14 @@
> + #include <sound/initval.h>
> + #include "sis7019.h"
> +
> ++static inline unsigned long sis_ffs(unsigned long word)
> ++{
> ++ __asm__("bsfl %1,%0"
> ++ :"=r" (word)
> ++ :"rm" (word));
> ++ return word;
> ++}
> ++
> + MODULE_AUTHOR("David Dillow <dave@thedillows.org>");
> + MODULE_DESCRIPTION("SiS 7019");
> + MODULE_LICENSE("GPL");
> +@@ -289,7 +297,7 @@
> + int bit;
> +
> + while (status) {
> +- bit = __ffs(status);
> ++ bit = sis_ffs(status);
> + status >>= bit + 1;
> + voice += bit;
> + sis_update_voice(voice);
> +@@ -1464,3 +1472,5 @@
> +
> + module_init(sis7019_init);
> + module_exit(sis7019_exit);
> ++
> ++EXPORT_NO_SYMBOLS
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 2/2] sis7019: add support for pre-2.6 kernels
2007-11-28 9:41 ` Takashi Iwai
@ 2007-11-28 13:18 ` Dave Dillow
2007-11-28 12:56 ` Takashi Iwai
0 siblings, 1 reply; 10+ messages in thread
From: Dave Dillow @ 2007-11-28 13:18 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
On Wed, 2007-11-28 at 10:41 +0100, Takashi Iwai wrote:
> At Wed, 28 Nov 2007 02:19:12 -0500,
> Dave Dillow wrote:
> >
> > 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).
>
> Then it'd be better to add the dependency on CONFIG_X86_32 so that it
> won't be compiled on other architectures.
Doh! Of course...
> Also, replace __ffs() only for 2.4 kernels, e.g.
I'm 50/50 on this -- it doesn't hurt to just use the patched in version,
even in 2.6. I'm not fond of #ifdefs in code, and I'd need to search for
when it became available.
Then again, it is a small patch and the research isn't hard, just a bit
time consuming.
Dave
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] sis7019: add support for pre-2.6 kernels
2007-11-28 13:18 ` Dave Dillow
@ 2007-11-28 12:56 ` Takashi Iwai
0 siblings, 0 replies; 10+ messages in thread
From: Takashi Iwai @ 2007-11-28 12:56 UTC (permalink / raw)
To: Dave Dillow; +Cc: alsa-devel
At Wed, 28 Nov 2007 08:18:57 -0500,
Dave Dillow wrote:
>
> > Also, replace __ffs() only for 2.4 kernels, e.g.
>
> I'm 50/50 on this -- it doesn't hurt to just use the patched in version,
> even in 2.6. I'm not fond of #ifdefs in code, and I'd need to search for
> when it became available.
But a different code would be compiled even for the same kernel and
with the same config, between alsa-driver and kernel builds.
That's what I'd like to avoid.
> Then again, it is a small patch and the research isn't hard, just a bit
> time consuming.
__ffs() is present on all 2.6 versions. So, >= 2.6.0 should be OK.
thanks,
Takashi
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-12-13 17:43 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-08 23:54 [PATCH 2/2] sis7019: add support for pre-2.6 kernels Dave Dillow
2007-12-10 7:53 ` Clemens Ladisch
2007-12-10 14:24 ` Dave Dillow
2007-12-10 14:48 ` Clemens Ladisch
2007-12-13 15:50 ` Takashi Iwai
2007-12-13 17:43 ` Dave Dillow
-- strict thread matches above, loose matches on Subject: below --
2007-11-28 7:19 Dave Dillow
2007-11-28 9:41 ` Takashi Iwai
2007-11-28 13:18 ` Dave Dillow
2007-11-28 12:56 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox