[alsa-devel] trouble compiling alsa-drivers

Takashi Iwai tiwai at suse.de
Mon Aug 6 14:14:46 CEST 2007


At Fri, 3 Aug 2007 15:34:33 -0700,
Wallace, Brooke wrote:
> 
> Ok, I think I see what the problem is...
> 
> Adriver.h is including <linux/spinlock.h>. This file defines
> DEFINE_SPINLOCK, but CONFIG_SMP is defined so RW_LOCK_UNLOCKED nerver
> gets defined which DEFINE_SPINLOCK uses.

You mean DEFINE_RWLOCK?  Is it anywhere defined at all?

> Seems like asm/spinlock.h gets
> included for SMP, but this file is empty on my system. Has anyone
> compiled with SMP before? Or is my kernel just hacked badly by Redhat?
> Still, it makes me wonder because they have some version of Alsa
> compiled in already...
> 
> /usr/src/kernels/2.6.9-34.EL-smp-i686/include/linux/spinlock.h
> 
> /*
>  * If CONFIG_SMP is set, pull in the _raw_* definitions
>  */
> #ifdef CONFIG_SMP
> #include <asm/spinlock.h>
> 
> [brooke] Stuff Omitted...
> 
> #else
> 
> [brooke] *********** NEVER GETS HERE ******************
> 
> /* RW spinlocks: No debug version */
> 
> #if (__GNUC__ > 2)
>   typedef struct { } rwlock_t;
>   #define RW_LOCK_UNLOCKED (rwlock_t) { }
> #else
>   typedef struct { int gcc_is_buggy; } rwlock_t;
>   #define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
> #endif
> 
> [brooke] More stuff ...
> 
> #endif /* !SMP */
> 
> /*
>  * Define the various spin_lock and rw_lock methods.  Note we define
> these
>  * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The
> various
>  * methods are defined as nops in the case they are not required.
>  */
> #define spin_trylock(lock)      _spin_trylock(lock)
> #define write_trylock(lock)     _write_trylock(lock)
> 
> [brooke] Now RW_LOCK_UNLOCKED is not defined.
> 
> #define DEFINE_SPINLOCK(x)      spinlock_t x = SPIN_LOCK_UNLOCKED
> #define DEFINE_RWLOCK(x)        rw_lock_t x = RW_LOCK_UNLOCKED
> 
> 
> Can I just fix this by defining RW_LOCK_UNLOCKED in adriver.h or am I
> going to get into trouble down the line? Maybe a better route would be
> to switch to a known working kernel and not use SMP for my test system?

First check whether DEFINE_RWLOCK is defined any place in
include/linux and include/asm-*.  If yes, that header file should be
included.  If it's defined nowhere, we'll need cook up by ourselves.


Takashi


More information about the Alsa-devel mailing list