ALSA: usb-audio: add support for Akai MPD16
[safe/jmp/linux-2.6] / sound / pci / sonicvibes.c
index cfd2c5f..337b9fa 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Driver for S3 SonicVibes soundcard
- *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
+ *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  *
  *  BUGS:
  *    It looks like 86c617 rev 3 doesn't supports DDMA buffers above 16MB?
@@ -22,7 +22,6 @@
  *
  */
 
-#include <sound/driver.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
@@ -30,6 +29,7 @@
 #include <linux/slab.h>
 #include <linux/gameport.h>
 #include <linux/moduleparam.h>
+#include <linux/dma-mapping.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -41,7 +41,7 @@
 
 #include <asm/io.h>
 
-MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
+MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
 MODULE_DESCRIPTION("S3 SonicVibes PCI");
 MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}");
@@ -50,18 +50,11 @@ MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}");
 #define SUPPORT_JOYSTICK 1
 #endif
 
-#ifndef PCI_VENDOR_ID_S3
-#define PCI_VENDOR_ID_S3             0x5333
-#endif
-#ifndef PCI_DEVICE_ID_S3_SONICVIBES
-#define PCI_DEVICE_ID_S3_SONICVIBES  0xca00
-#endif
-
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;     /* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;      /* ID for this card */
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;     /* Enable this card */
-static int reverb[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
-static int mge[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
+static int reverb[SNDRV_CARDS];
+static int mge[SNDRV_CARDS];
 static unsigned int dmaio = 0x7a00;    /* DDMA i/o address */
 
 module_param_array(index, int, NULL, 0444);
@@ -202,9 +195,7 @@ MODULE_PARM_DESC(dmaio, "DDMA i/o base address for S3 SonicVibes soundcard.");
 
  */
 
-typedef struct _snd_sonicvibes sonicvibes_t;
-
-struct _snd_sonicvibes {
+struct sonicvibes {
        unsigned long dma1size;
        unsigned long dma2size;
        int irq;
@@ -231,40 +222,40 @@ struct _snd_sonicvibes {
        unsigned int mode;
 
        struct pci_dev *pci;
-       snd_card_t *card;
-       snd_pcm_t *pcm;
-       snd_pcm_substream_t *playback_substream;
-       snd_pcm_substream_t *capture_substream;
-       snd_rawmidi_t *rmidi;
-       snd_hwdep_t *fmsynth;   /* S3FM */
+       struct snd_card *card;
+       struct snd_pcm *pcm;
+       struct snd_pcm_substream *playback_substream;
+       struct snd_pcm_substream *capture_substream;
+       struct snd_rawmidi *rmidi;
+       struct snd_hwdep *fmsynth;      /* S3FM */
 
        spinlock_t reg_lock;
 
        unsigned int p_dma_size;
        unsigned int c_dma_size;
 
-       snd_kcontrol_t *master_mute;
-       snd_kcontrol_t *master_volume;
+       struct snd_kcontrol *master_mute;
+       struct snd_kcontrol *master_volume;
 
 #ifdef SUPPORT_JOYSTICK
        struct gameport *gameport;
 #endif
 };
 
-static struct pci_device_id snd_sonic_ids[] = {
-       { 0x5333, 0xca00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, },
+static DEFINE_PCI_DEVICE_TABLE(snd_sonic_ids) = {
+       { PCI_VDEVICE(S3, 0xca00), 0, },
         { 0, }
 };
 
 MODULE_DEVICE_TABLE(pci, snd_sonic_ids);
 
-static ratden_t sonicvibes_adc_clock = {
+static struct snd_ratden sonicvibes_adc_clock = {
        .num_min = 4000 * 65536,
        .num_max = 48000UL * 65536,
        .num_step = 1,
        .den = 65536,
 };
-static snd_pcm_hw_constraint_ratdens_t snd_sonicvibes_hw_constraints_adc_clock = {
+static struct snd_pcm_hw_constraint_ratdens snd_sonicvibes_hw_constraints_adc_clock = {
        .nrats = 1,
        .rats = &sonicvibes_adc_clock,
 };
@@ -273,7 +264,7 @@ static snd_pcm_hw_constraint_ratdens_t snd_sonicvibes_hw_constraints_adc_clock =
  *  common I/O routines
  */
 
-static inline void snd_sonicvibes_setdmaa(sonicvibes_t * sonic,
+static inline void snd_sonicvibes_setdmaa(struct sonicvibes * sonic,
                                          unsigned int addr,
                                          unsigned int count)
 {
@@ -282,11 +273,12 @@ static inline void snd_sonicvibes_setdmaa(sonicvibes_t * sonic,
        outl(count, sonic->dmaa_port + SV_DMA_COUNT0);
        outb(0x18, sonic->dmaa_port + SV_DMA_MODE);
 #if 0
-       printk("program dmaa: addr = 0x%x, paddr = 0x%x\n", addr, inl(sonic->dmaa_port + SV_DMA_ADDR0));
+       printk(KERN_DEBUG "program dmaa: addr = 0x%x, paddr = 0x%x\n",
+              addr, inl(sonic->dmaa_port + SV_DMA_ADDR0));
 #endif
 }
 
-static inline void snd_sonicvibes_setdmac(sonicvibes_t * sonic,
+static inline void snd_sonicvibes_setdmac(struct sonicvibes * sonic,
                                          unsigned int addr,
                                          unsigned int count)
 {
@@ -297,22 +289,23 @@ static inline void snd_sonicvibes_setdmac(sonicvibes_t * sonic,
        outl(count, sonic->dmac_port + SV_DMA_COUNT0);
        outb(0x14, sonic->dmac_port + SV_DMA_MODE);
 #if 0
-       printk("program dmac: addr = 0x%x, paddr = 0x%x\n", addr, inl(sonic->dmac_port + SV_DMA_ADDR0));
+       printk(KERN_DEBUG "program dmac: addr = 0x%x, paddr = 0x%x\n",
+              addr, inl(sonic->dmac_port + SV_DMA_ADDR0));
 #endif
 }
 
-static inline unsigned int snd_sonicvibes_getdmaa(sonicvibes_t * sonic)
+static inline unsigned int snd_sonicvibes_getdmaa(struct sonicvibes * sonic)
 {
        return (inl(sonic->dmaa_port + SV_DMA_COUNT0) & 0xffffff) + 1;
 }
 
-static inline unsigned int snd_sonicvibes_getdmac(sonicvibes_t * sonic)
+static inline unsigned int snd_sonicvibes_getdmac(struct sonicvibes * sonic)
 {
        /* note: dmac is working in word mode!!! */
        return ((inl(sonic->dmac_port + SV_DMA_COUNT0) & 0xffffff) + 1) << 1;
 }
 
-static void snd_sonicvibes_out1(sonicvibes_t * sonic,
+static void snd_sonicvibes_out1(struct sonicvibes * sonic,
                                unsigned char reg,
                                unsigned char value)
 {
@@ -322,7 +315,7 @@ static void snd_sonicvibes_out1(sonicvibes_t * sonic,
        udelay(10);
 }
 
-static void snd_sonicvibes_out(sonicvibes_t * sonic,
+static void snd_sonicvibes_out(struct sonicvibes * sonic,
                               unsigned char reg,
                               unsigned char value)
 {
@@ -336,7 +329,7 @@ static void snd_sonicvibes_out(sonicvibes_t * sonic,
        spin_unlock_irqrestore(&sonic->reg_lock, flags);
 }
 
-static unsigned char snd_sonicvibes_in1(sonicvibes_t * sonic, unsigned char reg)
+static unsigned char snd_sonicvibes_in1(struct sonicvibes * sonic, unsigned char reg)
 {
        unsigned char value;
 
@@ -347,7 +340,7 @@ static unsigned char snd_sonicvibes_in1(sonicvibes_t * sonic, unsigned char reg)
        return value;
 }
 
-static unsigned char snd_sonicvibes_in(sonicvibes_t * sonic, unsigned char reg)
+static unsigned char snd_sonicvibes_in(struct sonicvibes * sonic, unsigned char reg)
 {
        unsigned long flags;
        unsigned char value;
@@ -362,79 +355,112 @@ static unsigned char snd_sonicvibes_in(sonicvibes_t * sonic, unsigned char reg)
 }
 
 #if 0
-static void snd_sonicvibes_debug(sonicvibes_t * sonic)
+static void snd_sonicvibes_debug(struct sonicvibes * sonic)
 {
-       printk("SV REGS:          INDEX = 0x%02x  ", inb(SV_REG(sonic, INDEX)));
+       printk(KERN_DEBUG
+              "SV REGS:          INDEX = 0x%02x  ", inb(SV_REG(sonic, INDEX)));
        printk("                 STATUS = 0x%02x\n", inb(SV_REG(sonic, STATUS)));
-       printk("  0x00: left input      = 0x%02x  ", snd_sonicvibes_in(sonic, 0x00));
+       printk(KERN_DEBUG
+              "  0x00: left input      = 0x%02x  ", snd_sonicvibes_in(sonic, 0x00));
        printk("  0x20: synth rate low  = 0x%02x\n", snd_sonicvibes_in(sonic, 0x20));
-       printk("  0x01: right input     = 0x%02x  ", snd_sonicvibes_in(sonic, 0x01));
+       printk(KERN_DEBUG
+              "  0x01: right input     = 0x%02x  ", snd_sonicvibes_in(sonic, 0x01));
        printk("  0x21: synth rate high = 0x%02x\n", snd_sonicvibes_in(sonic, 0x21));
-       printk("  0x02: left AUX1       = 0x%02x  ", snd_sonicvibes_in(sonic, 0x02));
+       printk(KERN_DEBUG
+              "  0x02: left AUX1       = 0x%02x  ", snd_sonicvibes_in(sonic, 0x02));
        printk("  0x22: ADC clock       = 0x%02x\n", snd_sonicvibes_in(sonic, 0x22));
-       printk("  0x03: right AUX1      = 0x%02x  ", snd_sonicvibes_in(sonic, 0x03));
+       printk(KERN_DEBUG
+              "  0x03: right AUX1      = 0x%02x  ", snd_sonicvibes_in(sonic, 0x03));
        printk("  0x23: ADC alt rate    = 0x%02x\n", snd_sonicvibes_in(sonic, 0x23));
-       printk("  0x04: left CD         = 0x%02x  ", snd_sonicvibes_in(sonic, 0x04));
+       printk(KERN_DEBUG
+              "  0x04: left CD         = 0x%02x  ", snd_sonicvibes_in(sonic, 0x04));
        printk("  0x24: ADC pll M       = 0x%02x\n", snd_sonicvibes_in(sonic, 0x24));
-       printk("  0x05: right CD        = 0x%02x  ", snd_sonicvibes_in(sonic, 0x05));
+       printk(KERN_DEBUG
+              "  0x05: right CD        = 0x%02x  ", snd_sonicvibes_in(sonic, 0x05));
        printk("  0x25: ADC pll N       = 0x%02x\n", snd_sonicvibes_in(sonic, 0x25));
-       printk("  0x06: left line       = 0x%02x  ", snd_sonicvibes_in(sonic, 0x06));
+       printk(KERN_DEBUG
+              "  0x06: left line       = 0x%02x  ", snd_sonicvibes_in(sonic, 0x06));
        printk("  0x26: Synth pll M     = 0x%02x\n", snd_sonicvibes_in(sonic, 0x26));
-       printk("  0x07: right line      = 0x%02x  ", snd_sonicvibes_in(sonic, 0x07));
+       printk(KERN_DEBUG
+              "  0x07: right line      = 0x%02x  ", snd_sonicvibes_in(sonic, 0x07));
        printk("  0x27: Synth pll N     = 0x%02x\n", snd_sonicvibes_in(sonic, 0x27));
-       printk("  0x08: MIC             = 0x%02x  ", snd_sonicvibes_in(sonic, 0x08));
+       printk(KERN_DEBUG
+              "  0x08: MIC             = 0x%02x  ", snd_sonicvibes_in(sonic, 0x08));
        printk("  0x28: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x28));
-       printk("  0x09: Game port       = 0x%02x  ", snd_sonicvibes_in(sonic, 0x09));
+       printk(KERN_DEBUG
+              "  0x09: Game port       = 0x%02x  ", snd_sonicvibes_in(sonic, 0x09));
        printk("  0x29: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x29));
-       printk("  0x0a: left synth      = 0x%02x  ", snd_sonicvibes_in(sonic, 0x0a));
+       printk(KERN_DEBUG
+              "  0x0a: left synth      = 0x%02x  ", snd_sonicvibes_in(sonic, 0x0a));
        printk("  0x2a: MPU401          = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2a));
-       printk("  0x0b: right synth     = 0x%02x  ", snd_sonicvibes_in(sonic, 0x0b));
+       printk(KERN_DEBUG
+              "  0x0b: right synth     = 0x%02x  ", snd_sonicvibes_in(sonic, 0x0b));
        printk("  0x2b: drive ctrl      = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2b));
-       printk("  0x0c: left AUX2       = 0x%02x  ", snd_sonicvibes_in(sonic, 0x0c));
+       printk(KERN_DEBUG
+              "  0x0c: left AUX2       = 0x%02x  ", snd_sonicvibes_in(sonic, 0x0c));
        printk("  0x2c: SRS space       = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2c));
-       printk("  0x0d: right AUX2      = 0x%02x  ", snd_sonicvibes_in(sonic, 0x0d));
+       printk(KERN_DEBUG
+              "  0x0d: right AUX2      = 0x%02x  ", snd_sonicvibes_in(sonic, 0x0d));
        printk("  0x2d: SRS center      = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2d));
-       printk("  0x0e: left analog     = 0x%02x  ", snd_sonicvibes_in(sonic, 0x0e));
+       printk(KERN_DEBUG
+              "  0x0e: left analog     = 0x%02x  ", snd_sonicvibes_in(sonic, 0x0e));
        printk("  0x2e: wave source     = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2e));
-       printk("  0x0f: right analog    = 0x%02x  ", snd_sonicvibes_in(sonic, 0x0f));
+       printk(KERN_DEBUG
+              "  0x0f: right analog    = 0x%02x  ", snd_sonicvibes_in(sonic, 0x0f));
        printk("  0x2f: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2f));
-       printk("  0x10: left PCM        = 0x%02x  ", snd_sonicvibes_in(sonic, 0x10));
+       printk(KERN_DEBUG
+              "  0x10: left PCM        = 0x%02x  ", snd_sonicvibes_in(sonic, 0x10));
        printk("  0x30: analog power    = 0x%02x\n", snd_sonicvibes_in(sonic, 0x30));
-       printk("  0x11: right PCM       = 0x%02x  ", snd_sonicvibes_in(sonic, 0x11));
+       printk(KERN_DEBUG
+              "  0x11: right PCM       = 0x%02x  ", snd_sonicvibes_in(sonic, 0x11));
        printk("  0x31: analog power    = 0x%02x\n", snd_sonicvibes_in(sonic, 0x31));
-       printk("  0x12: DMA data format = 0x%02x  ", snd_sonicvibes_in(sonic, 0x12));
+       printk(KERN_DEBUG
+              "  0x12: DMA data format = 0x%02x  ", snd_sonicvibes_in(sonic, 0x12));
        printk("  0x32: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x32));
-       printk("  0x13: P/C enable      = 0x%02x  ", snd_sonicvibes_in(sonic, 0x13));
+       printk(KERN_DEBUG
+              "  0x13: P/C enable      = 0x%02x  ", snd_sonicvibes_in(sonic, 0x13));
        printk("  0x33: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x33));
-       printk("  0x14: U/D button      = 0x%02x  ", snd_sonicvibes_in(sonic, 0x14));
+       printk(KERN_DEBUG
+              "  0x14: U/D button      = 0x%02x  ", snd_sonicvibes_in(sonic, 0x14));
        printk("  0x34: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x34));
-       printk("  0x15: revision        = 0x%02x  ", snd_sonicvibes_in(sonic, 0x15));
+       printk(KERN_DEBUG
+              "  0x15: revision        = 0x%02x  ", snd_sonicvibes_in(sonic, 0x15));
        printk("  0x35: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x35));
-       printk("  0x16: ADC output ctrl = 0x%02x  ", snd_sonicvibes_in(sonic, 0x16));
+       printk(KERN_DEBUG
+              "  0x16: ADC output ctrl = 0x%02x  ", snd_sonicvibes_in(sonic, 0x16));
        printk("  0x36: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x36));
-       printk("  0x17: ---             = 0x%02x  ", snd_sonicvibes_in(sonic, 0x17));
+       printk(KERN_DEBUG
+              "  0x17: ---             = 0x%02x  ", snd_sonicvibes_in(sonic, 0x17));
        printk("  0x37: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x37));
-       printk("  0x18: DMA A upper cnt = 0x%02x  ", snd_sonicvibes_in(sonic, 0x18));
+       printk(KERN_DEBUG
+              "  0x18: DMA A upper cnt = 0x%02x  ", snd_sonicvibes_in(sonic, 0x18));
        printk("  0x38: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x38));
-       printk("  0x19: DMA A lower cnt = 0x%02x  ", snd_sonicvibes_in(sonic, 0x19));
+       printk(KERN_DEBUG
+              "  0x19: DMA A lower cnt = 0x%02x  ", snd_sonicvibes_in(sonic, 0x19));
        printk("  0x39: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x39));
-       printk("  0x1a: ---             = 0x%02x  ", snd_sonicvibes_in(sonic, 0x1a));
+       printk(KERN_DEBUG
+              "  0x1a: ---             = 0x%02x  ", snd_sonicvibes_in(sonic, 0x1a));
        printk("  0x3a: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3a));
-       printk("  0x1b: ---             = 0x%02x  ", snd_sonicvibes_in(sonic, 0x1b));
+       printk(KERN_DEBUG
+              "  0x1b: ---             = 0x%02x  ", snd_sonicvibes_in(sonic, 0x1b));
        printk("  0x3b: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3b));
-       printk("  0x1c: DMA C upper cnt = 0x%02x  ", snd_sonicvibes_in(sonic, 0x1c));
+       printk(KERN_DEBUG
+              "  0x1c: DMA C upper cnt = 0x%02x  ", snd_sonicvibes_in(sonic, 0x1c));
        printk("  0x3c: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3c));
-       printk("  0x1d: DMA C upper cnt = 0x%02x  ", snd_sonicvibes_in(sonic, 0x1d));
+       printk(KERN_DEBUG
+              "  0x1d: DMA C upper cnt = 0x%02x  ", snd_sonicvibes_in(sonic, 0x1d));
        printk("  0x3d: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3d));
-       printk("  0x1e: PCM rate low    = 0x%02x  ", snd_sonicvibes_in(sonic, 0x1e));
+       printk(KERN_DEBUG
+              "  0x1e: PCM rate low    = 0x%02x  ", snd_sonicvibes_in(sonic, 0x1e));
        printk("  0x3e: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3e));
-       printk("  0x1f: PCM rate high   = 0x%02x  ", snd_sonicvibes_in(sonic, 0x1f));
+       printk(KERN_DEBUG
+              "  0x1f: PCM rate high   = 0x%02x  ", snd_sonicvibes_in(sonic, 0x1f));
        printk("  0x3f: ---             = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3f));
 }
 
 #endif
 
-static void snd_sonicvibes_setfmt(sonicvibes_t * sonic,
+static void snd_sonicvibes_setfmt(struct sonicvibes * sonic,
                                   unsigned char mask,
                                   unsigned char value)
 {
@@ -485,12 +511,12 @@ static void snd_sonicvibes_pll(unsigned int rate,
        *res_m = m;
        *res_n = n;
 #if 0
-       printk("metric = %i, xm = %i, xn = %i\n", metric, xm, xn);
-       printk("pll: m = 0x%x, r = 0x%x, n = 0x%x\n", reg, m, r, n);
+       printk(KERN_DEBUG "metric = %i, xm = %i, xn = %i\n", metric, xm, xn);
+       printk(KERN_DEBUG "pll: m = 0x%x, r = 0x%x, n = 0x%x\n", reg, m, r, n);
 #endif
 }
 
-static void snd_sonicvibes_setpll(sonicvibes_t * sonic,
+static void snd_sonicvibes_setpll(struct sonicvibes * sonic,
                                   unsigned char reg,
                                   unsigned int rate)
 {
@@ -506,7 +532,7 @@ static void snd_sonicvibes_setpll(sonicvibes_t * sonic,
        }
 }
 
-static void snd_sonicvibes_set_adc_rate(sonicvibes_t * sonic, unsigned int rate)
+static void snd_sonicvibes_set_adc_rate(struct sonicvibes * sonic, unsigned int rate)
 {
        unsigned long flags;
        unsigned int div;
@@ -527,8 +553,8 @@ static void snd_sonicvibes_set_adc_rate(sonicvibes_t * sonic, unsigned int rate)
        spin_unlock_irqrestore(&sonic->reg_lock, flags);
 }
 
-static int snd_sonicvibes_hw_constraint_dac_rate(snd_pcm_hw_params_t *params,
-                                                snd_pcm_hw_rule_t *rule)
+static int snd_sonicvibes_hw_constraint_dac_rate(struct snd_pcm_hw_params *params,
+                                                struct snd_pcm_hw_rule *rule)
 {
        unsigned int rate, div, r, m, n;
 
@@ -543,8 +569,8 @@ static int snd_sonicvibes_hw_constraint_dac_rate(snd_pcm_hw_params_t *params,
                        params->rate_den = 1;
                } else {
                        snd_sonicvibes_pll(rate, &r, &m, &n);
-                       snd_assert((SV_REFFREQUENCY % 16) == 0, return -EINVAL);
-                       snd_assert((SV_ADCMULT % 512) == 0, return -EINVAL);
+                       snd_BUG_ON(SV_REFFREQUENCY % 16);
+                       snd_BUG_ON(SV_ADCMULT % 512);
                        params->rate_num = (SV_REFFREQUENCY/16) * (n+2) * r;
                        params->rate_den = (SV_ADCMULT/512) * (m+2);
                }
@@ -552,7 +578,7 @@ static int snd_sonicvibes_hw_constraint_dac_rate(snd_pcm_hw_params_t *params,
        return 0;
 }
 
-static void snd_sonicvibes_set_dac_rate(sonicvibes_t * sonic, unsigned int rate)
+static void snd_sonicvibes_set_dac_rate(struct sonicvibes * sonic, unsigned int rate)
 {
        unsigned int div;
        unsigned long flags;
@@ -566,7 +592,7 @@ static void snd_sonicvibes_set_dac_rate(sonicvibes_t * sonic, unsigned int rate)
        spin_unlock_irqrestore(&sonic->reg_lock, flags);
 }
 
-static int snd_sonicvibes_trigger(sonicvibes_t * sonic, int what, int cmd)
+static int snd_sonicvibes_trigger(struct sonicvibes * sonic, int what, int cmd)
 {
        int result = 0;
 
@@ -588,9 +614,9 @@ static int snd_sonicvibes_trigger(sonicvibes_t * sonic, int what, int cmd)
        return result;
 }
 
-static irqreturn_t snd_sonicvibes_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t snd_sonicvibes_interrupt(int irq, void *dev_id)
 {
-       sonicvibes_t *sonic = dev_id;
+       struct sonicvibes *sonic = dev_id;
        unsigned char status;
 
        status = inb(SV_REG(sonic, STATUS));
@@ -598,7 +624,7 @@ static irqreturn_t snd_sonicvibes_interrupt(int irq, void *dev_id, struct pt_reg
                return IRQ_NONE;
        if (status == 0xff) {   /* failure */
                outb(sonic->irqmask = ~0, SV_REG(sonic, IRQMASK));
-               snd_printk("IRQ failure - interrupts disabled!!\n");
+               snd_printk(KERN_ERR "IRQ failure - interrupts disabled!!\n");
                return IRQ_HANDLED;
        }
        if (sonic->pcm) {
@@ -609,7 +635,7 @@ static irqreturn_t snd_sonicvibes_interrupt(int irq, void *dev_id, struct pt_reg
        }
        if (sonic->rmidi) {
                if (status & SV_MIDI_IRQ)
-                       snd_mpu401_uart_interrupt(irq, sonic->rmidi->private_data, regs);
+                       snd_mpu401_uart_interrupt(irq, sonic->rmidi->private_data);
        }
        if (status & SV_UD_IRQ) {
                unsigned char udreg;
@@ -653,35 +679,35 @@ static irqreturn_t snd_sonicvibes_interrupt(int irq, void *dev_id, struct pt_reg
  *  PCM part
  */
 
-static int snd_sonicvibes_playback_trigger(snd_pcm_substream_t * substream,
+static int snd_sonicvibes_playback_trigger(struct snd_pcm_substream *substream,
                                           int cmd)
 {
-       sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
+       struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
        return snd_sonicvibes_trigger(sonic, 1, cmd);
 }
 
-static int snd_sonicvibes_capture_trigger(snd_pcm_substream_t * substream,
+static int snd_sonicvibes_capture_trigger(struct snd_pcm_substream *substream,
                                          int cmd)
 {
-       sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
+       struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
        return snd_sonicvibes_trigger(sonic, 2, cmd);
 }
 
-static int snd_sonicvibes_hw_params(snd_pcm_substream_t * substream,
-                                   snd_pcm_hw_params_t * hw_params)
+static int snd_sonicvibes_hw_params(struct snd_pcm_substream *substream,
+                                   struct snd_pcm_hw_params *hw_params)
 {
        return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
 }
 
-static int snd_sonicvibes_hw_free(snd_pcm_substream_t * substream)
+static int snd_sonicvibes_hw_free(struct snd_pcm_substream *substream)
 {
        return snd_pcm_lib_free_pages(substream);
 }
 
-static int snd_sonicvibes_playback_prepare(snd_pcm_substream_t * substream)
+static int snd_sonicvibes_playback_prepare(struct snd_pcm_substream *substream)
 {
-       sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
-       snd_pcm_runtime_t *runtime = substream->runtime;
+       struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
        unsigned char fmt = 0;
        unsigned int size = snd_pcm_lib_buffer_bytes(substream);
        unsigned int count = snd_pcm_lib_period_bytes(substream);
@@ -702,10 +728,10 @@ static int snd_sonicvibes_playback_prepare(snd_pcm_substream_t * substream)
        return 0;
 }
 
-static int snd_sonicvibes_capture_prepare(snd_pcm_substream_t * substream)
+static int snd_sonicvibes_capture_prepare(struct snd_pcm_substream *substream)
 {
-       sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
-       snd_pcm_runtime_t *runtime = substream->runtime;
+       struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
        unsigned char fmt = 0;
        unsigned int size = snd_pcm_lib_buffer_bytes(substream);
        unsigned int count = snd_pcm_lib_period_bytes(substream);
@@ -727,9 +753,9 @@ static int snd_sonicvibes_capture_prepare(snd_pcm_substream_t * substream)
        return 0;
 }
 
-static snd_pcm_uframes_t snd_sonicvibes_playback_pointer(snd_pcm_substream_t * substream)
+static snd_pcm_uframes_t snd_sonicvibes_playback_pointer(struct snd_pcm_substream *substream)
 {
-       sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
+       struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
        size_t ptr;
 
        if (!(sonic->enable & 1))
@@ -738,9 +764,9 @@ static snd_pcm_uframes_t snd_sonicvibes_playback_pointer(snd_pcm_substream_t * s
        return bytes_to_frames(substream->runtime, ptr);
 }
 
-static snd_pcm_uframes_t snd_sonicvibes_capture_pointer(snd_pcm_substream_t * substream)
+static snd_pcm_uframes_t snd_sonicvibes_capture_pointer(struct snd_pcm_substream *substream)
 {
-       sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
+       struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
        size_t ptr;
        if (!(sonic->enable & 2))
                return 0;
@@ -748,7 +774,7 @@ static snd_pcm_uframes_t snd_sonicvibes_capture_pointer(snd_pcm_substream_t * su
        return bytes_to_frames(substream->runtime, ptr);
 }
 
-static snd_pcm_hardware_t snd_sonicvibes_playback =
+static struct snd_pcm_hardware snd_sonicvibes_playback =
 {
        .info =                 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
                                 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -767,7 +793,7 @@ static snd_pcm_hardware_t snd_sonicvibes_playback =
        .fifo_size =            0,
 };
 
-static snd_pcm_hardware_t snd_sonicvibes_capture =
+static struct snd_pcm_hardware snd_sonicvibes_capture =
 {
        .info =                 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
                                 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -786,10 +812,10 @@ static snd_pcm_hardware_t snd_sonicvibes_capture =
        .fifo_size =            0,
 };
 
-static int snd_sonicvibes_playback_open(snd_pcm_substream_t * substream)
+static int snd_sonicvibes_playback_open(struct snd_pcm_substream *substream)
 {
-       sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
-       snd_pcm_runtime_t *runtime = substream->runtime;
+       struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
 
        sonic->mode |= SV_MODE_PLAY;
        sonic->playback_substream = substream;
@@ -798,10 +824,10 @@ static int snd_sonicvibes_playback_open(snd_pcm_substream_t * substream)
        return 0;
 }
 
-static int snd_sonicvibes_capture_open(snd_pcm_substream_t * substream)
+static int snd_sonicvibes_capture_open(struct snd_pcm_substream *substream)
 {
-       sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
-       snd_pcm_runtime_t *runtime = substream->runtime;
+       struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
 
        sonic->mode |= SV_MODE_CAPTURE;
        sonic->capture_substream = substream;
@@ -811,25 +837,25 @@ static int snd_sonicvibes_capture_open(snd_pcm_substream_t * substream)
        return 0;
 }
 
-static int snd_sonicvibes_playback_close(snd_pcm_substream_t * substream)
+static int snd_sonicvibes_playback_close(struct snd_pcm_substream *substream)
 {
-       sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
+       struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
 
        sonic->playback_substream = NULL;
        sonic->mode &= ~SV_MODE_PLAY;
        return 0;
 }
 
-static int snd_sonicvibes_capture_close(snd_pcm_substream_t * substream)
+static int snd_sonicvibes_capture_close(struct snd_pcm_substream *substream)
 {
-       sonicvibes_t *sonic = snd_pcm_substream_chip(substream);
+       struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
 
        sonic->capture_substream = NULL;
        sonic->mode &= ~SV_MODE_CAPTURE;
        return 0;
 }
 
-static snd_pcm_ops_t snd_sonicvibes_playback_ops = {
+static struct snd_pcm_ops snd_sonicvibes_playback_ops = {
        .open =         snd_sonicvibes_playback_open,
        .close =        snd_sonicvibes_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -840,7 +866,7 @@ static snd_pcm_ops_t snd_sonicvibes_playback_ops = {
        .pointer =      snd_sonicvibes_playback_pointer,
 };
 
-static snd_pcm_ops_t snd_sonicvibes_capture_ops = {
+static struct snd_pcm_ops snd_sonicvibes_capture_ops = {
        .open =         snd_sonicvibes_capture_open,
        .close =        snd_sonicvibes_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -851,27 +877,20 @@ static snd_pcm_ops_t snd_sonicvibes_capture_ops = {
        .pointer =      snd_sonicvibes_capture_pointer,
 };
 
-static void snd_sonicvibes_pcm_free(snd_pcm_t *pcm)
-{
-       sonicvibes_t *sonic = pcm->private_data;
-       sonic->pcm = NULL;
-       snd_pcm_lib_preallocate_free_for_all(pcm);
-}
-
-static int __devinit snd_sonicvibes_pcm(sonicvibes_t * sonic, int device, snd_pcm_t ** rpcm)
+static int __devinit snd_sonicvibes_pcm(struct sonicvibes * sonic, int device, struct snd_pcm ** rpcm)
 {
-       snd_pcm_t *pcm;
+       struct snd_pcm *pcm;
        int err;
 
        if ((err = snd_pcm_new(sonic->card, "s3_86c617", device, 1, 1, &pcm)) < 0)
                return err;
-       snd_assert(pcm != NULL, return -EINVAL);
+       if (snd_BUG_ON(!pcm))
+               return -EINVAL;
 
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sonicvibes_playback_ops);
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sonicvibes_capture_ops);
 
        pcm->private_data = sonic;
-       pcm->private_free = snd_sonicvibes_pcm_free;
        pcm->info_flags = 0;
        strcpy(pcm->name, "S3 SonicVibes");
        sonic->pcm = pcm;
@@ -893,7 +912,7 @@ static int __devinit snd_sonicvibes_pcm(sonicvibes_t * sonic, int device, snd_pc
   .info = snd_sonicvibes_info_mux, \
   .get = snd_sonicvibes_get_mux, .put = snd_sonicvibes_put_mux }
 
-static int snd_sonicvibes_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+static int snd_sonicvibes_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        static char *texts[7] = {
                "CD", "PCM", "Aux1", "Line", "Aux0", "Mic", "Mix"
@@ -908,9 +927,9 @@ static int snd_sonicvibes_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
        return 0;
 }
 
-static int snd_sonicvibes_get_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+static int snd_sonicvibes_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol);
+       struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
        
        spin_lock_irq(&sonic->reg_lock);
        ucontrol->value.enumerated.item[0] = ((snd_sonicvibes_in1(sonic, SV_IREG_LEFT_ADC) & SV_RECSRC_OUT) >> 5) - 1;
@@ -919,9 +938,9 @@ static int snd_sonicvibes_get_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
        return 0;
 }
 
-static int snd_sonicvibes_put_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+static int snd_sonicvibes_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol);
+       struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
        unsigned short left, right, oval1, oval2;
        int change;
        
@@ -948,7 +967,7 @@ static int snd_sonicvibes_put_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
   .get = snd_sonicvibes_get_single, .put = snd_sonicvibes_put_single, \
   .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
 
-static int snd_sonicvibes_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+static int snd_sonicvibes_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        int mask = (kcontrol->private_value >> 16) & 0xff;
 
@@ -959,9 +978,9 @@ static int snd_sonicvibes_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf
        return 0;
 }
 
-static int snd_sonicvibes_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+static int snd_sonicvibes_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol);
+       struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
        int reg = kcontrol->private_value & 0xff;
        int shift = (kcontrol->private_value >> 8) & 0xff;
        int mask = (kcontrol->private_value >> 16) & 0xff;
@@ -975,9 +994,9 @@ static int snd_sonicvibes_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
        return 0;
 }
 
-static int snd_sonicvibes_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+static int snd_sonicvibes_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol);
+       struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
        int reg = kcontrol->private_value & 0xff;
        int shift = (kcontrol->private_value >> 8) & 0xff;
        int mask = (kcontrol->private_value >> 16) & 0xff;
@@ -1004,7 +1023,7 @@ static int snd_sonicvibes_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
   .get = snd_sonicvibes_get_double, .put = snd_sonicvibes_put_double, \
   .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
 
-static int snd_sonicvibes_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+static int snd_sonicvibes_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        int mask = (kcontrol->private_value >> 24) & 0xff;
 
@@ -1015,9 +1034,9 @@ static int snd_sonicvibes_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf
        return 0;
 }
 
-static int snd_sonicvibes_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+static int snd_sonicvibes_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol);
+       struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
        int left_reg = kcontrol->private_value & 0xff;
        int right_reg = (kcontrol->private_value >> 8) & 0xff;
        int shift_left = (kcontrol->private_value >> 16) & 0x07;
@@ -1036,9 +1055,9 @@ static int snd_sonicvibes_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
        return 0;
 }
 
-static int snd_sonicvibes_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+static int snd_sonicvibes_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol);
+       struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
        int left_reg = kcontrol->private_value & 0xff;
        int right_reg = (kcontrol->private_value >> 8) & 0xff;
        int shift_left = (kcontrol->private_value >> 16) & 0x07;
@@ -1068,7 +1087,7 @@ static int snd_sonicvibes_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
        return change;
 }
 
-static snd_kcontrol_new_t snd_sonicvibes_controls[] __devinitdata = {
+static struct snd_kcontrol_new snd_sonicvibes_controls[] __devinitdata = {
 SONICVIBES_DOUBLE("Capture Volume", 0, SV_IREG_LEFT_ADC, SV_IREG_RIGHT_ADC, 0, 0, 15, 0),
 SONICVIBES_DOUBLE("Aux Playback Switch", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 7, 7, 1, 1),
 SONICVIBES_DOUBLE("Aux Playback Volume", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 0, 0, 31, 1),
@@ -1092,21 +1111,22 @@ SONICVIBES_SINGLE("Loopback Capture Volume", 0, SV_IREG_ADC_OUTPUT_CTRL, 2, 63,
 SONICVIBES_MUX("Capture Source", 0)
 };
 
-static void snd_sonicvibes_master_free(snd_kcontrol_t *kcontrol)
+static void snd_sonicvibes_master_free(struct snd_kcontrol *kcontrol)
 {
-       sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol);
+       struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
        sonic->master_mute = NULL;
        sonic->master_volume = NULL;
 }
 
-static int __devinit snd_sonicvibes_mixer(sonicvibes_t * sonic)
+static int __devinit snd_sonicvibes_mixer(struct sonicvibes * sonic)
 {
-       snd_card_t *card;
-       snd_kcontrol_t *kctl;
+       struct snd_card *card;
+       struct snd_kcontrol *kctl;
        unsigned int idx;
        int err;
 
-       snd_assert(sonic != NULL && sonic->card != NULL, return -EINVAL);
+       if (snd_BUG_ON(!sonic || !sonic->card))
+               return -EINVAL;
        card = sonic->card;
        strcpy(card->mixername, "S3 SonicVibes");
 
@@ -1125,10 +1145,10 @@ static int __devinit snd_sonicvibes_mixer(sonicvibes_t * sonic)
 
  */
 
-static void snd_sonicvibes_proc_read(snd_info_entry_t *entry, 
-                                    snd_info_buffer_t * buffer)
+static void snd_sonicvibes_proc_read(struct snd_info_entry *entry, 
+                                    struct snd_info_buffer *buffer)
 {
-       sonicvibes_t *sonic = entry->private_data;
+       struct sonicvibes *sonic = entry->private_data;
        unsigned char tmp;
 
        tmp = sonic->srs_space & 0x0f;
@@ -1155,12 +1175,12 @@ static void snd_sonicvibes_proc_read(snd_info_entry_t *entry,
        snd_iprintf(buffer, "MIDI to ext. Tx  : %s\n", tmp & 0x04 ? "on" : "off");
 }
 
-static void __devinit snd_sonicvibes_proc_init(sonicvibes_t * sonic)
+static void __devinit snd_sonicvibes_proc_init(struct sonicvibes * sonic)
 {
-       snd_info_entry_t *entry;
+       struct snd_info_entry *entry;
 
        if (! snd_card_proc_new(sonic->card, "sonicvibes", &entry))
-               snd_info_set_text_ops(entry, sonic, 1024, snd_sonicvibes_proc_read);
+               snd_info_set_text_ops(entry, sonic, snd_sonicvibes_proc_read);
 }
 
 /*
@@ -1168,10 +1188,10 @@ static void __devinit snd_sonicvibes_proc_init(sonicvibes_t * sonic)
  */
 
 #ifdef SUPPORT_JOYSTICK
-static snd_kcontrol_new_t snd_sonicvibes_game_control __devinitdata =
+static struct snd_kcontrol_new snd_sonicvibes_game_control __devinitdata =
 SONICVIBES_SINGLE("Joystick Speed", 0, SV_IREG_GAME_PORT, 1, 15, 0);
 
-static int __devinit snd_sonicvibes_create_gameport(sonicvibes_t *sonic)
+static int __devinit snd_sonicvibes_create_gameport(struct sonicvibes *sonic)
 {
        struct gameport *gp;
 
@@ -1193,7 +1213,7 @@ static int __devinit snd_sonicvibes_create_gameport(sonicvibes_t *sonic)
        return 0;
 }
 
-static void snd_sonicvibes_free_gameport(sonicvibes_t *sonic)
+static void snd_sonicvibes_free_gameport(struct sonicvibes *sonic)
 {
        if (sonic->gameport) {
                gameport_unregister_port(sonic->gameport);
@@ -1201,47 +1221,41 @@ static void snd_sonicvibes_free_gameport(sonicvibes_t *sonic)
        }
 }
 #else
-static inline int snd_sonicvibes_create_gameport(sonicvibes_t *sonic) { return -ENOSYS; }
-static inline void snd_sonicvibes_free_gameport(sonicvibes_t *sonic) { }
+static inline int snd_sonicvibes_create_gameport(struct sonicvibes *sonic) { return -ENOSYS; }
+static inline void snd_sonicvibes_free_gameport(struct sonicvibes *sonic) { }
 #endif
 
-static int snd_sonicvibes_free(sonicvibes_t *sonic)
+static int snd_sonicvibes_free(struct sonicvibes *sonic)
 {
        snd_sonicvibes_free_gameport(sonic);
        pci_write_config_dword(sonic->pci, 0x40, sonic->dmaa_port);
        pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port);
        if (sonic->irq >= 0)
-               free_irq(sonic->irq, (void *)sonic);
-       if (sonic->res_dmaa) {
-               release_resource(sonic->res_dmaa);
-               kfree_nocheck(sonic->res_dmaa);
-       }
-       if (sonic->res_dmac) {
-               release_resource(sonic->res_dmac);
-               kfree_nocheck(sonic->res_dmac);
-       }
+               free_irq(sonic->irq, sonic);
+       release_and_free_resource(sonic->res_dmaa);
+       release_and_free_resource(sonic->res_dmac);
        pci_release_regions(sonic->pci);
        pci_disable_device(sonic->pci);
        kfree(sonic);
        return 0;
 }
 
-static int snd_sonicvibes_dev_free(snd_device_t *device)
+static int snd_sonicvibes_dev_free(struct snd_device *device)
 {
-       sonicvibes_t *sonic = device->device_data;
+       struct sonicvibes *sonic = device->device_data;
        return snd_sonicvibes_free(sonic);
 }
 
-static int __devinit snd_sonicvibes_create(snd_card_t * card,
+static int __devinit snd_sonicvibes_create(struct snd_card *card,
                                        struct pci_dev *pci,
                                        int reverb,
                                        int mge,
-                                       sonicvibes_t ** rsonic)
+                                       struct sonicvibes ** rsonic)
 {
-       sonicvibes_t *sonic;
+       struct sonicvibes *sonic;
        unsigned int dmaa, dmac;
        int err;
-       static snd_device_ops_t ops = {
+       static struct snd_device_ops ops = {
                .dev_free =     snd_sonicvibes_dev_free,
        };
 
@@ -1250,14 +1264,14 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
        /* check, if we can restrict PCI DMA transfers to 24 bits */
-        if (pci_set_dma_mask(pci, 0x00ffffff) < 0 ||
-           pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) {
-                snd_printk("architecture does not support 24bit PCI busmaster DMA\n");
+        if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 ||
+           pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) {
+               snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
                pci_disable_device(pci);
                 return -ENXIO;
         }
 
-       sonic = kcalloc(1, sizeof(*sonic), GFP_KERNEL);
+       sonic = kzalloc(sizeof(*sonic), GFP_KERNEL);
        if (sonic == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1279,8 +1293,9 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card,
        sonic->midi_port = pci_resource_start(pci, 3);
        sonic->game_port = pci_resource_start(pci, 4);
 
-       if (request_irq(pci->irq, snd_sonicvibes_interrupt, SA_INTERRUPT|SA_SHIRQ, "S3 SonicVibes", (void *)sonic)) {
-               snd_printk("unable to grab IRQ %d\n", pci->irq);
+       if (request_irq(pci->irq, snd_sonicvibes_interrupt, IRQF_SHARED,
+                       "S3 SonicVibes", sonic)) {
+               snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
                snd_sonicvibes_free(sonic);
                return -EBUSY;
        }
@@ -1294,24 +1309,24 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card,
        if (!dmaa) {
                dmaa = dmaio;
                dmaio += 0x10;
-               snd_printk("BIOS did not allocate DDMA channel A i/o, allocated at 0x%x\n", dmaa);
+               snd_printk(KERN_INFO "BIOS did not allocate DDMA channel A i/o, allocated at 0x%x\n", dmaa);
        }
        if (!dmac) {
                dmac = dmaio;
                dmaio += 0x10;
-               snd_printk("BIOS did not allocate DDMA channel C i/o, allocated at 0x%x\n", dmac);
+               snd_printk(KERN_INFO "BIOS did not allocate DDMA channel C i/o, allocated at 0x%x\n", dmac);
        }
        pci_write_config_dword(pci, 0x40, dmaa);
        pci_write_config_dword(pci, 0x48, dmac);
 
        if ((sonic->res_dmaa = request_region(dmaa, 0x10, "S3 SonicVibes DDMA-A")) == NULL) {
                snd_sonicvibes_free(sonic);
-               snd_printk("unable to grab DDMA-A port at 0x%x-0x%x\n", dmaa, dmaa + 0x10 - 1);
+               snd_printk(KERN_ERR "unable to grab DDMA-A port at 0x%x-0x%x\n", dmaa, dmaa + 0x10 - 1);
                return -EBUSY;
        }
        if ((sonic->res_dmac = request_region(dmac, 0x10, "S3 SonicVibes DDMA-C")) == NULL) {
                snd_sonicvibes_free(sonic);
-               snd_printk("unable to grab DDMA-C port at 0x%x-0x%x\n", dmac, dmac + 0x10 - 1);
+               snd_printk(KERN_ERR "unable to grab DDMA-C port at 0x%x-0x%x\n", dmac, dmac + 0x10 - 1);
                return -EBUSY;
        }
 
@@ -1386,7 +1401,7 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card,
  *  MIDI section
  */
 
-static snd_kcontrol_new_t snd_sonicvibes_midi_controls[] __devinitdata = {
+static struct snd_kcontrol_new snd_sonicvibes_midi_controls[] __devinitdata = {
 SONICVIBES_SINGLE("SonicVibes Wave Source RAM", 0, SV_IREG_WAVE_SOURCE, 0, 1, 0),
 SONICVIBES_SINGLE("SonicVibes Wave Source RAM+ROM", 0, SV_IREG_WAVE_SOURCE, 1, 1, 0),
 SONICVIBES_SINGLE("SonicVibes Onboard Synth", 0, SV_IREG_MPU401, 0, 1, 0),
@@ -1394,24 +1409,25 @@ SONICVIBES_SINGLE("SonicVibes External Rx to Synth", 0, SV_IREG_MPU401, 1, 1, 0)
 SONICVIBES_SINGLE("SonicVibes External Tx", 0, SV_IREG_MPU401, 2, 1, 0)
 };
 
-static int snd_sonicvibes_midi_input_open(mpu401_t * mpu)
+static int snd_sonicvibes_midi_input_open(struct snd_mpu401 * mpu)
 {
-       sonicvibes_t *sonic = mpu->private_data;
+       struct sonicvibes *sonic = mpu->private_data;
        outb(sonic->irqmask &= ~SV_MIDI_MASK, SV_REG(sonic, IRQMASK));
        return 0;
 }
 
-static void snd_sonicvibes_midi_input_close(mpu401_t * mpu)
+static void snd_sonicvibes_midi_input_close(struct snd_mpu401 * mpu)
 {
-       sonicvibes_t *sonic = mpu->private_data;
+       struct sonicvibes *sonic = mpu->private_data;
        outb(sonic->irqmask |= SV_MIDI_MASK, SV_REG(sonic, IRQMASK));
 }
 
-static int __devinit snd_sonicvibes_midi(sonicvibes_t * sonic, snd_rawmidi_t * rmidi)
+static int __devinit snd_sonicvibes_midi(struct sonicvibes * sonic,
+                                        struct snd_rawmidi *rmidi)
 {
-       mpu401_t * mpu = rmidi->private_data;
-       snd_card_t *card = sonic->card;
-       snd_rawmidi_str_t *dir;
+       struct snd_mpu401 * mpu = rmidi->private_data;
+       struct snd_card *card = sonic->card;
+       struct snd_rawmidi_str *dir;
        unsigned int idx;
        int err;
 
@@ -1429,10 +1445,10 @@ static int __devinit snd_sonic_probe(struct pci_dev *pci,
                                     const struct pci_device_id *pci_id)
 {
        static int dev;
-       snd_card_t *card;
-       sonicvibes_t *sonic;
-       snd_rawmidi_t *midi_uart;
-       opl3_t *opl3;
+       struct snd_card *card;
+       struct sonicvibes *sonic;
+       struct snd_rawmidi *midi_uart;
+       struct snd_opl3 *opl3;
        int idx, err;
 
        if (dev >= SNDRV_CARDS)
@@ -1442,9 +1458,9 @@ static int __devinit snd_sonic_probe(struct pci_dev *pci,
                return -ENOENT;
        }
  
-       card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
-       if (card == NULL)
-               return -ENOMEM;
+       err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
+       if (err < 0)
+               return err;
        for (idx = 0; idx < 5; idx++) {
                if (pci_resource_start(pci, idx) == 0 ||
                    !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) {
@@ -1462,10 +1478,10 @@ static int __devinit snd_sonic_probe(struct pci_dev *pci,
 
        strcpy(card->driver, "SonicVibes");
        strcpy(card->shortname, "S3 SonicVibes");
-       sprintf(card->longname, "%s rev %i at 0x%lx, irq %i",
+       sprintf(card->longname, "%s rev %i at 0x%llx, irq %i",
                card->shortname,
                sonic->revision,
-               pci_resource_start(pci, 1),
+               (unsigned long long)pci_resource_start(pci, 1),
                sonic->irq);
 
        if ((err = snd_sonicvibes_pcm(sonic, 0, NULL)) < 0) {
@@ -1477,7 +1493,7 @@ static int __devinit snd_sonic_probe(struct pci_dev *pci,
                return err;
        }
        if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SONICVIBES,
-                                      sonic->midi_port, 1,
+                                      sonic->midi_port, MPU401_INFO_INTEGRATED,
                                       sonic->irq, 0,
                                       &midi_uart)) < 0) {
                snd_card_free(card);
@@ -1522,7 +1538,7 @@ static struct pci_driver driver = {
 
 static int __init alsa_card_sonicvibes_init(void)
 {
-       return pci_module_init(&driver);
+       return pci_register_driver(&driver);
 }
 
 static void __exit alsa_card_sonicvibes_exit(void)