[ALSA] sparc dbri: more driver cleanup
[linux-2.6.git] / sound / sparc / cs4231.c
index 1f8d27a..9a06c3b 100644 (file)
@@ -8,7 +8,6 @@
  * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
@@ -62,49 +61,48 @@ MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{Sun,CS4231}}");
 
 #ifdef SBUS_SUPPORT
-typedef struct sbus_dma_info {
+struct sbus_dma_info {
        spinlock_t      lock;
        int             dir;
        void __iomem    *regs;
-} sbus_dma_info_t;
+};
 #endif
 
-typedef struct snd_cs4231 cs4231_t;
-
-typedef struct cs4231_dma_control {
+struct snd_cs4231;
+struct cs4231_dma_control {
         void           (*prepare)(struct cs4231_dma_control *dma_cont, int dir);
         void           (*enable)(struct cs4231_dma_control *dma_cont, int on);
         int            (*request)(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len);
         unsigned int   (*address)(struct cs4231_dma_control *dma_cont);
-        void           (*reset)(cs4231_t *chip); 
-        void           (*preallocate)(cs4231_t *chip, snd_pcm_t *pcm); 
+        void           (*reset)(struct snd_cs4231 *chip); 
+        void           (*preallocate)(struct snd_cs4231 *chip, struct snd_pcm *pcm); 
 #ifdef EBUS_SUPPORT
        struct          ebus_dma_info   ebus_info;
 #endif
 #ifdef SBUS_SUPPORT
        struct          sbus_dma_info   sbus_info;
 #endif
-} cs4231_dma_control_t;
+};
 
 struct snd_cs4231 {
        spinlock_t              lock;
        void __iomem            *port;
 
-       cs4231_dma_control_t    p_dma;
-       cs4231_dma_control_t    c_dma;
+       struct cs4231_dma_control       p_dma;
+       struct cs4231_dma_control       c_dma;
 
        u32                     flags;
 #define CS4231_FLAG_EBUS       0x00000001
 #define CS4231_FLAG_PLAYBACK   0x00000002
 #define CS4231_FLAG_CAPTURE    0x00000004
 
-       snd_card_t              *card;
-       snd_pcm_t               *pcm;
-       snd_pcm_substream_t     *playback_substream;
+       struct snd_card         *card;
+       struct snd_pcm          *pcm;
+       struct snd_pcm_substream        *playback_substream;
        unsigned int            p_periods_sent;
-       snd_pcm_substream_t     *capture_substream;
+       struct snd_pcm_substream        *capture_substream;
        unsigned int            c_periods_sent;
-       snd_timer_t             *timer;
+       struct snd_timer        *timer;
 
        unsigned short mode;
 #define CS4231_MODE_NONE       0x0000
@@ -116,8 +114,8 @@ struct snd_cs4231 {
        unsigned char           image[32];      /* registers image */
        int                     mce_bit;
        int                     calibrate_mute;
-       struct semaphore        mce_mutex;
-       struct semaphore        open_mutex;
+       struct mutex            mce_mutex;
+       struct mutex            open_mutex;
 
        union {
 #ifdef SBUS_SUPPORT
@@ -132,7 +130,7 @@ struct snd_cs4231 {
        struct snd_cs4231       *next;
 };
 
-static cs4231_t *cs4231_list;
+static struct snd_cs4231 *cs4231_list;
 
 /* Eventually we can use sound/isa/cs423x/cs4231_lib.c directly, but for
  * now....  -DaveM
@@ -341,12 +339,12 @@ static unsigned int rates[14] = {
        27042, 32000, 33075, 37800, 44100, 48000
 };
 
-static snd_pcm_hw_constraint_list_t hw_constraints_rates = {
+static struct snd_pcm_hw_constraint_list hw_constraints_rates = {
        .count  = 14,
        .list   = rates,
 };
 
-static int snd_cs4231_xrate(snd_pcm_runtime_t *runtime)
+static int snd_cs4231_xrate(struct snd_pcm_runtime *runtime)
 {
        return snd_pcm_hw_constraint_list(runtime, 0,
                                          SNDRV_PCM_HW_PARAM_RATE,
@@ -389,7 +387,7 @@ static unsigned char snd_cs4231_original_image[32] =
        0x00,                   /* 1f/31 - cbrl */
 };
 
-static u8 __cs4231_readb(cs4231_t *cp, void __iomem *reg_addr)
+static u8 __cs4231_readb(struct snd_cs4231 *cp, void __iomem *reg_addr)
 {
 #ifdef EBUS_SUPPORT
        if (cp->flags & CS4231_FLAG_EBUS) {
@@ -404,7 +402,7 @@ static u8 __cs4231_readb(cs4231_t *cp, void __iomem *reg_addr)
 #endif
 }
 
-static void __cs4231_writeb(cs4231_t *cp, u8 val, void __iomem *reg_addr)
+static void __cs4231_writeb(struct snd_cs4231 *cp, u8 val, void __iomem *reg_addr)
 {
 #ifdef EBUS_SUPPORT
        if (cp->flags & CS4231_FLAG_EBUS) {
@@ -423,7 +421,7 @@ static void __cs4231_writeb(cs4231_t *cp, u8 val, void __iomem *reg_addr)
  *  Basic I/O functions
  */
 
-static void snd_cs4231_outm(cs4231_t *chip, unsigned char reg,
+static void snd_cs4231_outm(struct snd_cs4231 *chip, unsigned char reg,
                     unsigned char mask, unsigned char value)
 {
        int timeout;
@@ -450,7 +448,7 @@ static void snd_cs4231_outm(cs4231_t *chip, unsigned char reg,
        }
 }
 
-static void snd_cs4231_dout(cs4231_t *chip, unsigned char reg, unsigned char value)
+static void snd_cs4231_dout(struct snd_cs4231 *chip, unsigned char reg, unsigned char value)
 {
        int timeout;
 
@@ -467,7 +465,7 @@ static void snd_cs4231_dout(cs4231_t *chip, unsigned char reg, unsigned char val
        mb();
 }
 
-static void snd_cs4231_out(cs4231_t *chip, unsigned char reg, unsigned char value)
+static void snd_cs4231_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char value)
 {
        int timeout;
 
@@ -485,7 +483,7 @@ static void snd_cs4231_out(cs4231_t *chip, unsigned char reg, unsigned char valu
        mb();
 }
 
-static unsigned char snd_cs4231_in(cs4231_t *chip, unsigned char reg)
+static unsigned char snd_cs4231_in(struct snd_cs4231 *chip, unsigned char reg)
 {
        int timeout;
        unsigned char ret;
@@ -508,7 +506,7 @@ static unsigned char snd_cs4231_in(cs4231_t *chip, unsigned char reg)
  *  CS4231 detection / MCE routines
  */
 
-static void snd_cs4231_busy_wait(cs4231_t *chip)
+static void snd_cs4231_busy_wait(struct snd_cs4231 *chip)
 {
        int timeout;
 
@@ -523,7 +521,7 @@ static void snd_cs4231_busy_wait(cs4231_t *chip)
                udelay(1000);
 }
 
-static void snd_cs4231_mce_up(cs4231_t *chip)
+static void snd_cs4231_mce_up(struct snd_cs4231 *chip)
 {
        unsigned long flags;
        int timeout;
@@ -544,7 +542,7 @@ static void snd_cs4231_mce_up(cs4231_t *chip)
        spin_unlock_irqrestore(&chip->lock, flags);
 }
 
-static void snd_cs4231_mce_down(cs4231_t *chip)
+static void snd_cs4231_mce_down(struct snd_cs4231 *chip)
 {
        unsigned long flags;
        int timeout;
@@ -602,16 +600,17 @@ static void snd_cs4231_mce_down(cs4231_t *chip)
        spin_unlock_irqrestore(&chip->lock, flags);
 }
 
-static void snd_cs4231_advance_dma(struct cs4231_dma_control *dma_cont, snd_pcm_substream_t *substream, unsigned int *periods_sent)
+static void snd_cs4231_advance_dma(struct cs4231_dma_control *dma_cont,
+                                  struct snd_pcm_substream *substream,
+                                  unsigned int *periods_sent)
 {
-       snd_pcm_runtime_t *runtime = substream->runtime;
+       struct snd_pcm_runtime *runtime = substream->runtime;
 
        while (1) {
                unsigned int period_size = snd_pcm_lib_period_bytes(substream);
                unsigned int offset = period_size * (*periods_sent);
 
-               if (period_size >= (1 << 24))
-                       BUG();
+               BUG_ON(period_size >= (1 << 24));
 
                if (dma_cont->request(dma_cont, runtime->dma_addr + offset, period_size))
                        return;
@@ -619,10 +618,11 @@ static void snd_cs4231_advance_dma(struct cs4231_dma_control *dma_cont, snd_pcm_
        }
 }
 
-static void cs4231_dma_trigger(snd_pcm_substream_t *substream, unsigned int what, int on)
+static void cs4231_dma_trigger(struct snd_pcm_substream *substream,
+                              unsigned int what, int on)
 {
-       cs4231_t *chip = snd_pcm_substream_chip(substream);
-       cs4231_dma_control_t *dma_cont;
+       struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
+       struct cs4231_dma_control *dma_cont;
 
        if (what & CS4231_PLAYBACK_ENABLE) {
                dma_cont = &chip->p_dma;
@@ -650,9 +650,9 @@ static void cs4231_dma_trigger(snd_pcm_substream_t *substream, unsigned int what
        }
 }
 
-static int snd_cs4231_trigger(snd_pcm_substream_t *substream, int cmd)
+static int snd_cs4231_trigger(struct snd_pcm_substream *substream, int cmd)
 {
-       cs4231_t *chip = snd_pcm_substream_chip(substream);
+       struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
        int result = 0;
 
        switch (cmd) {
@@ -660,7 +660,7 @@ static int snd_cs4231_trigger(snd_pcm_substream_t *substream, int cmd)
        case SNDRV_PCM_TRIGGER_STOP:
        {
                unsigned int what = 0;
-               snd_pcm_substream_t *s;
+               struct snd_pcm_substream *s;
                struct list_head *pos;
                unsigned long flags;
 
@@ -711,7 +711,7 @@ static unsigned char snd_cs4231_get_rate(unsigned int rate)
        return freq_bits[13];
 }
 
-static unsigned char snd_cs4231_get_format(cs4231_t *chip, int format, int channels)
+static unsigned char snd_cs4231_get_format(struct snd_cs4231 *chip, int format, int channels)
 {
        unsigned char rformat;
 
@@ -728,7 +728,7 @@ static unsigned char snd_cs4231_get_format(cs4231_t *chip, int format, int chann
        return rformat;
 }
 
-static void snd_cs4231_calibrate_mute(cs4231_t *chip, int mute)
+static void snd_cs4231_calibrate_mute(struct snd_cs4231 *chip, int mute)
 {
        unsigned long flags;
 
@@ -768,12 +768,12 @@ static void snd_cs4231_calibrate_mute(cs4231_t *chip, int mute)
        spin_unlock_irqrestore(&chip->lock, flags);
 }
 
-static void snd_cs4231_playback_format(cs4231_t *chip, snd_pcm_hw_params_t *params,
+static void snd_cs4231_playback_format(struct snd_cs4231 *chip, struct snd_pcm_hw_params *params,
                                       unsigned char pdfr)
 {
        unsigned long flags;
 
-       down(&chip->mce_mutex);
+       mutex_lock(&chip->mce_mutex);
        snd_cs4231_calibrate_mute(chip, 1);
 
        snd_cs4231_mce_up(chip);
@@ -788,15 +788,15 @@ static void snd_cs4231_playback_format(cs4231_t *chip, snd_pcm_hw_params_t *para
        snd_cs4231_mce_down(chip);
 
        snd_cs4231_calibrate_mute(chip, 0);
-       up(&chip->mce_mutex);
+       mutex_unlock(&chip->mce_mutex);
 }
 
-static void snd_cs4231_capture_format(cs4231_t *chip, snd_pcm_hw_params_t *params,
+static void snd_cs4231_capture_format(struct snd_cs4231 *chip, struct snd_pcm_hw_params *params,
                                       unsigned char cdfr)
 {
        unsigned long flags;
 
-       down(&chip->mce_mutex);
+       mutex_lock(&chip->mce_mutex);
        snd_cs4231_calibrate_mute(chip, 1);
 
        snd_cs4231_mce_up(chip);
@@ -817,25 +817,25 @@ static void snd_cs4231_capture_format(cs4231_t *chip, snd_pcm_hw_params_t *param
        snd_cs4231_mce_down(chip);
 
        snd_cs4231_calibrate_mute(chip, 0);
-       up(&chip->mce_mutex);
+       mutex_unlock(&chip->mce_mutex);
 }
 
 /*
  *  Timer interface
  */
 
-static unsigned long snd_cs4231_timer_resolution(snd_timer_t *timer)
+static unsigned long snd_cs4231_timer_resolution(struct snd_timer *timer)
 {
-       cs4231_t *chip = snd_timer_chip(timer);
+       struct snd_cs4231 *chip = snd_timer_chip(timer);
 
        return chip->image[CS4231_PLAYBK_FORMAT] & 1 ? 9969 : 9920;
 }
 
-static int snd_cs4231_timer_start(snd_timer_t *timer)
+static int snd_cs4231_timer_start(struct snd_timer *timer)
 {
        unsigned long flags;
        unsigned int ticks;
-       cs4231_t *chip = snd_timer_chip(timer);
+       struct snd_cs4231 *chip = snd_timer_chip(timer);
 
        spin_lock_irqsave(&chip->lock, flags);
        ticks = timer->sticks;
@@ -856,10 +856,10 @@ static int snd_cs4231_timer_start(snd_timer_t *timer)
        return 0;
 }
 
-static int snd_cs4231_timer_stop(snd_timer_t *timer)
+static int snd_cs4231_timer_stop(struct snd_timer *timer)
 {
        unsigned long flags;
-       cs4231_t *chip = snd_timer_chip(timer);
+       struct snd_cs4231 *chip = snd_timer_chip(timer);
 
        spin_lock_irqsave(&chip->lock, flags);
        snd_cs4231_out(chip, CS4231_ALT_FEATURE_1,
@@ -869,7 +869,7 @@ static int snd_cs4231_timer_stop(snd_timer_t *timer)
        return 0;
 }
 
-static void snd_cs4231_init(cs4231_t *chip)
+static void __init snd_cs4231_init(struct snd_cs4231 *chip)
 {
        unsigned long flags;
 
@@ -927,18 +927,18 @@ static void snd_cs4231_init(cs4231_t *chip)
 #endif
 }
 
-static int snd_cs4231_open(cs4231_t *chip, unsigned int mode)
+static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode)
 {
        unsigned long flags;
 
-       down(&chip->open_mutex);
+       mutex_lock(&chip->open_mutex);
        if ((chip->mode & mode)) {
-               up(&chip->open_mutex);
+               mutex_unlock(&chip->open_mutex);
                return -EAGAIN;
        }
        if (chip->mode & CS4231_MODE_OPEN) {
                chip->mode |= mode;
-               up(&chip->open_mutex);
+               mutex_unlock(&chip->open_mutex);
                return 0;
        }
        /* ok. now enable and ack CODEC IRQ */
@@ -958,18 +958,18 @@ static int snd_cs4231_open(cs4231_t *chip, unsigned int mode)
        spin_unlock_irqrestore(&chip->lock, flags);
 
        chip->mode = mode;
-       up(&chip->open_mutex);
+       mutex_unlock(&chip->open_mutex);
        return 0;
 }
 
-static void snd_cs4231_close(cs4231_t *chip, unsigned int mode)
+static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode)
 {
        unsigned long flags;
 
-       down(&chip->open_mutex);
+       mutex_lock(&chip->open_mutex);
        chip->mode &= ~mode;
        if (chip->mode & CS4231_MODE_OPEN) {
-               up(&chip->open_mutex);
+               mutex_unlock(&chip->open_mutex);
                return;
        }
        snd_cs4231_calibrate_mute(chip, 1);
@@ -1006,28 +1006,28 @@ static void snd_cs4231_close(cs4231_t *chip, unsigned int mode)
        snd_cs4231_calibrate_mute(chip, 0);
 
        chip->mode = 0;
-       up(&chip->open_mutex);
+       mutex_unlock(&chip->open_mutex);
 }
 
 /*
  *  timer open/close
  */
 
-static int snd_cs4231_timer_open(snd_timer_t *timer)
+static int snd_cs4231_timer_open(struct snd_timer *timer)
 {
-       cs4231_t *chip = snd_timer_chip(timer);
+       struct snd_cs4231 *chip = snd_timer_chip(timer);
        snd_cs4231_open(chip, CS4231_MODE_TIMER);
        return 0;
 }
 
-static int snd_cs4231_timer_close(snd_timer_t * timer)
+static int snd_cs4231_timer_close(struct snd_timer * timer)
 {
-       cs4231_t *chip = snd_timer_chip(timer);
+       struct snd_cs4231 *chip = snd_timer_chip(timer);
        snd_cs4231_close(chip, CS4231_MODE_TIMER);
        return 0;
 }
 
-static struct _snd_timer_hardware snd_cs4231_timer_table =
+static struct snd_timer_hardware snd_cs4231_timer_table =
 {
        .flags          =       SNDRV_TIMER_HW_AUTO,
        .resolution     =       9945,
@@ -1043,10 +1043,10 @@ static struct _snd_timer_hardware snd_cs4231_timer_table =
  *  ok.. exported functions..
  */
 
-static int snd_cs4231_playback_hw_params(snd_pcm_substream_t *substream,
-                                        snd_pcm_hw_params_t *hw_params)
+static int snd_cs4231_playback_hw_params(struct snd_pcm_substream *substream,
+                                        struct snd_pcm_hw_params *hw_params)
 {
-       cs4231_t *chip = snd_pcm_substream_chip(substream);
+       struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
        unsigned char new_pdfr;
        int err;
 
@@ -1061,15 +1061,15 @@ static int snd_cs4231_playback_hw_params(snd_pcm_substream_t *substream,
        return 0;
 }
 
-static int snd_cs4231_playback_hw_free(snd_pcm_substream_t *substream)
+static int snd_cs4231_playback_hw_free(struct snd_pcm_substream *substream)
 {
        return snd_pcm_lib_free_pages(substream);
 }
 
-static int snd_cs4231_playback_prepare(snd_pcm_substream_t *substream)
+static int snd_cs4231_playback_prepare(struct snd_pcm_substream *substream)
 {
-       cs4231_t *chip = snd_pcm_substream_chip(substream);
-       snd_pcm_runtime_t *runtime = substream->runtime;
+       struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
        unsigned long flags;
 
        spin_lock_irqsave(&chip->lock, flags);
@@ -1077,8 +1077,7 @@ static int snd_cs4231_playback_prepare(snd_pcm_substream_t *substream)
        chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE |
                                            CS4231_PLAYBACK_PIO);
 
-       if (runtime->period_size > 0xffff + 1)
-               BUG();
+       BUG_ON(runtime->period_size > 0xffff + 1);
 
        chip->p_periods_sent = 0;
        spin_unlock_irqrestore(&chip->lock, flags);
@@ -1086,10 +1085,10 @@ static int snd_cs4231_playback_prepare(snd_pcm_substream_t *substream)
        return 0;
 }
 
-static int snd_cs4231_capture_hw_params(snd_pcm_substream_t *substream,
-                                       snd_pcm_hw_params_t *hw_params)
+static int snd_cs4231_capture_hw_params(struct snd_pcm_substream *substream,
+                                       struct snd_pcm_hw_params *hw_params)
 {
-       cs4231_t *chip = snd_pcm_substream_chip(substream);
+       struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
        unsigned char new_cdfr;
        int err;
 
@@ -1104,14 +1103,14 @@ static int snd_cs4231_capture_hw_params(snd_pcm_substream_t *substream,
        return 0;
 }
 
-static int snd_cs4231_capture_hw_free(snd_pcm_substream_t *substream)
+static int snd_cs4231_capture_hw_free(struct snd_pcm_substream *substream)
 {
        return snd_pcm_lib_free_pages(substream);
 }
 
-static int snd_cs4231_capture_prepare(snd_pcm_substream_t *substream)
+static int snd_cs4231_capture_prepare(struct snd_pcm_substream *substream)
 {
-       cs4231_t *chip = snd_pcm_substream_chip(substream);
+       struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
        unsigned long flags;
 
        spin_lock_irqsave(&chip->lock, flags);
@@ -1125,7 +1124,7 @@ static int snd_cs4231_capture_prepare(snd_pcm_substream_t *substream)
        return 0;
 }
 
-static void snd_cs4231_overrange(cs4231_t *chip)
+static void snd_cs4231_overrange(struct snd_cs4231 *chip)
 {
        unsigned long flags;
        unsigned char res;
@@ -1138,10 +1137,8 @@ static void snd_cs4231_overrange(cs4231_t *chip)
                chip->capture_substream->runtime->overrange++;
 }
 
-static void snd_cs4231_play_callback(cs4231_t *cookie)
+static void snd_cs4231_play_callback(struct snd_cs4231 *chip)
 {
-       cs4231_t *chip = cookie;
-
        if (chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE) {
                snd_pcm_period_elapsed(chip->playback_substream);
                snd_cs4231_advance_dma(&chip->p_dma, chip->playback_substream,
@@ -1149,10 +1146,8 @@ static void snd_cs4231_play_callback(cs4231_t *cookie)
        }
 }
 
-static void snd_cs4231_capture_callback(cs4231_t *cookie)
+static void snd_cs4231_capture_callback(struct snd_cs4231 *chip)
 {
-       cs4231_t *chip = cookie;
-
        if (chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE) {
                snd_pcm_period_elapsed(chip->capture_substream);
                snd_cs4231_advance_dma(&chip->c_dma, chip->capture_substream,
@@ -1160,10 +1155,10 @@ static void snd_cs4231_capture_callback(cs4231_t *cookie)
        }
 }
 
-static snd_pcm_uframes_t snd_cs4231_playback_pointer(snd_pcm_substream_t *substream)
+static snd_pcm_uframes_t snd_cs4231_playback_pointer(struct snd_pcm_substream *substream)
 {
-       cs4231_t *chip = snd_pcm_substream_chip(substream);
-       cs4231_dma_control_t *dma_cont = &chip->p_dma;
+       struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
+       struct cs4231_dma_control *dma_cont = &chip->p_dma;
        size_t ptr;
        
        if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE))
@@ -1175,10 +1170,10 @@ static snd_pcm_uframes_t snd_cs4231_playback_pointer(snd_pcm_substream_t *substr
        return bytes_to_frames(substream->runtime, ptr);
 }
 
-static snd_pcm_uframes_t snd_cs4231_capture_pointer(snd_pcm_substream_t * substream)
+static snd_pcm_uframes_t snd_cs4231_capture_pointer(struct snd_pcm_substream *substream)
 {
-       cs4231_t *chip = snd_pcm_substream_chip(substream);
-       cs4231_dma_control_t *dma_cont = &chip->c_dma;
+       struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
+       struct cs4231_dma_control *dma_cont = &chip->c_dma;
        size_t ptr;
        
        if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE))
@@ -1194,7 +1189,7 @@ static snd_pcm_uframes_t snd_cs4231_capture_pointer(snd_pcm_substream_t * substr
 
  */
 
-static int snd_cs4231_probe(cs4231_t *chip)
+static int __init snd_cs4231_probe(struct snd_cs4231 *chip)
 {
        unsigned long flags;
        int i, id, vers;
@@ -1259,7 +1254,7 @@ static int snd_cs4231_probe(cs4231_t *chip)
        return 0;               /* all things are ok.. */
 }
 
-static snd_pcm_hardware_t snd_cs4231_playback =
+static struct snd_pcm_hardware snd_cs4231_playback =
 {
        .info                   = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
                                 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START),
@@ -1279,7 +1274,7 @@ static snd_pcm_hardware_t snd_cs4231_playback =
        .periods_max            = 1024,
 };
 
-static snd_pcm_hardware_t snd_cs4231_capture =
+static struct snd_pcm_hardware snd_cs4231_capture =
 {
        .info                   = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
                                 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START),
@@ -1299,10 +1294,10 @@ static snd_pcm_hardware_t snd_cs4231_capture =
        .periods_max            = 1024,
 };
 
-static int snd_cs4231_playback_open(snd_pcm_substream_t *substream)
+static int snd_cs4231_playback_open(struct snd_pcm_substream *substream)
 {
-       cs4231_t *chip = snd_pcm_substream_chip(substream);
-       snd_pcm_runtime_t *runtime = substream->runtime;
+       struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
        int err;
 
        runtime->hw = snd_cs4231_playback;
@@ -1319,10 +1314,10 @@ static int snd_cs4231_playback_open(snd_pcm_substream_t *substream)
        return 0;
 }
 
-static int snd_cs4231_capture_open(snd_pcm_substream_t *substream)
+static int snd_cs4231_capture_open(struct snd_pcm_substream *substream)
 {
-       cs4231_t *chip = snd_pcm_substream_chip(substream);
-       snd_pcm_runtime_t *runtime = substream->runtime;
+       struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
        int err;
 
        runtime->hw = snd_cs4231_capture;
@@ -1339,9 +1334,9 @@ static int snd_cs4231_capture_open(snd_pcm_substream_t *substream)
        return 0;
 }
 
-static int snd_cs4231_playback_close(snd_pcm_substream_t *substream)
+static int snd_cs4231_playback_close(struct snd_pcm_substream *substream)
 {
-       cs4231_t *chip = snd_pcm_substream_chip(substream);
+       struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
 
        snd_cs4231_close(chip, CS4231_MODE_PLAY);
        chip->playback_substream = NULL;
@@ -1349,9 +1344,9 @@ static int snd_cs4231_playback_close(snd_pcm_substream_t *substream)
        return 0;
 }
 
-static int snd_cs4231_capture_close(snd_pcm_substream_t *substream)
+static int snd_cs4231_capture_close(struct snd_pcm_substream *substream)
 {
-       cs4231_t *chip = snd_pcm_substream_chip(substream);
+       struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
 
        snd_cs4231_close(chip, CS4231_MODE_RECORD);
        chip->capture_substream = NULL;
@@ -1363,7 +1358,7 @@ static int snd_cs4231_capture_close(snd_pcm_substream_t *substream)
  * XXX the audio AUXIO register...
  */
 
-static snd_pcm_ops_t snd_cs4231_playback_ops = {
+static struct snd_pcm_ops snd_cs4231_playback_ops = {
        .open           =       snd_cs4231_playback_open,
        .close          =       snd_cs4231_playback_close,
        .ioctl          =       snd_pcm_lib_ioctl,
@@ -1374,7 +1369,7 @@ static snd_pcm_ops_t snd_cs4231_playback_ops = {
        .pointer        =       snd_cs4231_playback_pointer,
 };
 
-static snd_pcm_ops_t snd_cs4231_capture_ops = {
+static struct snd_pcm_ops snd_cs4231_capture_ops = {
        .open           =       snd_cs4231_capture_open,
        .close          =       snd_cs4231_capture_close,
        .ioctl          =       snd_pcm_lib_ioctl,
@@ -1385,16 +1380,9 @@ static snd_pcm_ops_t snd_cs4231_capture_ops = {
        .pointer        =       snd_cs4231_capture_pointer,
 };
 
-static void snd_cs4231_pcm_free(snd_pcm_t *pcm)
-{
-       cs4231_t *chip = pcm->private_data;
-       chip->pcm = NULL;
-       snd_pcm_lib_preallocate_free_for_all(pcm);
-}
-
-int snd_cs4231_pcm(cs4231_t *chip)
+static int __init snd_cs4231_pcm(struct snd_cs4231 *chip)
 {
-       snd_pcm_t *pcm;
+       struct snd_pcm *pcm;
        int err;
 
        if ((err = snd_pcm_new(chip->card, "CS4231", 0, 1, 1, &pcm)) < 0)
@@ -1405,7 +1393,6 @@ int snd_cs4231_pcm(cs4231_t *chip)
        
        /* global setup */
        pcm->private_data = chip;
-       pcm->private_free = snd_cs4231_pcm_free;
        pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX;
        strcpy(pcm->name, "CS4231");
 
@@ -1416,16 +1403,10 @@ int snd_cs4231_pcm(cs4231_t *chip)
        return 0;
 }
 
-static void snd_cs4231_timer_free(snd_timer_t *timer)
-{
-       cs4231_t *chip = timer->private_data;
-       chip->timer = NULL;
-}
-
-int snd_cs4231_timer(cs4231_t *chip)
+static int __init snd_cs4231_timer(struct snd_cs4231 *chip)
 {
-       snd_timer_t *timer;
-       snd_timer_id_t tid;
+       struct snd_timer *timer;
+       struct snd_timer_id tid;
        int err;
 
        /* Timer initialization */
@@ -1438,7 +1419,6 @@ int snd_cs4231_timer(cs4231_t *chip)
                return err;
        strcpy(timer->name, "CS4231");
        timer->private_data = chip;
-       timer->private_free = snd_cs4231_timer_free;
        timer->hw = snd_cs4231_timer_table;
        chip->timer = timer;
 
@@ -1449,12 +1429,13 @@ int snd_cs4231_timer(cs4231_t *chip)
  *  MIXER part
  */
 
-static int snd_cs4231_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+static int snd_cs4231_info_mux(struct snd_kcontrol *kcontrol,
+                              struct snd_ctl_elem_info *uinfo)
 {
        static char *texts[4] = {
                "Line", "CD", "Mic", "Mix"
        };
-       cs4231_t *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
 
        snd_assert(chip->card != NULL, return -EINVAL);
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
@@ -1467,9 +1448,10 @@ static int snd_cs4231_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *ui
        return 0;
 }
 
-static int snd_cs4231_get_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_cs4231_get_mux(struct snd_kcontrol *kcontrol,
+                             struct snd_ctl_elem_value *ucontrol)
 {
-       cs4231_t *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        
        spin_lock_irqsave(&chip->lock, flags);
@@ -1482,9 +1464,10 @@ static int snd_cs4231_get_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc
        return 0;
 }
 
-static int snd_cs4231_put_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_cs4231_put_mux(struct snd_kcontrol *kcontrol,
+                             struct snd_ctl_elem_value *ucontrol)
 {
-       cs4231_t *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        unsigned short left, right;
        int change;
@@ -1509,7 +1492,8 @@ static int snd_cs4231_put_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc
        return change;
 }
 
-int snd_cs4231_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+static int snd_cs4231_info_single(struct snd_kcontrol *kcontrol,
+                                 struct snd_ctl_elem_info *uinfo)
 {
        int mask = (kcontrol->private_value >> 16) & 0xff;
 
@@ -1522,9 +1506,10 @@ int snd_cs4231_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
        return 0;
 }
 
-int snd_cs4231_get_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_cs4231_get_single(struct snd_kcontrol *kcontrol,
+                                struct snd_ctl_elem_value *ucontrol)
 {
-       cs4231_t *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int reg = kcontrol->private_value & 0xff;
        int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -1544,9 +1529,10 @@ int snd_cs4231_get_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontr
        return 0;
 }
 
-int snd_cs4231_put_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_cs4231_put_single(struct snd_kcontrol *kcontrol,
+                                struct snd_ctl_elem_value *ucontrol)
 {
-       cs4231_t *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int reg = kcontrol->private_value & 0xff;
        int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -1571,7 +1557,8 @@ int snd_cs4231_put_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontr
        return change;
 }
 
-int snd_cs4231_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+static int snd_cs4231_info_double(struct snd_kcontrol *kcontrol,
+                                 struct snd_ctl_elem_info *uinfo)
 {
        int mask = (kcontrol->private_value >> 24) & 0xff;
 
@@ -1584,9 +1571,10 @@ int snd_cs4231_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
        return 0;
 }
 
-int snd_cs4231_get_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_cs4231_get_double(struct snd_kcontrol *kcontrol,
+                                struct snd_ctl_elem_value *ucontrol)
 {
-       cs4231_t *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int left_reg = kcontrol->private_value & 0xff;
        int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -1612,9 +1600,10 @@ int snd_cs4231_get_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontr
        return 0;
 }
 
-int snd_cs4231_put_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_cs4231_put_double(struct snd_kcontrol *kcontrol,
+                                struct snd_ctl_elem_value *ucontrol)
 {
-       cs4231_t *chip = snd_kcontrol_chip(kcontrol);
+       struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
        unsigned long flags;
        int left_reg = kcontrol->private_value & 0xff;
        int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -1659,7 +1648,7 @@ int snd_cs4231_put_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontr
   .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \
   .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
 
-static snd_kcontrol_new_t snd_cs4231_controls[] = {
+static struct snd_kcontrol_new snd_cs4231_controls[] __initdata = {
 CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
 CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1),
 CS4231_DOUBLE("Line Playback Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1),
@@ -1688,9 +1677,9 @@ CS4231_SINGLE("Line Out Switch", 0, CS4231_PIN_CTRL, 6, 1, 1),
 CS4231_SINGLE("Headphone Out Switch", 0, CS4231_PIN_CTRL, 7, 1, 1)
 };
                                         
-int snd_cs4231_mixer(cs4231_t *chip)
+static int __init snd_cs4231_mixer(struct snd_cs4231 *chip)
 {
-       snd_card_t *card;
+       struct snd_card *card;
        int err, idx;
 
        snd_assert(chip != NULL && chip->pcm != NULL, return -EINVAL);
@@ -1710,9 +1699,9 @@ int snd_cs4231_mixer(cs4231_t *chip)
 
 static int dev;
 
-static int cs4231_attach_begin(snd_card_t **rcard)
+static int __init cs4231_attach_begin(struct snd_card **rcard)
 {
-       snd_card_t *card;
+       struct snd_card *card;
 
        *rcard = NULL;
 
@@ -1735,7 +1724,7 @@ static int cs4231_attach_begin(snd_card_t **rcard)
        return 0;
 }
 
-static int cs4231_attach_finish(snd_card_t *card, cs4231_t *chip)
+static int __init cs4231_attach_finish(struct snd_card *card, struct snd_cs4231 *chip)
 {
        int err;
 
@@ -1748,9 +1737,6 @@ static int cs4231_attach_finish(snd_card_t *card, cs4231_t *chip)
        if ((err = snd_cs4231_timer(chip)) < 0)
                goto out_err;
 
-       if ((err = snd_card_set_generic_dev(card)) < 0)
-               goto out_err;
-
        if ((err = snd_card_register(card)) < 0)
                goto out_err;
 
@@ -1772,7 +1758,7 @@ static irqreturn_t snd_cs4231_sbus_interrupt(int irq, void *dev_id, struct pt_re
        unsigned long flags;
        unsigned char status;
        u32 csr;
-       cs4231_t *chip = dev_id;
+       struct snd_cs4231 *chip = dev_id;
 
        /*This is IRQ is not raised by the cs4231*/
        if (!(__cs4231_readb(chip, CS4231P(chip, STATUS)) & CS4231_GLOBALIRQ))
@@ -1817,12 +1803,12 @@ static irqreturn_t snd_cs4231_sbus_interrupt(int irq, void *dev_id, struct pt_re
  * SBUS DMA routines
  */
 
-int sbus_dma_request(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len)
+static int sbus_dma_request(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len)
 {
        unsigned long flags;
        u32 test, csr;
        int err;
-       sbus_dma_info_t *base = &dma_cont->sbus_info;
+       struct sbus_dma_info *base = &dma_cont->sbus_info;
        
        if (len >= (1 << 24))
                return -EINVAL;
@@ -1849,11 +1835,11 @@ out:
        return err;
 }
 
-void sbus_dma_prepare(struct cs4231_dma_control *dma_cont, int d)
+static void sbus_dma_prepare(struct cs4231_dma_control *dma_cont, int d)
 {
        unsigned long flags;
        u32 csr, test;
-       sbus_dma_info_t *base = &dma_cont->sbus_info;
+       struct sbus_dma_info *base = &dma_cont->sbus_info;
 
        spin_lock_irqsave(&base->lock, flags);
        csr = sbus_readl(base->regs + APCCSR);
@@ -1868,11 +1854,11 @@ void sbus_dma_prepare(struct cs4231_dma_control *dma_cont, int d)
        spin_unlock_irqrestore(&base->lock, flags);
 }
 
-void sbus_dma_enable(struct cs4231_dma_control *dma_cont, int on)
+static void sbus_dma_enable(struct cs4231_dma_control *dma_cont, int on)
 {
        unsigned long flags;
        u32 csr, shift;
-       sbus_dma_info_t *base = &dma_cont->sbus_info;
+       struct sbus_dma_info *base = &dma_cont->sbus_info;
 
        spin_lock_irqsave(&base->lock, flags);
        if (!on) {
@@ -1905,14 +1891,14 @@ void sbus_dma_enable(struct cs4231_dma_control *dma_cont, int on)
        spin_unlock_irqrestore(&base->lock, flags);
 }
 
-unsigned int sbus_dma_addr(struct cs4231_dma_control *dma_cont)
+static unsigned int sbus_dma_addr(struct cs4231_dma_control *dma_cont)
 {
-       sbus_dma_info_t *base = &dma_cont->sbus_info;
+       struct sbus_dma_info *base = &dma_cont->sbus_info;
 
         return sbus_readl(base->regs + base->dir + APCVA);
 }
 
-void sbus_dma_reset(cs4231_t *chip)
+static void sbus_dma_reset(struct snd_cs4231 *chip)
 {
         sbus_writel(APC_CHIP_RESET, chip->port + APCCSR);
         sbus_writel(0x00, chip->port + APCCSR);
@@ -1929,7 +1915,7 @@ void sbus_dma_reset(cs4231_t *chip)
                       chip->port + APCCSR);
 }
 
-void sbus_dma_preallocate(cs4231_t *chip, snd_pcm_t *pcm)
+static void sbus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm)
 {
        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS,
                                              snd_dma_sbus_data(chip->dev_u.sdev),
@@ -1940,7 +1926,7 @@ void sbus_dma_preallocate(cs4231_t *chip, snd_pcm_t *pcm)
  * Init and exit routines
  */
 
-static int snd_cs4231_sbus_free(cs4231_t *chip)
+static int snd_cs4231_sbus_free(struct snd_cs4231 *chip)
 {
        if (chip->irq[0])
                free_irq(chip->irq[0], chip);
@@ -1948,31 +1934,28 @@ static int snd_cs4231_sbus_free(cs4231_t *chip)
        if (chip->port)
                sbus_iounmap(chip->port, chip->regs_size);
 
-       if (chip->timer)
-               snd_device_free(chip->card, chip->timer);
-
        kfree(chip);
 
        return 0;
 }
 
-static int snd_cs4231_sbus_dev_free(snd_device_t *device)
+static int snd_cs4231_sbus_dev_free(struct snd_device *device)
 {
-       cs4231_t *cp = device->device_data;
+       struct snd_cs4231 *cp = device->device_data;
 
        return snd_cs4231_sbus_free(cp);
 }
 
-static snd_device_ops_t snd_cs4231_sbus_dev_ops = {
+static struct snd_device_ops snd_cs4231_sbus_dev_ops = {
        .dev_free       =       snd_cs4231_sbus_dev_free,
 };
 
-static int __init snd_cs4231_sbus_create(snd_card_t *card,
+static int __init snd_cs4231_sbus_create(struct snd_card *card,
                                         struct sbus_dev *sdev,
                                         int dev,
-                                        cs4231_t **rchip)
+                                        struct snd_cs4231 **rchip)
 {
-       cs4231_t *chip;
+       struct snd_cs4231 *chip;
        int err;
 
        *rchip = NULL;
@@ -1983,8 +1966,8 @@ static int __init snd_cs4231_sbus_create(snd_card_t *card,
        spin_lock_init(&chip->lock);
        spin_lock_init(&chip->c_dma.sbus_info.lock);
        spin_lock_init(&chip->p_dma.sbus_info.lock);
-       init_MUTEX(&chip->mce_mutex);
-       init_MUTEX(&chip->open_mutex);
+       mutex_init(&chip->mce_mutex);
+       mutex_init(&chip->open_mutex);
        chip->card = card;
        chip->dev_u.sdev = sdev;
        chip->regs_size = sdev->reg_addrs[0].reg_size;
@@ -2018,10 +2001,9 @@ static int __init snd_cs4231_sbus_create(snd_card_t *card,
        chip->c_dma.preallocate = sbus_dma_preallocate;
 
        if (request_irq(sdev->irqs[0], snd_cs4231_sbus_interrupt,
-                       SA_SHIRQ, "cs4231", chip)) {
-               snd_printdd("cs4231-%d: Unable to grab SBUS IRQ %s\n",
-                          dev,
-                          __irq_itoa(sdev->irqs[0]));
+                       IRQF_SHARED, "cs4231", chip)) {
+               snd_printdd("cs4231-%d: Unable to grab SBUS IRQ %d\n",
+                           dev, sdev->irqs[0]);
                snd_cs4231_sbus_free(chip);
                return -EBUSY;
        }
@@ -2043,22 +2025,22 @@ static int __init snd_cs4231_sbus_create(snd_card_t *card,
        return 0;
 }
 
-static int cs4231_sbus_attach(struct sbus_dev *sdev)
+static int __init cs4231_sbus_attach(struct sbus_dev *sdev)
 {
        struct resource *rp = &sdev->resource[0];
-       cs4231_t *cp;
-       snd_card_t *card;
+       struct snd_cs4231 *cp;
+       struct snd_card *card;
        int err;
 
        err = cs4231_attach_begin(&card);
        if (err)
                return err;
 
-       sprintf(card->longname, "%s at 0x%02lx:0x%08lx, irq %s",
+       sprintf(card->longname, "%s at 0x%02lx:0x%016Lx, irq %d",
                card->shortname,
                rp->flags & 0xffL,
-               rp->start,
-               __irq_itoa(sdev->irqs[0]));
+               (unsigned long long)rp->start,
+               sdev->irqs[0]);
 
        if ((err = snd_cs4231_sbus_create(card, sdev, dev, &cp)) < 0) {
                snd_card_free(card);
@@ -2073,14 +2055,14 @@ static int cs4231_sbus_attach(struct sbus_dev *sdev)
 
 static void snd_cs4231_ebus_play_callback(struct ebus_dma_info *p, int event, void *cookie)
 {
-       cs4231_t *chip = cookie;
+       struct snd_cs4231 *chip = cookie;
        
        snd_cs4231_play_callback(chip);
 }
 
 static void snd_cs4231_ebus_capture_callback(struct ebus_dma_info *p, int event, void *cookie)
 {
-       cs4231_t *chip = cookie;
+       struct snd_cs4231 *chip = cookie;
 
        snd_cs4231_capture_callback(chip);
 }
@@ -2089,32 +2071,32 @@ static void snd_cs4231_ebus_capture_callback(struct ebus_dma_info *p, int event,
  * EBUS DMA wrappers
  */
 
-int _ebus_dma_request(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len)
+static int _ebus_dma_request(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len)
 {
        return ebus_dma_request(&dma_cont->ebus_info, bus_addr, len);
 }
 
-void _ebus_dma_enable(struct cs4231_dma_control *dma_cont, int on)
+static void _ebus_dma_enable(struct cs4231_dma_control *dma_cont, int on)
 {
        ebus_dma_enable(&dma_cont->ebus_info, on);
 }
 
-void _ebus_dma_prepare(struct cs4231_dma_control *dma_cont, int dir)
+static void _ebus_dma_prepare(struct cs4231_dma_control *dma_cont, int dir)
 {
        ebus_dma_prepare(&dma_cont->ebus_info, dir);
 }
 
-unsigned int _ebus_dma_addr(struct cs4231_dma_control *dma_cont)
+static unsigned int _ebus_dma_addr(struct cs4231_dma_control *dma_cont)
 {
        return ebus_dma_addr(&dma_cont->ebus_info);
 }
 
-void _ebus_dma_reset(cs4231_t *chip)
+static void _ebus_dma_reset(struct snd_cs4231 *chip)
 {
        return;
 }
 
-void _ebus_dma_preallocate(cs4231_t *chip, snd_pcm_t *pcm)
+static void _ebus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm)
 {
        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
                                      snd_dma_pci_data(chip->dev_u.pdev),
@@ -2125,7 +2107,7 @@ void _ebus_dma_preallocate(cs4231_t *chip, snd_pcm_t *pcm)
  * Init and exit routines
  */
 
-static int snd_cs4231_ebus_free(cs4231_t *chip)
+static int snd_cs4231_ebus_free(struct snd_cs4231 *chip)
 {
        if (chip->c_dma.ebus_info.regs) {
                ebus_dma_unregister(&chip->c_dma.ebus_info);
@@ -2138,31 +2120,29 @@ static int snd_cs4231_ebus_free(cs4231_t *chip)
 
        if (chip->port)
                iounmap(chip->port);
-       if (chip->timer)
-               snd_device_free(chip->card, chip->timer);
 
        kfree(chip);
 
        return 0;
 }
 
-static int snd_cs4231_ebus_dev_free(snd_device_t *device)
+static int snd_cs4231_ebus_dev_free(struct snd_device *device)
 {
-       cs4231_t *cp = device->device_data;
+       struct snd_cs4231 *cp = device->device_data;
 
        return snd_cs4231_ebus_free(cp);
 }
 
-static snd_device_ops_t snd_cs4231_ebus_dev_ops = {
+static struct snd_device_ops snd_cs4231_ebus_dev_ops = {
        .dev_free       =       snd_cs4231_ebus_dev_free,
 };
 
-static int __init snd_cs4231_ebus_create(snd_card_t *card,
+static int __init snd_cs4231_ebus_create(struct snd_card *card,
                                         struct linux_ebus_device *edev,
                                         int dev,
-                                        cs4231_t **rchip)
+                                        struct snd_cs4231 **rchip)
 {
-       cs4231_t *chip;
+       struct snd_cs4231 *chip;
        int err;
 
        *rchip = NULL;
@@ -2173,8 +2153,8 @@ static int __init snd_cs4231_ebus_create(snd_card_t *card,
        spin_lock_init(&chip->lock);
        spin_lock_init(&chip->c_dma.ebus_info.lock);
        spin_lock_init(&chip->p_dma.ebus_info.lock);
-       init_MUTEX(&chip->mce_mutex);
-       init_MUTEX(&chip->open_mutex);
+       mutex_init(&chip->mce_mutex);
+       mutex_init(&chip->open_mutex);
        chip->flags |= CS4231_FLAG_EBUS;
        chip->card = card;
        chip->dev_u.pdev = edev->bus->self;
@@ -2252,20 +2232,20 @@ static int __init snd_cs4231_ebus_create(snd_card_t *card,
        return 0;
 }
 
-static int cs4231_ebus_attach(struct linux_ebus_device *edev)
+static int __init cs4231_ebus_attach(struct linux_ebus_device *edev)
 {
-       snd_card_t *card;
-       cs4231_t *chip;
+       struct snd_card *card;
+       struct snd_cs4231 *chip;
        int err;
 
        err = cs4231_attach_begin(&card);
        if (err)
                return err;
 
-       sprintf(card->longname, "%s at 0x%lx, irq %s",
+       sprintf(card->longname, "%s at 0x%lx, irq %d",
                card->shortname,
                edev->resource[0].start,
-               __irq_itoa(edev->irqs[0]));
+               edev->irqs[0]);
 
        if ((err = snd_cs4231_ebus_create(card, edev, dev, &chip)) < 0) {
                snd_card_free(card);
@@ -2303,15 +2283,14 @@ static int __init cs4231_init(void)
                for_each_ebusdev(edev, ebus) {
                        int match = 0;
 
-                       if (!strcmp(edev->prom_name, "SUNW,CS4231")) {
+                       if (!strcmp(edev->prom_node->name, "SUNW,CS4231")) {
                                match = 1;
-                       } else if (!strcmp(edev->prom_name, "audio")) {
-                               char compat[16];
+                       } else if (!strcmp(edev->prom_node->name, "audio")) {
+                               char *compat;
 
-                               prom_getstring(edev->prom_node, "compatible",
-                                              compat, sizeof(compat));
-                               compat[15] = '\0';
-                               if (!strcmp(compat, "SUNW,CS4231"))
+                               compat = of_get_property(edev->prom_node,
+                                                        "compatible", NULL);
+                               if (compat && !strcmp(compat, "SUNW,CS4231"))
                                        match = 1;
                        }
 
@@ -2328,10 +2307,10 @@ static int __init cs4231_init(void)
 
 static void __exit cs4231_exit(void)
 {
-       cs4231_t *p = cs4231_list;
+       struct snd_cs4231 *p = cs4231_list;
 
        while (p != NULL) {
-               cs4231_t *next = p->next;
+               struct snd_cs4231 *next = p->next;
 
                snd_card_free(p->card);