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[] = { ...@@ -36,11 +36,11 @@ static unsigned char sb_dma_bits[] = {
* be relative to the given base -register * 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_intr_mask = 0;
static int pas_irq = 0; static int pas_irq = 0;
static int pas_sb_base = 0; static int pas_sb_base = 0;
spinlock_t lock=SPIN_LOCK_UNLOCKED; spinlock_t pas_lock=SPIN_LOCK_UNLOCKED;
#ifndef CONFIG_PAS_JOYSTICK #ifndef CONFIG_PAS_JOYSTICK
static int joystick = 0; static int joystick = 0;
#else #else
...@@ -79,12 +79,12 @@ extern void mix_write(unsigned char data, int ioaddr); ...@@ -79,12 +79,12 @@ extern void mix_write(unsigned char data, int ioaddr);
unsigned char pas_read(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) void pas_write(unsigned char data, int ioaddr)
{ {
outb((data), ioaddr + translate_code); outb((data), ioaddr + pas_translate_code);
} }
/******************* Begin of the Interrupt Handler ********************/ /******************* Begin of the Interrupt Handler ********************/
...@@ -301,7 +301,7 @@ static int __init detect_pas_hw(struct address_info *hw_config) ...@@ -301,7 +301,7 @@ static int __init detect_pas_hw(struct address_info *hw_config)
outb((0xBC), 0x9A01); /* Activate first board */ outb((0xBC), 0x9A01); /* Activate first board */
outb((hw_config->io_base >> 2), 0x9A01); /* Set base address */ 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 */ pas_write(1, 0xBF88); /* Select one wait states */
board_id = pas_read(0x0B8B); board_id = pas_read(0x0B8B);
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "pas2.h" #include "pas2.h"
extern spinlock_t lock; extern spinlock_t pas_lock;
static int midi_busy = 0, input_opened = 0; static int midi_busy = 0, input_opened = 0;
static int my_dev; static int my_dev;
...@@ -51,11 +51,11 @@ static int pas_midi_open(int dev, int mode, ...@@ -51,11 +51,11 @@ static int pas_midi_open(int dev, int mode,
pas_write(0x20 | 0x40, pas_write(0x20 | 0x40,
0x178b); 0x178b);
spin_lock_irqsave(&lock, flags); spin_lock_irqsave(&pas_lock, flags);
if ((err = pas_set_intr(0x10)) < 0) if ((err = pas_set_intr(0x10)) < 0)
{ {
spin_unlock_irqrestore(&lock, flags); spin_unlock_irqrestore(&pas_lock, flags);
return err; return err;
} }
/* /*
...@@ -83,7 +83,7 @@ static int pas_midi_open(int dev, int mode, ...@@ -83,7 +83,7 @@ static int pas_midi_open(int dev, int mode,
pas_write(0xff, 0x1B88); pas_write(0xff, 0x1B88);
spin_unlock_irqrestore(&lock, flags); spin_unlock_irqrestore(&pas_lock, flags);
midi_busy = 1; midi_busy = 1;
qlen = qhead = qtail = 0; qlen = qhead = qtail = 0;
...@@ -133,7 +133,7 @@ static int pas_midi_out(int dev, unsigned char midi_byte) ...@@ -133,7 +133,7 @@ static int pas_midi_out(int dev, unsigned char midi_byte)
* Drain the local queue first * Drain the local queue first
*/ */
spin_lock_irqsave(&lock, flags); spin_lock_irqsave(&pas_lock, flags);
while (qlen && dump_to_midi(tmp_queue[qhead])) while (qlen && dump_to_midi(tmp_queue[qhead]))
{ {
...@@ -141,7 +141,7 @@ static int pas_midi_out(int dev, unsigned char midi_byte) ...@@ -141,7 +141,7 @@ static int pas_midi_out(int dev, unsigned char midi_byte)
qhead++; qhead++;
} }
spin_unlock_irqrestore(&lock, flags); spin_unlock_irqrestore(&pas_lock, flags);
/* /*
* Output the byte if the local queue is empty. * Output the byte if the local queue is empty.
...@@ -158,13 +158,13 @@ static int pas_midi_out(int dev, unsigned char midi_byte) ...@@ -158,13 +158,13 @@ static int pas_midi_out(int dev, unsigned char midi_byte)
if (qlen >= 256) if (qlen >= 256)
return 0; /* Local queue full */ return 0; /* Local queue full */
spin_lock_irqsave(&lock, flags); spin_lock_irqsave(&pas_lock, flags);
tmp_queue[qtail] = midi_byte; tmp_queue[qtail] = midi_byte;
qlen++; qlen++;
qtail++; qtail++;
spin_unlock_irqrestore(&lock, flags); spin_unlock_irqrestore(&pas_lock, flags);
return 1; return 1;
} }
...@@ -244,7 +244,7 @@ void pas_midi_interrupt(void) ...@@ -244,7 +244,7 @@ void pas_midi_interrupt(void)
} }
if (stat & (0x08 | 0x10)) 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])) while (qlen && dump_to_midi(tmp_queue[qhead]))
{ {
...@@ -252,7 +252,7 @@ void pas_midi_interrupt(void) ...@@ -252,7 +252,7 @@ void pas_midi_interrupt(void)
qhead++; qhead++;
} }
spin_unlock(&lock); spin_unlock(&pas_lock);
} }
if (stat & 0x40) if (stat & 0x40)
{ {
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#define DEB(what) /* (what) */ #define DEB(what) /* (what) */
#endif #endif
extern int translate_code; extern int pas_translate_code;
extern char pas_model; extern char pas_model;
extern int *pas_osp; extern int *pas_osp;
extern int pas_audiodev; extern int pas_audiodev;
...@@ -71,7 +71,7 @@ mix_write(unsigned char data, int ioaddr) ...@@ -71,7 +71,7 @@ mix_write(unsigned char data, int ioaddr)
if (pas_model == 4) if (pas_model == 4)
{ {
outw(data | (data << 8), (ioaddr + translate_code) - 1); outw(data | (data << 8), (ioaddr + pas_translate_code) - 1);
outb((0x80), 0); outb((0x80), 0);
} else } else
pas_write(data, ioaddr); pas_write(data, ioaddr);
......
...@@ -45,7 +45,7 @@ static int pcm_busy = 0; ...@@ -45,7 +45,7 @@ static int pcm_busy = 0;
int pas_audiodev = -1; int pas_audiodev = -1;
static int open_mode = 0; static int open_mode = 0;
extern spinlock_t lock; extern spinlock_t pas_lock;
static int pcm_set_speed(int arg) static int pcm_set_speed(int arg)
{ {
...@@ -104,7 +104,7 @@ static int pcm_set_speed(int arg) ...@@ -104,7 +104,7 @@ static int pcm_set_speed(int arg)
pcm_filter = tmp; pcm_filter = tmp;
#endif #endif
spin_lock_irqsave(&lock, flags); spin_lock_irqsave(&pas_lock, flags);
pas_write(tmp & ~(0x40 | 0x80), 0x0B8A); pas_write(tmp & ~(0x40 | 0x80), 0x0B8A);
pas_write(0x00 | 0x30 | 0x04, 0x138B); pas_write(0x00 | 0x30 | 0x04, 0x138B);
...@@ -112,7 +112,7 @@ static int pcm_set_speed(int arg) ...@@ -112,7 +112,7 @@ static int pcm_set_speed(int arg)
pas_write((foo >> 8) & 0xff, 0x1388); pas_write((foo >> 8) & 0xff, 0x1388);
pas_write(tmp, 0x0B8A); pas_write(tmp, 0x0B8A);
spin_unlock_irqrestore(&lock, flags); spin_unlock_irqrestore(&pas_lock, flags);
return pcm_speed; return pcm_speed;
} }
...@@ -214,14 +214,14 @@ static int pas_audio_open(int dev, int mode) ...@@ -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)); 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) if (pcm_busy)
{ {
spin_unlock_irqrestore(&lock, flags); spin_unlock_irqrestore(&pas_lock, flags);
return -EBUSY; return -EBUSY;
} }
pcm_busy = 1; pcm_busy = 1;
spin_unlock_irqrestore(&lock, flags); spin_unlock_irqrestore(&pas_lock, flags);
if ((err = pas_set_intr(PAS_PCM_INTRBITS)) < 0) if ((err = pas_set_intr(PAS_PCM_INTRBITS)) < 0)
return err; return err;
...@@ -239,14 +239,14 @@ static void pas_audio_close(int dev) ...@@ -239,14 +239,14 @@ static void pas_audio_close(int dev)
DEB(printk("pas2_pcm.c: static void pas_audio_close(void)\n")); 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_audio_reset(dev);
pas_remove_intr(PAS_PCM_INTRBITS); pas_remove_intr(PAS_PCM_INTRBITS);
pcm_mode = PCM_NON; pcm_mode = PCM_NON;
pcm_busy = 0; 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, 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, ...@@ -265,7 +265,7 @@ static void pas_audio_output_block(int dev, unsigned long buf, int count,
cnt == pcm_count) cnt == pcm_count)
return; return;
spin_lock_irqsave(&lock, flags); spin_lock_irqsave(&pas_lock, flags);
pas_write(pas_read(0xF8A) & ~0x40, pas_write(pas_read(0xF8A) & ~0x40,
0xF8A); 0xF8A);
...@@ -292,7 +292,7 @@ static void pas_audio_output_block(int dev, unsigned long buf, int count, ...@@ -292,7 +292,7 @@ static void pas_audio_output_block(int dev, unsigned long buf, int count,
pcm_mode = PCM_DAC; 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, 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, ...@@ -312,7 +312,7 @@ static void pas_audio_start_input(int dev, unsigned long buf, int count,
cnt == pcm_count) cnt == pcm_count)
return; return;
spin_lock_irqsave(&lock, flags); spin_lock_irqsave(&pas_lock, flags);
/* DMAbuf_start_dma (dev, buf, count, DMA_MODE_READ); */ /* 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, ...@@ -336,7 +336,7 @@ static void pas_audio_start_input(int dev, unsigned long buf, int count,
pcm_mode = PCM_ADC; pcm_mode = PCM_ADC;
spin_unlock_irqrestore(&lock, flags); spin_unlock_irqrestore(&pas_lock, flags);
} }
#ifndef NO_TRIGGER #ifndef NO_TRIGGER
...@@ -344,7 +344,7 @@ static void pas_audio_trigger(int dev, int state) ...@@ -344,7 +344,7 @@ static void pas_audio_trigger(int dev, int state)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&lock, flags); spin_lock_irqsave(&pas_lock, flags);
state &= open_mode; state &= open_mode;
if (state & PCM_ENABLE_OUTPUT) if (state & PCM_ENABLE_OUTPUT)
...@@ -354,7 +354,7 @@ static void pas_audio_trigger(int dev, int state) ...@@ -354,7 +354,7 @@ static void pas_audio_trigger(int dev, int state)
else else
pas_write(pas_read(0xF8A) & ~0x40, 0xF8A); pas_write(pas_read(0xF8A) & ~0x40, 0xF8A);
spin_unlock_irqrestore(&lock, flags); spin_unlock_irqrestore(&pas_lock, flags);
} }
#endif #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