diff options
Diffstat (limited to 'sound/pci/ca0106/ca0106_main.c')
| -rw-r--r-- | sound/pci/ca0106/ca0106_main.c | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index cf1bac7a435f..41774e2ef53f 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c @@ -332,16 +332,13 @@ unsigned int snd_ca0106_ptr_read(struct snd_ca0106 * emu, unsigned int reg, unsigned int chn) { - unsigned long flags; - unsigned int regptr, val; + unsigned int regptr; regptr = (reg << 16) | chn; - spin_lock_irqsave(&emu->emu_lock, flags); + guard(spinlock_irqsave)(&emu->emu_lock); outl(regptr, emu->port + CA0106_PTR); - val = inl(emu->port + CA0106_DATA); - spin_unlock_irqrestore(&emu->emu_lock, flags); - return val; + return inl(emu->port + CA0106_DATA); } void snd_ca0106_ptr_write(struct snd_ca0106 *emu, @@ -350,14 +347,12 @@ void snd_ca0106_ptr_write(struct snd_ca0106 *emu, unsigned int data) { unsigned int regptr; - unsigned long flags; regptr = (reg << 16) | chn; - spin_lock_irqsave(&emu->emu_lock, flags); + guard(spinlock_irqsave)(&emu->emu_lock); outl(regptr, emu->port + CA0106_PTR); outl(data, emu->port + CA0106_DATA); - spin_unlock_irqrestore(&emu->emu_lock, flags); } int snd_ca0106_spi_write(struct snd_ca0106 * emu, @@ -451,24 +446,20 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu, static void snd_ca0106_intr_enable(struct snd_ca0106 *emu, unsigned int intrenb) { - unsigned long flags; unsigned int intr_enable; - spin_lock_irqsave(&emu->emu_lock, flags); + guard(spinlock_irqsave)(&emu->emu_lock); intr_enable = inl(emu->port + CA0106_INTE) | intrenb; outl(intr_enable, emu->port + CA0106_INTE); - spin_unlock_irqrestore(&emu->emu_lock, flags); } static void snd_ca0106_intr_disable(struct snd_ca0106 *emu, unsigned int intrenb) { - unsigned long flags; unsigned int intr_enable; - spin_lock_irqsave(&emu->emu_lock, flags); + guard(spinlock_irqsave)(&emu->emu_lock); intr_enable = inl(emu->port + CA0106_INTE) & ~intrenb; outl(intr_enable, emu->port + CA0106_INTE); - spin_unlock_irqrestore(&emu->emu_lock, flags); } @@ -1138,26 +1129,20 @@ static unsigned short snd_ca0106_ac97_read(struct snd_ac97 *ac97, unsigned short reg) { struct snd_ca0106 *emu = ac97->private_data; - unsigned long flags; - unsigned short val; - spin_lock_irqsave(&emu->emu_lock, flags); + guard(spinlock_irqsave)(&emu->emu_lock); outb(reg, emu->port + CA0106_AC97ADDRESS); - val = inw(emu->port + CA0106_AC97DATA); - spin_unlock_irqrestore(&emu->emu_lock, flags); - return val; + return inw(emu->port + CA0106_AC97DATA); } static void snd_ca0106_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) { struct snd_ca0106 *emu = ac97->private_data; - unsigned long flags; - spin_lock_irqsave(&emu->emu_lock, flags); + guard(spinlock_irqsave)(&emu->emu_lock); outb(reg, emu->port + CA0106_AC97ADDRESS); outw(val, emu->port + CA0106_AC97DATA); - spin_unlock_irqrestore(&emu->emu_lock, flags); } static int snd_ca0106_ac97(struct snd_ca0106 *chip) @@ -1315,7 +1300,7 @@ static int snd_ca0106_pcm(struct snd_ca0106 *emu, int device) } pcm->info_flags = 0; - strcpy(pcm->name, "CA0106"); + strscpy(pcm->name, "CA0106"); for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; @@ -1593,7 +1578,7 @@ static int snd_ca0106_create(int dev, struct snd_card *card, spin_lock_init(&chip->emu_lock); - err = pci_request_regions(pci, "snd_ca0106"); + err = pcim_request_all_regions(pci, "snd_ca0106"); if (err < 0) return err; chip->port = pci_resource_start(pci, 0); @@ -1617,8 +1602,8 @@ static int snd_ca0106_create(int dev, struct snd_card *card, pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model); dev_info(card->dev, "Model %04x Rev %08x Serial %08x\n", chip->model, pci->revision, chip->serial); - strcpy(card->driver, "CA0106"); - strcpy(card->shortname, "CA0106"); + strscpy(card->driver, "CA0106"); + strscpy(card->shortname, "CA0106"); for (c = ca0106_chip_details; c->serial; c++) { if (subsystem[dev]) { |
