i8253 locking and PC speaker on non-{mips,x86}

From: Ralf Baechle
Date: Sat May 28 2011 - 07:21:37 EST


No longer terribly relevant these days but ...

drivers/input/misc/pcspkr.c:

#if defined(CONFIG_MIPS) || defined(CONFIG_X86)
/* Use the global PIT lock ! */
#include <asm/i8253.h>
#else
#include <asm/8253pit.h>
static DEFINE_RAW_SPINLOCK(i8253_lock);
#endif

sound/drivers/pcsp/pcsp.h:

#if defined(CONFIG_MIPS) || defined(CONFIG_X86)
/* Use the global PIT lock ! */
#include <asm/i8253.h>
#else
#include <asm/8253pit.h>
static DEFINE_RAW_SPINLOCK(i8253_lock);

$ git grep -F pcsp.h sound/drivers/pcsp
sound/drivers/pcsp/pcsp.c:#include "pcsp.h"
sound/drivers/pcsp/pcsp_input.c:#include "pcsp.h"
sound/drivers/pcsp/pcsp_lib.c:#include "pcsp.h"
sound/drivers/pcsp/pcsp_mixer.c:#include "pcsp.h"
$ git grep -w i8253_lock sound/drivers/pcsp/
sound/drivers/pcsp/pcsp.h:static DEFINE_RAW_SPINLOCK(i8253_lock);
sound/drivers/pcsp/pcsp_input.c: raw_spin_lock_irqsave(&i8253_lock, flags
sound/drivers/pcsp/pcsp_input.c: raw_spin_unlock_irqrestore(&i8253_lock,
sound/drivers/pcsp/pcsp_lib.c: raw_spin_lock_irqsave(&i8253_lock, flags
sound/drivers/pcsp/pcsp_lib.c: raw_spin_unlock_irqrestore(&i8253_lock,
sound/drivers/pcsp/pcsp_lib.c: raw_spin_lock(&i8253_lock);
sound/drivers/pcsp/pcsp_lib.c: raw_spin_unlock(&i8253_lock);
sound/drivers/pcsp/pcsp_lib.c: raw_spin_lock(&i8253_lock);
sound/drivers/pcsp/pcsp_lib.c: raw_spin_unlock(&i8253_lock);

Locks are great, everybody should have their own lock!

$ find . -name 8253pit.h
./arch/powerpc/include/asm/8253pit.h
./arch/alpha/include/asm/8253pit.h
$ cat arch/*/include/asm/8253pit.h
/*
* 8253/8254 Programmable Interval Timer
*/
/*
* 8253/8254 Programmable Interval Timer
*/
$

Eh...

$ git grep -w PCSPKR_PLATFORM
arch/mips/Kconfig: select PCSPKR_PLATFORM
arch/mips/Kconfig: select PCSPKR_PLATFORM
arch/mips/Kconfig: select PCSPKR_PLATFORM
arch/powerpc/platforms/amigaone/Kconfig: select PCSPKR_PLATFORM
drivers/input/misc/Kconfig: depends on PCSPKR_PLATFORM
init/Kconfig:config PCSPKR_PLATFORM
sound/drivers/Kconfig: depends on PCSPKR_PLATFORM && X86 && HIGH_RES_TIMERS

So works on MIPS and x86. Compiles on PowerPC but locking is wrong. On
Alpha can't even be selected though it sees otherwise right except the
locking and even worse for the rest.

Ralf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/