Commit ca7f949f authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] namespace pollution in OSS_pas2 driver

From:  Arnd Bergmann <arnd@bergmann-dalldorf.de>

  The pas2 driver has a global variable named 'lock', which
  pollutes the global namespace. This patch adds a pas_
  prefix. The same is done for 'translate_code'.
parent d7cb1bd8
......@@ -36,11 +36,11 @@ static unsigned char sb_dma_bits[] = {
* be relative to the given base -register
*/
int translate_code = 0;
int pas_translate_code = 0;
static int pas_intr_mask = 0;
static int pas_irq = 0;
static int pas_sb_base = 0;
spinlock_t lock=SPIN_LOCK_UNLOCKED;
spinlock_t pas_lock=SPIN_LOCK_UNLOCKED;
#ifndef CONFIG_PAS_JOYSTICK
static int joystick = 0;
#else
......@@ -79,12 +79,12 @@ extern void mix_write(unsigned char data, int ioaddr);
unsigned char pas_read(int ioaddr)
{
return inb(ioaddr + translate_code);
return inb(ioaddr + pas_translate_code);
}
void pas_write(unsigned char data, int ioaddr)
{
outb((data), ioaddr + translate_code);
outb((data), ioaddr + pas_translate_code);
}
/******************* Begin of the Interrupt Handler ********************/
......@@ -301,7 +301,7 @@ static int __init detect_pas_hw(struct address_info *hw_config)
outb((0xBC), 0x9A01); /* Activate first board */
outb((hw_config->io_base >> 2), 0x9A01); /* Set base address */
translate_code = hw_config->io_base - 0x388;
pas_translate_code = hw_config->io_base - 0x388;
pas_write(1, 0xBF88); /* Select one wait states */
board_id = pas_read(0x0B8B);
......
......@@ -19,7 +19,7 @@
#include "pas2.h"
extern spinlock_t lock;
extern spinlock_t pas_lock;
static int midi_busy = 0, input_opened = 0;
static int my_dev;
......@@ -51,11 +51,11 @@ static int pas_midi_open(int dev, int mode,
pas_write(0x20 | 0x40,
0x178b);
spin_lock_irqsave(&lock, flags);
spin_lock_irqsave(&pas_lock, flags);
if ((err = pas_set_intr(0x10)) < 0)
{
spin_unlock_irqrestore(&lock, flags);
spin_unlock_irqrestore(&pas_lock, flags);
return err;
}
/*
......@@ -83,7 +83,7 @@ static int pas_midi_open(int dev, int mode,
pas_write(0xff, 0x1B88);
spin_unlock_irqrestore(&lock, flags);
spin_unlock_irqrestore(&pas_lock, flags);
midi_busy = 1;
qlen = qhead = qtail = 0;
......@@ -133,7 +133,7 @@ static int pas_midi_out(int dev, unsigned char midi_byte)
* Drain the local queue first
*/
spin_lock_irqsave(&lock, flags);
spin_lock_irqsave(&pas_lock, flags);
while (qlen && dump_to_midi(tmp_queue[qhead]))
{
......@@ -141,7 +141,7 @@ static int pas_midi_out(int dev, unsigned char midi_byte)
qhead++;
}
spin_unlock_irqrestore(&lock, flags);
spin_unlock_irqrestore(&pas_lock, flags);
/*
* Output the byte if the local queue is empty.
......@@ -158,13 +158,13 @@ static int pas_midi_out(int dev, unsigned char midi_byte)
if (qlen >= 256)
return 0; /* Local queue full */
spin_lock_irqsave(&lock, flags);
spin_lock_irqsave(&pas_lock, flags);
tmp_queue[qtail] = midi_byte;
qlen++;
qtail++;
spin_unlock_irqrestore(&lock, flags);
spin_unlock_irqrestore(&pas_lock, flags);
return 1;
}
......@@ -244,7 +244,7 @@ void pas_midi_interrupt(void)
}
if (stat & (0x08 | 0x10))
{
spin_lock(&lock);/* called in irq context */
spin_lock(&pas_lock);/* called in irq context */
while (qlen && dump_to_midi(tmp_queue[qhead]))
{
......@@ -252,7 +252,7 @@ void pas_midi_interrupt(void)
qhead++;
}
spin_unlock(&lock);
spin_unlock(&pas_lock);
}
if (stat & 0x40)
{
......
......@@ -25,7 +25,7 @@
#define DEB(what) /* (what) */
#endif
extern int translate_code;
extern int pas_translate_code;
extern char pas_model;
extern int *pas_osp;
extern int pas_audiodev;
......@@ -71,7 +71,7 @@ mix_write(unsigned char data, int ioaddr)
if (pas_model == 4)
{
outw(data | (data << 8), (ioaddr + translate_code) - 1);
outw(data | (data << 8), (ioaddr + pas_translate_code) - 1);
outb((0x80), 0);
} else
pas_write(data, ioaddr);
......
......@@ -45,7 +45,7 @@ static int pcm_busy = 0;
int pas_audiodev = -1;
static int open_mode = 0;
extern spinlock_t lock;
extern spinlock_t pas_lock;
static int pcm_set_speed(int arg)
{
......@@ -104,7 +104,7 @@ static int pcm_set_speed(int arg)
pcm_filter = tmp;
#endif
spin_lock_irqsave(&lock, flags);
spin_lock_irqsave(&pas_lock, flags);
pas_write(tmp & ~(0x40 | 0x80), 0x0B8A);
pas_write(0x00 | 0x30 | 0x04, 0x138B);
......@@ -112,7 +112,7 @@ static int pcm_set_speed(int arg)
pas_write((foo >> 8) & 0xff, 0x1388);
pas_write(tmp, 0x0B8A);
spin_unlock_irqrestore(&lock, flags);
spin_unlock_irqrestore(&pas_lock, flags);
return pcm_speed;
}
......@@ -214,14 +214,14 @@ static int pas_audio_open(int dev, int mode)
DEB(printk("pas2_pcm.c: static int pas_audio_open(int mode = %X)\n", mode));
spin_lock_irqsave(&lock, flags);
spin_lock_irqsave(&pas_lock, flags);
if (pcm_busy)
{
spin_unlock_irqrestore(&lock, flags);
spin_unlock_irqrestore(&pas_lock, flags);
return -EBUSY;
}
pcm_busy = 1;
spin_unlock_irqrestore(&lock, flags);
spin_unlock_irqrestore(&pas_lock, flags);
if ((err = pas_set_intr(PAS_PCM_INTRBITS)) < 0)
return err;
......@@ -239,14 +239,14 @@ static void pas_audio_close(int dev)
DEB(printk("pas2_pcm.c: static void pas_audio_close(void)\n"));
spin_lock_irqsave(&lock, flags);
spin_lock_irqsave(&pas_lock, flags);
pas_audio_reset(dev);
pas_remove_intr(PAS_PCM_INTRBITS);
pcm_mode = PCM_NON;
pcm_busy = 0;
spin_unlock_irqrestore(&lock, flags);
spin_unlock_irqrestore(&pas_lock, flags);
}
static void pas_audio_output_block(int dev, unsigned long buf, int count,
......@@ -265,7 +265,7 @@ static void pas_audio_output_block(int dev, unsigned long buf, int count,
cnt == pcm_count)
return;
spin_lock_irqsave(&lock, flags);
spin_lock_irqsave(&pas_lock, flags);
pas_write(pas_read(0xF8A) & ~0x40,
0xF8A);
......@@ -292,7 +292,7 @@ static void pas_audio_output_block(int dev, unsigned long buf, int count,
pcm_mode = PCM_DAC;
spin_unlock_irqrestore(&lock, flags);
spin_unlock_irqrestore(&pas_lock, flags);
}
static void pas_audio_start_input(int dev, unsigned long buf, int count,
......@@ -312,7 +312,7 @@ static void pas_audio_start_input(int dev, unsigned long buf, int count,
cnt == pcm_count)
return;
spin_lock_irqsave(&lock, flags);
spin_lock_irqsave(&pas_lock, flags);
/* DMAbuf_start_dma (dev, buf, count, DMA_MODE_READ); */
......@@ -336,7 +336,7 @@ static void pas_audio_start_input(int dev, unsigned long buf, int count,
pcm_mode = PCM_ADC;
spin_unlock_irqrestore(&lock, flags);
spin_unlock_irqrestore(&pas_lock, flags);
}
#ifndef NO_TRIGGER
......@@ -344,7 +344,7 @@ static void pas_audio_trigger(int dev, int state)
{
unsigned long flags;
spin_lock_irqsave(&lock, flags);
spin_lock_irqsave(&pas_lock, flags);
state &= open_mode;
if (state & PCM_ENABLE_OUTPUT)
......@@ -354,7 +354,7 @@ static void pas_audio_trigger(int dev, int state)
else
pas_write(pas_read(0xF8A) & ~0x40, 0xF8A);
spin_unlock_irqrestore(&lock, flags);
spin_unlock_irqrestore(&pas_lock, flags);
}
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment