diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index f0d8c7f24f27..c87000130dd2 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -302,12 +302,6 @@ DEFINE_VIA_REGSET(CAPTURE_8233, 0x60); #define VIA_DXS_SRC 5 -/* - */ - -typedef struct _snd_via82xx via82xx_t; -typedef struct via_dev viadev_t; - /* * pcm stream */ @@ -319,11 +313,11 @@ struct snd_via_sg_table { #define VIA_TABLE_SIZE 255 -struct via_dev { +struct viadev { unsigned int reg_offset; unsigned long port; int direction; /* playback = 0, capture = 1 */ - snd_pcm_substream_t *substream; + struct snd_pcm_substream *substream; int running; unsigned int tbl_entries; /* # descriptors */ struct snd_dma_buffer table; @@ -350,7 +344,7 @@ struct via_rate_lock { int used; }; -struct _snd_via82xx { +struct via82xx { int irq; unsigned long port; @@ -374,27 +368,27 @@ struct _snd_via82xx { unsigned int intr_mask; /* SGD_SHADOW mask to check interrupts */ struct pci_dev *pci; - snd_card_t *card; + struct snd_card *card; unsigned int num_devs; unsigned int playback_devno, multi_devno, capture_devno; - viadev_t devs[VIA_MAX_DEVS]; + struct viadev devs[VIA_MAX_DEVS]; struct via_rate_lock rates[2]; /* playback and capture */ unsigned int dxs_fixed: 1; /* DXS channel accepts only 48kHz */ unsigned int no_vra: 1; /* no need to set VRA on DXS channels */ unsigned int dxs_src: 1; /* use full SRC capabilities of DXS */ unsigned int spdif_on: 1; /* only spdif rates work to external DACs */ - snd_pcm_t *pcms[2]; - snd_rawmidi_t *rmidi; + struct snd_pcm *pcms[2]; + struct snd_rawmidi *rmidi; - ac97_bus_t *ac97_bus; - ac97_t *ac97; + struct snd_ac97_bus *ac97_bus; + struct snd_ac97 *ac97; unsigned int ac97_clock; unsigned int ac97_secondary; /* secondary AC'97 codec is present */ spinlock_t reg_lock; - snd_info_entry_t *proc_entry; + struct snd_info_entry *proc_entry; #ifdef SUPPORT_JOYSTICK struct gameport *gameport; @@ -419,12 +413,12 @@ MODULE_DEVICE_TABLE(pci, snd_via82xx_ids); * periods = number of periods * fragsize = period size in bytes */ -static int build_via_table(viadev_t *dev, snd_pcm_substream_t *substream, +static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substream, struct pci_dev *pci, unsigned int periods, unsigned int fragsize) { unsigned int i, idx, ofs, rest; - via82xx_t *chip = snd_pcm_substream_chip(substream); + struct via82xx *chip = snd_pcm_substream_chip(substream); struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); if (dev->table.area == NULL) { @@ -487,7 +481,7 @@ static int build_via_table(viadev_t *dev, snd_pcm_substream_t *substream, } -static int clean_via_table(viadev_t *dev, snd_pcm_substream_t *substream, +static int clean_via_table(struct viadev *dev, struct snd_pcm_substream *substream, struct pci_dev *pci) { if (dev->table.area) { @@ -503,17 +497,17 @@ static int clean_via_table(viadev_t *dev, snd_pcm_substream_t *substream, * Basic I/O */ -static inline unsigned int snd_via82xx_codec_xread(via82xx_t *chip) +static inline unsigned int snd_via82xx_codec_xread(struct via82xx *chip) { return inl(VIAREG(chip, AC97)); } -static inline void snd_via82xx_codec_xwrite(via82xx_t *chip, unsigned int val) +static inline void snd_via82xx_codec_xwrite(struct via82xx *chip, unsigned int val) { outl(val, VIAREG(chip, AC97)); } -static int snd_via82xx_codec_ready(via82xx_t *chip, int secondary) +static int snd_via82xx_codec_ready(struct via82xx *chip, int secondary) { unsigned int timeout = 1000; /* 1ms */ unsigned int val; @@ -523,11 +517,12 @@ static int snd_via82xx_codec_ready(via82xx_t *chip, int secondary) if (!((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)) return val & 0xffff; } - snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_via82xx_codec_xread(chip)); + snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", + secondary, snd_via82xx_codec_xread(chip)); return -EIO; } -static int snd_via82xx_codec_valid(via82xx_t *chip, int secondary) +static int snd_via82xx_codec_valid(struct via82xx *chip, int secondary) { unsigned int timeout = 1000; /* 1ms */ unsigned int val, val1; @@ -544,20 +539,20 @@ static int snd_via82xx_codec_valid(via82xx_t *chip, int secondary) return -EIO; } -static void snd_via82xx_codec_wait(ac97_t *ac97) +static void snd_via82xx_codec_wait(struct snd_ac97 *ac97) { - via82xx_t *chip = ac97->private_data; + struct via82xx *chip = ac97->private_data; int err; err = snd_via82xx_codec_ready(chip, ac97->num); /* here we need to wait fairly for long time.. */ msleep(500); } -static void snd_via82xx_codec_write(ac97_t *ac97, +static void snd_via82xx_codec_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) { - via82xx_t *chip = ac97->private_data; + struct via82xx *chip = ac97->private_data; unsigned int xval; xval = !ac97->num ? VIA_REG_AC97_CODEC_ID_PRIMARY : VIA_REG_AC97_CODEC_ID_SECONDARY; @@ -568,9 +563,9 @@ static void snd_via82xx_codec_write(ac97_t *ac97, snd_via82xx_codec_ready(chip, ac97->num); } -static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg) +static unsigned short snd_via82xx_codec_read(struct snd_ac97 *ac97, unsigned short reg) { - via82xx_t *chip = ac97->private_data; + struct via82xx *chip = ac97->private_data; unsigned int xval, val = 0xffff; int again = 0; @@ -580,7 +575,8 @@ static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg) xval |= (reg & 0x7f) << VIA_REG_AC97_CMD_SHIFT; while (1) { if (again++ > 3) { - snd_printk(KERN_ERR "codec_read: codec %i is not valid [0x%x]\n", ac97->num, snd_via82xx_codec_xread(chip)); + snd_printk(KERN_ERR "codec_read: codec %i is not valid [0x%x]\n", + ac97->num, snd_via82xx_codec_xread(chip)); return 0xffff; } snd_via82xx_codec_xwrite(chip, xval); @@ -594,7 +590,7 @@ static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg) return val & 0xffff; } -static void snd_via82xx_channel_reset(via82xx_t *chip, viadev_t *viadev) +static void snd_via82xx_channel_reset(struct via82xx *chip, struct viadev *viadev) { outb(VIA_REG_CTRL_PAUSE | VIA_REG_CTRL_TERMINATE | VIA_REG_CTRL_RESET, VIADEV_REG(viadev, OFFSET_CONTROL)); @@ -617,7 +613,7 @@ static void snd_via82xx_channel_reset(via82xx_t *chip, viadev_t *viadev) */ static irqreturn_t snd_via686_interrupt(int irq, void *dev_id, struct pt_regs *regs) { - via82xx_t *chip = dev_id; + struct via82xx *chip = dev_id; unsigned int status; unsigned int i; @@ -632,7 +628,7 @@ static irqreturn_t snd_via686_interrupt(int irq, void *dev_id, struct pt_regs *r /* check status for each stream */ spin_lock(&chip->reg_lock); for (i = 0; i < chip->num_devs; i++) { - viadev_t *viadev = &chip->devs[i]; + struct viadev *viadev = &chip->devs[i]; unsigned char c_status = inb(VIADEV_REG(viadev, OFFSET_STATUS)); if (! (c_status & (VIA_REG_STAT_EOL|VIA_REG_STAT_FLAG|VIA_REG_STAT_STOPPED))) continue; @@ -663,7 +659,7 @@ static irqreturn_t snd_via686_interrupt(int irq, void *dev_id, struct pt_regs *r */ static irqreturn_t snd_via8233_interrupt(int irq, void *dev_id, struct pt_regs *regs) { - via82xx_t *chip = dev_id; + struct via82xx *chip = dev_id; unsigned int status; unsigned int i; int irqreturn = 0; @@ -673,8 +669,8 @@ static irqreturn_t snd_via8233_interrupt(int irq, void *dev_id, struct pt_regs * status = inl(VIAREG(chip, SGD_SHADOW)); for (i = 0; i < chip->num_devs; i++) { - viadev_t *viadev = &chip->devs[i]; - snd_pcm_substream_t *substream; + struct viadev *viadev = &chip->devs[i]; + struct snd_pcm_substream *substream; unsigned char c_status, shadow_status; shadow_status = (status >> viadev->shadow_shift) & @@ -719,10 +715,10 @@ static irqreturn_t snd_via8233_interrupt(int irq, void *dev_id, struct pt_regs * /* * trigger callback */ -static int snd_via82xx_pcm_trigger(snd_pcm_substream_t * substream, int cmd) +static int snd_via82xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; unsigned char val; if (chip->chip_type != TYPE_VIA686) @@ -766,9 +762,11 @@ static int snd_via82xx_pcm_trigger(snd_pcm_substream_t * substream, int cmd) */ #define check_invalid_pos(viadev,pos) \ - ((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 || viadev->lastpos < viadev->bufsize2)) + ((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 ||\ + viadev->lastpos < viadev->bufsize2)) -static inline unsigned int calc_linear_pos(viadev_t *viadev, unsigned int idx, unsigned int count) +static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int idx, + unsigned int count) { unsigned int size, base, res; @@ -780,7 +778,8 @@ static inline unsigned int calc_linear_pos(viadev_t *viadev, unsigned int idx, u /* check the validity of the calculated position */ if (size < count) { - snd_printd(KERN_ERR "invalid via82xx_cur_ptr (size = %d, count = %d)\n", (int)size, (int)count); + snd_printd(KERN_ERR "invalid via82xx_cur_ptr (size = %d, count = %d)\n", + (int)size, (int)count); res = viadev->lastpos; } else { if (! count) { @@ -796,12 +795,18 @@ static inline unsigned int calc_linear_pos(viadev_t *viadev, unsigned int idx, u } if (check_invalid_pos(viadev, res)) { #ifdef POINTER_DEBUG - printk(KERN_DEBUG "fail: idx = %i/%i, lastpos = 0x%x, bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, count = 0x%x\n", idx, viadev->tbl_entries, viadev->lastpos, viadev->bufsize2, viadev->idx_table[idx].offset, viadev->idx_table[idx].size, count); + printk(KERN_DEBUG "fail: idx = %i/%i, lastpos = 0x%x, " + "bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, " + "count = 0x%x\n", idx, viadev->tbl_entries, + viadev->lastpos, viadev->bufsize2, + viadev->idx_table[idx].offset, + viadev->idx_table[idx].size, count); #endif /* count register returns full size when end of buffer is reached */ res = base + size; if (check_invalid_pos(viadev, res)) { - snd_printd(KERN_ERR "invalid via82xx_cur_ptr (2), using last valid pointer\n"); + snd_printd(KERN_ERR "invalid via82xx_cur_ptr (2), " + "using last valid pointer\n"); res = viadev->lastpos; } } @@ -812,10 +817,10 @@ static inline unsigned int calc_linear_pos(viadev_t *viadev, unsigned int idx, u /* * get the current pointer on via686 */ -static snd_pcm_uframes_t snd_via686_pcm_pointer(snd_pcm_substream_t *substream) +static snd_pcm_uframes_t snd_via686_pcm_pointer(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; unsigned int idx, ptr, count, res; snd_assert(viadev->tbl_entries, return 0); @@ -842,10 +847,10 @@ static snd_pcm_uframes_t snd_via686_pcm_pointer(snd_pcm_substream_t *substream) /* * get the current pointer on via823x */ -static snd_pcm_uframes_t snd_via8233_pcm_pointer(snd_pcm_substream_t *substream) +static snd_pcm_uframes_t snd_via8233_pcm_pointer(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; unsigned int idx, count, res; int status; @@ -865,7 +870,8 @@ static snd_pcm_uframes_t snd_via8233_pcm_pointer(snd_pcm_substream_t *substream) idx = count >> 24; if (idx >= viadev->tbl_entries) { #ifdef POINTER_DEBUG - printk(KERN_DEBUG "fail: invalid idx = %i/%i\n", idx, viadev->tbl_entries); + printk(KERN_DEBUG "fail: invalid idx = %i/%i\n", idx, + viadev->tbl_entries); #endif res = viadev->lastpos; } else { @@ -895,11 +901,11 @@ unlock: * hw_params callback: * allocate the buffer and build up the buffer description table */ -static int snd_via82xx_hw_params(snd_pcm_substream_t * substream, - snd_pcm_hw_params_t * hw_params) +static int snd_via82xx_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; int err; err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); @@ -918,10 +924,10 @@ static int snd_via82xx_hw_params(snd_pcm_substream_t * substream, * hw_free callback: * clean up the buffer description table and release the buffer */ -static int snd_via82xx_hw_free(snd_pcm_substream_t * substream) +static int snd_via82xx_hw_free(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; clean_via_table(viadev, substream, chip->pci); snd_pcm_lib_free_pages(substream); @@ -932,7 +938,7 @@ static int snd_via82xx_hw_free(snd_pcm_substream_t * substream) /* * set up the table pointer */ -static void snd_via82xx_set_table_ptr(via82xx_t *chip, viadev_t *viadev) +static void snd_via82xx_set_table_ptr(struct via82xx *chip, struct viadev *viadev) { snd_via82xx_codec_ready(chip, 0); outl((u32)viadev->table.addr, VIADEV_REG(viadev, OFFSET_TABLE_PTR)); @@ -943,7 +949,8 @@ static void snd_via82xx_set_table_ptr(via82xx_t *chip, viadev_t *viadev) /* * prepare callback for playback and capture on via686 */ -static void via686_setup_format(via82xx_t *chip, viadev_t *viadev, snd_pcm_runtime_t *runtime) +static void via686_setup_format(struct via82xx *chip, struct viadev *viadev, + struct snd_pcm_runtime *runtime) { snd_via82xx_channel_reset(chip, viadev); /* this must be set after channel_reset */ @@ -956,11 +963,11 @@ static void via686_setup_format(via82xx_t *chip, viadev_t *viadev, snd_pcm_runti VIA_REG_TYPE_INT_FLAG, VIADEV_REG(viadev, OFFSET_TYPE)); } -static int snd_via686_playback_prepare(snd_pcm_substream_t *substream) +static int snd_via686_playback_prepare(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; - snd_pcm_runtime_t *runtime = substream->runtime; + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE, runtime->rate); snd_ac97_set_rate(chip->ac97, AC97_SPDIF, runtime->rate); @@ -968,11 +975,11 @@ static int snd_via686_playback_prepare(snd_pcm_substream_t *substream) return 0; } -static int snd_via686_capture_prepare(snd_pcm_substream_t *substream) +static int snd_via686_capture_prepare(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; - snd_pcm_runtime_t *runtime = substream->runtime; + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; snd_ac97_set_rate(chip->ac97, AC97_PCM_LR_ADC_RATE, runtime->rate); via686_setup_format(chip, viadev, runtime); @@ -1002,11 +1009,11 @@ static int via_lock_rate(struct via_rate_lock *rec, int rate) /* * prepare callback for DSX playback on via823x */ -static int snd_via8233_playback_prepare(snd_pcm_substream_t *substream) +static int snd_via8233_playback_prepare(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; - snd_pcm_runtime_t *runtime = substream->runtime; + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; int ac97_rate = chip->dxs_src ? 48000 : runtime->rate; int rate_changed; u32 rbits; @@ -1022,12 +1029,15 @@ static int snd_via8233_playback_prepare(snd_pcm_substream_t *substream) if (runtime->rate == 48000) rbits = 0xfffff; else - rbits = (0x100000 / 48000) * runtime->rate + ((0x100000 % 48000) * runtime->rate) / 48000; + rbits = (0x100000 / 48000) * runtime->rate + + ((0x100000 % 48000) * runtime->rate) / 48000; snd_assert((rbits & ~0xfffff) == 0, return -EINVAL); snd_via82xx_channel_reset(chip, viadev); snd_via82xx_set_table_ptr(chip, viadev); - outb(chip->playback_volume[viadev->reg_offset / 0x10][0], VIADEV_REG(viadev, OFS_PLAYBACK_VOLUME_L)); - outb(chip->playback_volume[viadev->reg_offset / 0x10][1], VIADEV_REG(viadev, OFS_PLAYBACK_VOLUME_R)); + outb(chip->playback_volume[viadev->reg_offset / 0x10][0], + VIADEV_REG(viadev, OFS_PLAYBACK_VOLUME_L)); + outb(chip->playback_volume[viadev->reg_offset / 0x10][1], + VIADEV_REG(viadev, OFS_PLAYBACK_VOLUME_R)); outl((runtime->format == SNDRV_PCM_FORMAT_S16_LE ? VIA8233_REG_TYPE_16BIT : 0) | /* format */ (runtime->channels > 1 ? VIA8233_REG_TYPE_STEREO : 0) | /* stereo */ rbits | /* rate */ @@ -1041,11 +1051,11 @@ static int snd_via8233_playback_prepare(snd_pcm_substream_t *substream) /* * prepare callback for multi-channel playback on via823x */ -static int snd_via8233_multi_prepare(snd_pcm_substream_t *substream) +static int snd_via8233_multi_prepare(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; - snd_pcm_runtime_t *runtime = substream->runtime; + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; unsigned int slots; int fmt; @@ -1058,7 +1068,8 @@ static int snd_via8233_multi_prepare(snd_pcm_substream_t *substream) snd_via82xx_channel_reset(chip, viadev); snd_via82xx_set_table_ptr(chip, viadev); - fmt = (runtime->format == SNDRV_PCM_FORMAT_S16_LE) ? VIA_REG_MULTPLAY_FMT_16BIT : VIA_REG_MULTPLAY_FMT_8BIT; + fmt = (runtime->format == SNDRV_PCM_FORMAT_S16_LE) ? + VIA_REG_MULTPLAY_FMT_16BIT : VIA_REG_MULTPLAY_FMT_8BIT; fmt |= runtime->channels << 4; outb(fmt, VIADEV_REG(viadev, OFS_MULTPLAY_FORMAT)); #if 0 @@ -1089,11 +1100,11 @@ static int snd_via8233_multi_prepare(snd_pcm_substream_t *substream) /* * prepare callback for capture on via823x */ -static int snd_via8233_capture_prepare(snd_pcm_substream_t *substream) +static int snd_via8233_capture_prepare(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; - snd_pcm_runtime_t *runtime = substream->runtime; + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; if (via_lock_rate(&chip->rates[1], runtime->rate) < 0) return -EINVAL; @@ -1114,7 +1125,7 @@ static int snd_via8233_capture_prepare(snd_pcm_substream_t *substream) /* * pcm hardware definition, identical for both playback and capture */ -static snd_pcm_hardware_t snd_via82xx_hw = +static struct snd_pcm_hardware snd_via82xx_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -1139,9 +1150,10 @@ static snd_pcm_hardware_t snd_via82xx_hw = /* * open callback skeleton */ -static int snd_via82xx_pcm_open(via82xx_t *chip, viadev_t *viadev, snd_pcm_substream_t * substream) +static int snd_via82xx_pcm_open(struct via82xx *chip, struct viadev *viadev, + struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; int err; struct via_rate_lock *ratep; @@ -1191,10 +1203,10 @@ static int snd_via82xx_pcm_open(via82xx_t *chip, viadev_t *viadev, snd_pcm_subst /* * open callback for playback on via686 and via823x DSX */ -static int snd_via82xx_playback_open(snd_pcm_substream_t * substream) +static int snd_via82xx_playback_open(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = &chip->devs[chip->playback_devno + substream->number]; + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = &chip->devs[chip->playback_devno + substream->number]; int err; if ((err = snd_via82xx_pcm_open(chip, viadev, substream)) < 0) @@ -1205,10 +1217,10 @@ static int snd_via82xx_playback_open(snd_pcm_substream_t * substream) /* * open callback for playback on via823x multi-channel */ -static int snd_via8233_multi_open(snd_pcm_substream_t * substream) +static int snd_via8233_multi_open(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = &chip->devs[chip->multi_devno]; + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = &chip->devs[chip->multi_devno]; int err; /* channels constraint for VIA8233A * 3 and 5 channels are not supported @@ -1216,7 +1228,7 @@ static int snd_via8233_multi_open(snd_pcm_substream_t * substream) static unsigned int channels[] = { 1, 2, 4, 6 }; - static snd_pcm_hw_constraint_list_t hw_constraints_channels = { + static struct snd_pcm_hw_constraint_list hw_constraints_channels = { .count = ARRAY_SIZE(channels), .list = channels, .mask = 0, @@ -1226,17 +1238,19 @@ static int snd_via8233_multi_open(snd_pcm_substream_t * substream) return err; substream->runtime->hw.channels_max = 6; if (chip->revision == VIA_REV_8233A) - snd_pcm_hw_constraint_list(substream->runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, &hw_constraints_channels); + snd_pcm_hw_constraint_list(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_CHANNELS, + &hw_constraints_channels); return 0; } /* * open callback for capture on via686 and via823x */ -static int snd_via82xx_capture_open(snd_pcm_substream_t * substream) +static int snd_via82xx_capture_open(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = &chip->devs[chip->capture_devno + substream->pcm->device]; + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = &chip->devs[chip->capture_devno + substream->pcm->device]; return snd_via82xx_pcm_open(chip, viadev, substream); } @@ -1244,10 +1258,10 @@ static int snd_via82xx_capture_open(snd_pcm_substream_t * substream) /* * close callback */ -static int snd_via82xx_pcm_close(snd_pcm_substream_t * substream) +static int snd_via82xx_pcm_close(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; + struct via82xx *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; struct via_rate_lock *ratep; /* release the rate lock */ @@ -1264,7 +1278,7 @@ static int snd_via82xx_pcm_close(snd_pcm_substream_t * substream) /* via686 playback callbacks */ -static snd_pcm_ops_t snd_via686_playback_ops = { +static struct snd_pcm_ops snd_via686_playback_ops = { .open = snd_via82xx_playback_open, .close = snd_via82xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, @@ -1277,7 +1291,7 @@ static snd_pcm_ops_t snd_via686_playback_ops = { }; /* via686 capture callbacks */ -static snd_pcm_ops_t snd_via686_capture_ops = { +static struct snd_pcm_ops snd_via686_capture_ops = { .open = snd_via82xx_capture_open, .close = snd_via82xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, @@ -1290,7 +1304,7 @@ static snd_pcm_ops_t snd_via686_capture_ops = { }; /* via823x DSX playback callbacks */ -static snd_pcm_ops_t snd_via8233_playback_ops = { +static struct snd_pcm_ops snd_via8233_playback_ops = { .open = snd_via82xx_playback_open, .close = snd_via82xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, @@ -1303,7 +1317,7 @@ static snd_pcm_ops_t snd_via8233_playback_ops = { }; /* via823x multi-channel playback callbacks */ -static snd_pcm_ops_t snd_via8233_multi_ops = { +static struct snd_pcm_ops snd_via8233_multi_ops = { .open = snd_via8233_multi_open, .close = snd_via82xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, @@ -1316,7 +1330,7 @@ static snd_pcm_ops_t snd_via8233_multi_ops = { }; /* via823x capture callbacks */ -static snd_pcm_ops_t snd_via8233_capture_ops = { +static struct snd_pcm_ops snd_via8233_capture_ops = { .open = snd_via82xx_capture_open, .close = snd_via82xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, @@ -1329,7 +1343,8 @@ static snd_pcm_ops_t snd_via8233_capture_ops = { }; -static void init_viadev(via82xx_t *chip, int idx, unsigned int reg_offset, int shadow_pos, int direction) +static void init_viadev(struct via82xx *chip, int idx, unsigned int reg_offset, + int shadow_pos, int direction) { chip->devs[idx].reg_offset = reg_offset; chip->devs[idx].shadow_shift = shadow_pos * 4; @@ -1340,9 +1355,9 @@ static void init_viadev(via82xx_t *chip, int idx, unsigned int reg_offset, int s /* * create pcm instances for VIA8233, 8233C and 8235 (not 8233A) */ -static int __devinit snd_via8233_pcm_new(via82xx_t *chip) +static int __devinit snd_via8233_pcm_new(struct via82xx *chip) { - snd_pcm_t *pcm; + struct snd_pcm *pcm; int i, err; chip->playback_devno = 0; /* x 4 */ @@ -1367,7 +1382,8 @@ static int __devinit snd_via8233_pcm_new(via82xx_t *chip) init_viadev(chip, chip->capture_devno, VIA_REG_CAPTURE_8233_STATUS, 6, 1); if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, - snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) + snd_dma_pci_data(chip->pci), + 64*1024, 128*1024)) < 0) return err; /* PCM #1: multi-channel playback and 2nd capture */ @@ -1385,7 +1401,8 @@ static int __devinit snd_via8233_pcm_new(via82xx_t *chip) init_viadev(chip, chip->capture_devno + 1, VIA_REG_CAPTURE_8233_STATUS + 0x10, 7, 1); if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, - snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) + snd_dma_pci_data(chip->pci), + 64*1024, 128*1024)) < 0) return err; return 0; @@ -1394,9 +1411,9 @@ static int __devinit snd_via8233_pcm_new(via82xx_t *chip) /* * create pcm instances for VIA8233A */ -static int __devinit snd_via8233a_pcm_new(via82xx_t *chip) +static int __devinit snd_via8233a_pcm_new(struct via82xx *chip) { - snd_pcm_t *pcm; + struct snd_pcm *pcm; int err; chip->multi_devno = 0; @@ -1420,7 +1437,8 @@ static int __devinit snd_via8233a_pcm_new(via82xx_t *chip) init_viadev(chip, chip->capture_devno, VIA_REG_CAPTURE_8233_STATUS, 6, 1); if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, - snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) + snd_dma_pci_data(chip->pci), + 64*1024, 128*1024)) < 0) return err; /* SPDIF supported? */ @@ -1439,7 +1457,8 @@ static int __devinit snd_via8233a_pcm_new(via82xx_t *chip) init_viadev(chip, chip->playback_devno, 0x30, 3, 0); if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, - snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) + snd_dma_pci_data(chip->pci), + 64*1024, 128*1024)) < 0) return err; return 0; @@ -1448,9 +1467,9 @@ static int __devinit snd_via8233a_pcm_new(via82xx_t *chip) /* * create a pcm instance for via686a/b */ -static int __devinit snd_via686_pcm_new(via82xx_t *chip) +static int __devinit snd_via686_pcm_new(struct via82xx *chip) { - snd_pcm_t *pcm; + struct snd_pcm *pcm; int err; chip->playback_devno = 0; @@ -1470,7 +1489,8 @@ static int __devinit snd_via686_pcm_new(via82xx_t *chip) init_viadev(chip, 1, VIA_REG_CAPTURE_STATUS, 0, 1); if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, - snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) + snd_dma_pci_data(chip->pci), + 64*1024, 128*1024)) < 0) return err; return 0; @@ -1481,7 +1501,8 @@ static int __devinit snd_via686_pcm_new(via82xx_t *chip) * Mixer part */ -static int snd_via8233_capture_source_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_via8233_capture_source_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { /* formerly they were "Line" and "Mic", but it looks like that they * have nothing to do with the actual physical connections... @@ -1498,17 +1519,19 @@ static int snd_via8233_capture_source_info(snd_kcontrol_t *kcontrol, snd_ctl_ele return 0; } -static int snd_via8233_capture_source_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_via8233_capture_source_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - via82xx_t *chip = snd_kcontrol_chip(kcontrol); + struct via82xx *chip = snd_kcontrol_chip(kcontrol); unsigned long port = chip->port + (kcontrol->id.index ? (VIA_REG_CAPTURE_CHANNEL + 0x10) : VIA_REG_CAPTURE_CHANNEL); ucontrol->value.enumerated.item[0] = inb(port) & VIA_REG_CAPTURE_CHANNEL_MIC ? 1 : 0; return 0; } -static int snd_via8233_capture_source_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_via8233_capture_source_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - via82xx_t *chip = snd_kcontrol_chip(kcontrol); + struct via82xx *chip = snd_kcontrol_chip(kcontrol); unsigned long port = chip->port + (kcontrol->id.index ? (VIA_REG_CAPTURE_CHANNEL + 0x10) : VIA_REG_CAPTURE_CHANNEL); u8 val, oval; @@ -1523,7 +1546,7 @@ static int snd_via8233_capture_source_put(snd_kcontrol_t *kcontrol, snd_ctl_elem return val != oval; } -static snd_kcontrol_new_t snd_via8233_capture_source __devinitdata = { +static struct snd_kcontrol_new snd_via8233_capture_source __devinitdata = { .name = "Input Source Select", .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .info = snd_via8233_capture_source_info, @@ -1531,7 +1554,8 @@ static snd_kcontrol_new_t snd_via8233_capture_source __devinitdata = { .put = snd_via8233_capture_source_put, }; -static int snd_via8233_dxs3_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_via8233_dxs3_spdif_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; @@ -1540,9 +1564,10 @@ static int snd_via8233_dxs3_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_in return 0; } -static int snd_via8233_dxs3_spdif_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_via8233_dxs3_spdif_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - via82xx_t *chip = snd_kcontrol_chip(kcontrol); + struct via82xx *chip = snd_kcontrol_chip(kcontrol); u8 val; pci_read_config_byte(chip->pci, VIA8233_SPDIF_CTRL, &val); @@ -1550,9 +1575,10 @@ static int snd_via8233_dxs3_spdif_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_val return 0; } -static int snd_via8233_dxs3_spdif_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_via8233_dxs3_spdif_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - via82xx_t *chip = snd_kcontrol_chip(kcontrol); + struct via82xx *chip = snd_kcontrol_chip(kcontrol); u8 val, oval; pci_read_config_byte(chip->pci, VIA8233_SPDIF_CTRL, &oval); @@ -1568,7 +1594,7 @@ static int snd_via8233_dxs3_spdif_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_val return 0; } -static snd_kcontrol_new_t snd_via8233_dxs3_spdif_control __devinitdata = { +static struct snd_kcontrol_new snd_via8233_dxs3_spdif_control __devinitdata = { .name = SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH), .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .info = snd_via8233_dxs3_spdif_info, @@ -1576,7 +1602,8 @@ static snd_kcontrol_new_t snd_via8233_dxs3_spdif_control __devinitdata = { .put = snd_via8233_dxs3_spdif_put, }; -static int snd_via8233_dxs_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_via8233_dxs_volume_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -1585,9 +1612,10 @@ static int snd_via8233_dxs_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_in return 0; } -static int snd_via8233_dxs_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_via8233_dxs_volume_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - via82xx_t *chip = snd_kcontrol_chip(kcontrol); + struct via82xx *chip = snd_kcontrol_chip(kcontrol); unsigned int idx = snd_ctl_get_ioff(kcontrol, &ucontrol->id); ucontrol->value.integer.value[0] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][0]; @@ -1595,17 +1623,19 @@ static int snd_via8233_dxs_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_val return 0; } -static int snd_via8233_pcmdxs_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_via8233_pcmdxs_volume_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - via82xx_t *chip = snd_kcontrol_chip(kcontrol); + struct via82xx *chip = snd_kcontrol_chip(kcontrol); ucontrol->value.integer.value[0] = VIA_DXS_MAX_VOLUME - chip->playback_volume_c[0]; ucontrol->value.integer.value[1] = VIA_DXS_MAX_VOLUME - chip->playback_volume_c[1]; return 0; } -static int snd_via8233_dxs_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_via8233_dxs_volume_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - via82xx_t *chip = snd_kcontrol_chip(kcontrol); + struct via82xx *chip = snd_kcontrol_chip(kcontrol); unsigned int idx = snd_ctl_get_ioff(kcontrol, &ucontrol->id); unsigned long port = chip->port + 0x10 * idx; unsigned char val; @@ -1625,9 +1655,10 @@ static int snd_via8233_dxs_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_val return change; } -static int snd_via8233_pcmdxs_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_via8233_pcmdxs_volume_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - via82xx_t *chip = snd_kcontrol_chip(kcontrol); + struct via82xx *chip = snd_kcontrol_chip(kcontrol); unsigned int idx; unsigned char val; int i, change = 0; @@ -1650,7 +1681,7 @@ static int snd_via8233_pcmdxs_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_ return change; } -static snd_kcontrol_new_t snd_via8233_pcmdxs_volume_control __devinitdata = { +static struct snd_kcontrol_new snd_via8233_pcmdxs_volume_control __devinitdata = { .name = "PCM Playback Volume", .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .info = snd_via8233_dxs_volume_info, @@ -1658,7 +1689,7 @@ static snd_kcontrol_new_t snd_via8233_pcmdxs_volume_control __devinitdata = { .put = snd_via8233_pcmdxs_volume_put, }; -static snd_kcontrol_new_t snd_via8233_dxs_volume_control __devinitdata = { +static struct snd_kcontrol_new snd_via8233_dxs_volume_control __devinitdata = { .name = "VIA DXS Playback Volume", .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .count = 4, @@ -1670,15 +1701,15 @@ static snd_kcontrol_new_t snd_via8233_dxs_volume_control __devinitdata = { /* */ -static void snd_via82xx_mixer_free_ac97_bus(ac97_bus_t *bus) +static void snd_via82xx_mixer_free_ac97_bus(struct snd_ac97_bus *bus) { - via82xx_t *chip = bus->private_data; + struct via82xx *chip = bus->private_data; chip->ac97_bus = NULL; } -static void snd_via82xx_mixer_free_ac97(ac97_t *ac97) +static void snd_via82xx_mixer_free_ac97(struct snd_ac97 *ac97) { - via82xx_t *chip = ac97->private_data; + struct via82xx *chip = ac97->private_data; chip->ac97 = NULL; } @@ -1735,11 +1766,11 @@ static struct ac97_quirk ac97_quirks[] = { { } /* terminator */ }; -static int __devinit snd_via82xx_mixer_new(via82xx_t *chip, const char *quirk_override) +static int __devinit snd_via82xx_mixer_new(struct via82xx *chip, const char *quirk_override) { - ac97_template_t ac97; + struct snd_ac97_template ac97; int err; - static ac97_bus_ops_t ops = { + static struct snd_ac97_bus_ops ops = { .write = snd_via82xx_codec_write, .read = snd_via82xx_codec_read, .wait = snd_via82xx_codec_wait, @@ -1770,7 +1801,7 @@ static int __devinit snd_via82xx_mixer_new(via82xx_t *chip, const char *quirk_ov #ifdef SUPPORT_JOYSTICK #define JOYSTICK_ADDR 0x200 -static int __devinit snd_via686_create_gameport(via82xx_t *chip, unsigned char *legacy) +static int __devinit snd_via686_create_gameport(struct via82xx *chip, unsigned char *legacy) { struct gameport *gp; struct resource *r; @@ -1780,7 +1811,8 @@ static int __devinit snd_via686_create_gameport(via82xx_t *chip, unsigned char * r = request_region(JOYSTICK_ADDR, 8, "VIA686 gameport"); if (!r) { - printk(KERN_WARNING "via82xx: cannot reserve joystick port 0x%#x\n", JOYSTICK_ADDR); + printk(KERN_WARNING "via82xx: cannot reserve joystick port 0x%#x\n", + JOYSTICK_ADDR); return -EBUSY; } @@ -1806,7 +1838,7 @@ static int __devinit snd_via686_create_gameport(via82xx_t *chip, unsigned char * return 0; } -static void snd_via686_free_gameport(via82xx_t *chip) +static void snd_via686_free_gameport(struct via82xx *chip) { if (chip->gameport) { struct resource *r = gameport_get_port_data(chip->gameport); @@ -1817,11 +1849,11 @@ static void snd_via686_free_gameport(via82xx_t *chip) } } #else -static inline int snd_via686_create_gameport(via82xx_t *chip, unsigned char *legacy) +static inline int snd_via686_create_gameport(struct via82xx *chip, unsigned char *legacy) { return -ENOSYS; } -static inline void snd_via686_free_gameport(via82xx_t *chip) { } +static inline void snd_via686_free_gameport(struct via82xx *chip) { } #endif @@ -1829,7 +1861,7 @@ static inline void snd_via686_free_gameport(via82xx_t *chip) { } * */ -static int __devinit snd_via8233_init_misc(via82xx_t *chip) +static int __devinit snd_via8233_init_misc(struct via82xx *chip) { int i, err, caps; unsigned char val; @@ -1850,7 +1882,7 @@ static int __devinit snd_via8233_init_misc(via82xx_t *chip) /* when no h/w PCM volume control is found, use DXS volume control * as the PCM vol control */ - snd_ctl_elem_id_t sid; + struct snd_ctl_elem_id sid; memset(&sid, 0, sizeof(sid)); strcpy(sid.name, "PCM Playback Volume"); sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER; @@ -1877,7 +1909,7 @@ static int __devinit snd_via8233_init_misc(via82xx_t *chip) return 0; } -static int __devinit snd_via686_init_misc(via82xx_t *chip) +static int __devinit snd_via686_init_misc(struct via82xx *chip) { unsigned char legacy, legacy_cfg; int rev_h = 0; @@ -1954,9 +1986,10 @@ static int __devinit snd_via686_init_misc(via82xx_t *chip) /* * proc interface */ -static void snd_via82xx_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) +static void snd_via82xx_proc_read(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - via82xx_t *chip = entry->private_data; + struct via82xx *chip = entry->private_data; int i; snd_iprintf(buffer, "%s\n\n", chip->card->longname); @@ -1965,9 +1998,9 @@ static void snd_via82xx_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *bu } } -static void __devinit snd_via82xx_proc_init(via82xx_t *chip) +static void __devinit snd_via82xx_proc_init(struct via82xx *chip) { - snd_info_entry_t *entry; + struct snd_info_entry *entry; if (! snd_card_proc_new(chip->card, "via82xx", &entry)) snd_info_set_text_ops(entry, chip, 1024, snd_via82xx_proc_read); @@ -1977,7 +2010,7 @@ static void __devinit snd_via82xx_proc_init(via82xx_t *chip) * */ -static int snd_via82xx_chip_init(via82xx_t *chip) +static int snd_via82xx_chip_init(struct via82xx *chip) { unsigned int val; unsigned long end_time; @@ -2080,7 +2113,8 @@ static int snd_via82xx_chip_init(via82xx_t *chip) unsigned long port = chip->port + 0x10 * idx; for (i = 0; i < 2; i++) { chip->playback_volume[idx][i]=chip->playback_volume_c[i]; - outb(chip->playback_volume_c[i], port + VIA_REG_OFS_PLAYBACK_VOLUME_L + i); + outb(chip->playback_volume_c[i], + port + VIA_REG_OFS_PLAYBACK_VOLUME_L + i); } } } @@ -2092,9 +2126,9 @@ static int snd_via82xx_chip_init(via82xx_t *chip) /* * power management */ -static int snd_via82xx_suspend(snd_card_t *card, pm_message_t state) +static int snd_via82xx_suspend(struct snd_card *card, pm_message_t state) { - via82xx_t *chip = card->pm_private_data; + struct via82xx *chip = card->pm_private_data; int i; for (i = 0; i < 2; i++) @@ -2117,9 +2151,9 @@ static int snd_via82xx_suspend(snd_card_t *card, pm_message_t state) return 0; } -static int snd_via82xx_resume(snd_card_t *card) +static int snd_via82xx_resume(struct snd_card *card) { - via82xx_t *chip = card->pm_private_data; + struct via82xx *chip = card->pm_private_data; int i; pci_enable_device(chip->pci); @@ -2147,7 +2181,7 @@ static int snd_via82xx_resume(snd_card_t *card) } #endif /* CONFIG_PM */ -static int snd_via82xx_free(via82xx_t *chip) +static int snd_via82xx_free(struct via82xx *chip) { unsigned int i; @@ -2159,7 +2193,7 @@ static int snd_via82xx_free(via82xx_t *chip) synchronize_irq(chip->irq); __end_hw: if (chip->irq >= 0) - free_irq(chip->irq, (void *)chip); + free_irq(chip->irq, chip); release_and_free_resource(chip->mpu_res); pci_release_regions(chip->pci); @@ -2173,22 +2207,22 @@ static int snd_via82xx_free(via82xx_t *chip) return 0; } -static int snd_via82xx_dev_free(snd_device_t *device) +static int snd_via82xx_dev_free(struct snd_device *device) { - via82xx_t *chip = device->device_data; + struct via82xx *chip = device->device_data; return snd_via82xx_free(chip); } -static int __devinit snd_via82xx_create(snd_card_t * card, +static int __devinit snd_via82xx_create(struct snd_card *card, struct pci_dev *pci, int chip_type, int revision, unsigned int ac97_clock, - via82xx_t ** r_via) + struct via82xx ** r_via) { - via82xx_t *chip; + struct via82xx *chip; int err; - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .dev_free = snd_via82xx_dev_free, }; @@ -2225,7 +2259,7 @@ static int __devinit snd_via82xx_create(snd_card_t * card, chip_type == TYPE_VIA8233 ? snd_via8233_interrupt : snd_via686_interrupt, SA_INTERRUPT|SA_SHIRQ, - card->driver, (void *)chip)) { + card->driver, chip)) { snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); snd_via82xx_free(chip); return -EBUSY; @@ -2363,8 +2397,8 @@ static int __devinit check_dxs_list(struct pci_dev *pci) static int __devinit snd_via82xx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { - snd_card_t *card; - via82xx_t *chip; + struct snd_card *card; + struct via82xx *chip; unsigned char revision; int chip_type = 0, card_type; unsigned int i; diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index b83660bd05b0..55ef69a8d2de 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c @@ -206,9 +206,6 @@ DEFINE_VIA_REGSET(MI, 0x50); VIA_MC97_CTRL_SECONDARY) -typedef struct _snd_via82xx_modem via82xx_t; -typedef struct via_dev viadev_t; - /* * pcm stream */ @@ -220,11 +217,11 @@ struct snd_via_sg_table { #define VIA_TABLE_SIZE 255 -struct via_dev { +struct viadev { unsigned int reg_offset; unsigned long port; int direction; /* playback = 0, capture = 1 */ - snd_pcm_substream_t *substream; + struct snd_pcm_substream *substream; int running; unsigned int tbl_entries; /* # descriptors */ struct snd_dma_buffer table; @@ -239,7 +236,7 @@ enum { TYPE_CARD_VIA82XX_MODEM = 1 }; #define VIA_MAX_MODEM_DEVS 2 -struct _snd_via82xx_modem { +struct via82xx_modem { int irq; unsigned long port; @@ -247,21 +244,21 @@ struct _snd_via82xx_modem { unsigned int intr_mask; /* SGD_SHADOW mask to check interrupts */ struct pci_dev *pci; - snd_card_t *card; + struct snd_card *card; unsigned int num_devs; unsigned int playback_devno, capture_devno; - viadev_t devs[VIA_MAX_MODEM_DEVS]; + struct viadev devs[VIA_MAX_MODEM_DEVS]; - snd_pcm_t *pcms[2]; + struct snd_pcm *pcms[2]; - ac97_bus_t *ac97_bus; - ac97_t *ac97; + struct snd_ac97_bus *ac97_bus; + struct snd_ac97 *ac97; unsigned int ac97_clock; unsigned int ac97_secondary; /* secondary AC'97 codec is present */ spinlock_t reg_lock; - snd_info_entry_t *proc_entry; + struct snd_info_entry *proc_entry; }; static struct pci_device_id snd_via82xx_modem_ids[] = { @@ -279,12 +276,12 @@ MODULE_DEVICE_TABLE(pci, snd_via82xx_modem_ids); * periods = number of periods * fragsize = period size in bytes */ -static int build_via_table(viadev_t *dev, snd_pcm_substream_t *substream, +static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substream, struct pci_dev *pci, unsigned int periods, unsigned int fragsize) { unsigned int i, idx, ofs, rest; - via82xx_t *chip = snd_pcm_substream_chip(substream); + struct via82xx_modem *chip = snd_pcm_substream_chip(substream); struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); if (dev->table.area == NULL) { @@ -346,7 +343,7 @@ static int build_via_table(viadev_t *dev, snd_pcm_substream_t *substream, } -static int clean_via_table(viadev_t *dev, snd_pcm_substream_t *substream, +static int clean_via_table(struct viadev *dev, struct snd_pcm_substream *substream, struct pci_dev *pci) { if (dev->table.area) { @@ -362,17 +359,17 @@ static int clean_via_table(viadev_t *dev, snd_pcm_substream_t *substream, * Basic I/O */ -static inline unsigned int snd_via82xx_codec_xread(via82xx_t *chip) +static inline unsigned int snd_via82xx_codec_xread(struct via82xx_modem *chip) { return inl(VIAREG(chip, AC97)); } -static inline void snd_via82xx_codec_xwrite(via82xx_t *chip, unsigned int val) +static inline void snd_via82xx_codec_xwrite(struct via82xx_modem *chip, unsigned int val) { outl(val, VIAREG(chip, AC97)); } -static int snd_via82xx_codec_ready(via82xx_t *chip, int secondary) +static int snd_via82xx_codec_ready(struct via82xx_modem *chip, int secondary) { unsigned int timeout = 1000; /* 1ms */ unsigned int val; @@ -382,11 +379,12 @@ static int snd_via82xx_codec_ready(via82xx_t *chip, int secondary) if (!((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)) return val & 0xffff; } - snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_via82xx_codec_xread(chip)); + snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", + secondary, snd_via82xx_codec_xread(chip)); return -EIO; } -static int snd_via82xx_codec_valid(via82xx_t *chip, int secondary) +static int snd_via82xx_codec_valid(struct via82xx_modem *chip, int secondary) { unsigned int timeout = 1000; /* 1ms */ unsigned int val, val1; @@ -403,20 +401,20 @@ static int snd_via82xx_codec_valid(via82xx_t *chip, int secondary) return -EIO; } -static void snd_via82xx_codec_wait(ac97_t *ac97) +static void snd_via82xx_codec_wait(struct snd_ac97 *ac97) { - via82xx_t *chip = ac97->private_data; + struct via82xx_modem *chip = ac97->private_data; int err; err = snd_via82xx_codec_ready(chip, ac97->num); /* here we need to wait fairly for long time.. */ msleep(500); } -static void snd_via82xx_codec_write(ac97_t *ac97, +static void snd_via82xx_codec_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) { - via82xx_t *chip = ac97->private_data; + struct via82xx_modem *chip = ac97->private_data; unsigned int xval; if(reg == AC97_GPIO_STATUS) { outl(val, VIAREG(chip, GPI_STATUS)); @@ -430,9 +428,9 @@ static void snd_via82xx_codec_write(ac97_t *ac97, snd_via82xx_codec_ready(chip, ac97->num); } -static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg) +static unsigned short snd_via82xx_codec_read(struct snd_ac97 *ac97, unsigned short reg) { - via82xx_t *chip = ac97->private_data; + struct via82xx_modem *chip = ac97->private_data; unsigned int xval, val = 0xffff; int again = 0; @@ -442,7 +440,8 @@ static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg) xval |= (reg & 0x7f) << VIA_REG_AC97_CMD_SHIFT; while (1) { if (again++ > 3) { - snd_printk(KERN_ERR "codec_read: codec %i is not valid [0x%x]\n", ac97->num, snd_via82xx_codec_xread(chip)); + snd_printk(KERN_ERR "codec_read: codec %i is not valid [0x%x]\n", + ac97->num, snd_via82xx_codec_xread(chip)); return 0xffff; } snd_via82xx_codec_xwrite(chip, xval); @@ -456,7 +455,7 @@ static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg) return val & 0xffff; } -static void snd_via82xx_channel_reset(via82xx_t *chip, viadev_t *viadev) +static void snd_via82xx_channel_reset(struct via82xx_modem *chip, struct viadev *viadev) { outb(VIA_REG_CTRL_PAUSE | VIA_REG_CTRL_TERMINATE | VIA_REG_CTRL_RESET, VIADEV_REG(viadev, OFFSET_CONTROL)); @@ -478,7 +477,7 @@ static void snd_via82xx_channel_reset(via82xx_t *chip, viadev_t *viadev) static irqreturn_t snd_via82xx_interrupt(int irq, void *dev_id, struct pt_regs *regs) { - via82xx_t *chip = dev_id; + struct via82xx_modem *chip = dev_id; unsigned int status; unsigned int i; @@ -491,7 +490,7 @@ static irqreturn_t snd_via82xx_interrupt(int irq, void *dev_id, struct pt_regs * /* check status for each stream */ spin_lock(&chip->reg_lock); for (i = 0; i < chip->num_devs; i++) { - viadev_t *viadev = &chip->devs[i]; + struct viadev *viadev = &chip->devs[i]; unsigned char c_status = inb(VIADEV_REG(viadev, OFFSET_STATUS)); c_status &= (VIA_REG_STAT_EOL|VIA_REG_STAT_FLAG|VIA_REG_STAT_STOPPED); if (! c_status) @@ -514,10 +513,10 @@ static irqreturn_t snd_via82xx_interrupt(int irq, void *dev_id, struct pt_regs * /* * trigger callback */ -static int snd_via82xx_pcm_trigger(snd_pcm_substream_t * substream, int cmd) +static int snd_via82xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; + struct via82xx_modem *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; unsigned char val = 0; switch (cmd) { @@ -555,9 +554,11 @@ static int snd_via82xx_pcm_trigger(snd_pcm_substream_t * substream, int cmd) */ #define check_invalid_pos(viadev,pos) \ - ((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 || viadev->lastpos < viadev->bufsize2)) + ((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 ||\ + viadev->lastpos < viadev->bufsize2)) -static inline unsigned int calc_linear_pos(viadev_t *viadev, unsigned int idx, unsigned int count) +static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int idx, + unsigned int count) { unsigned int size, res; @@ -566,24 +567,33 @@ static inline unsigned int calc_linear_pos(viadev_t *viadev, unsigned int idx, u /* check the validity of the calculated position */ if (size < count) { - snd_printd(KERN_ERR "invalid via82xx_cur_ptr (size = %d, count = %d)\n", (int)size, (int)count); + snd_printd(KERN_ERR "invalid via82xx_cur_ptr (size = %d, count = %d)\n", + (int)size, (int)count); res = viadev->lastpos; } else if (check_invalid_pos(viadev, res)) { #ifdef POINTER_DEBUG - printk(KERN_DEBUG "fail: idx = %i/%i, lastpos = 0x%x, bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, count = 0x%x\n", idx, viadev->tbl_entries, viadev->lastpos, viadev->bufsize2, viadev->idx_table[idx].offset, viadev->idx_table[idx].size, count); + printk(KERN_DEBUG "fail: idx = %i/%i, lastpos = 0x%x, " + "bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, " + "count = 0x%x\n", idx, viadev->tbl_entries, viadev->lastpos, + viadev->bufsize2, viadev->idx_table[idx].offset, + viadev->idx_table[idx].size, count); #endif if (count && size < count) { - snd_printd(KERN_ERR "invalid via82xx_cur_ptr, using last valid pointer\n"); + snd_printd(KERN_ERR "invalid via82xx_cur_ptr, " + "using last valid pointer\n"); res = viadev->lastpos; } else { if (! count) /* bogus count 0 on the DMA boundary? */ res = viadev->idx_table[idx].offset; else - /* count register returns full size when end of buffer is reached */ + /* count register returns full size + * when end of buffer is reached + */ res = viadev->idx_table[idx].offset + size; if (check_invalid_pos(viadev, res)) { - snd_printd(KERN_ERR "invalid via82xx_cur_ptr (2), using last valid pointer\n"); + snd_printd(KERN_ERR "invalid via82xx_cur_ptr (2), " + "using last valid pointer\n"); res = viadev->lastpos; } } @@ -597,10 +607,10 @@ static inline unsigned int calc_linear_pos(viadev_t *viadev, unsigned int idx, u /* * get the current pointer on via686 */ -static snd_pcm_uframes_t snd_via686_pcm_pointer(snd_pcm_substream_t *substream) +static snd_pcm_uframes_t snd_via686_pcm_pointer(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; + struct via82xx_modem *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; unsigned int idx, ptr, count, res; snd_assert(viadev->tbl_entries, return 0); @@ -616,7 +626,8 @@ static snd_pcm_uframes_t snd_via686_pcm_pointer(snd_pcm_substream_t *substream) if (ptr <= (unsigned int)viadev->table.addr) idx = 0; else /* CURR_PTR holds the address + 8 */ - idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) % viadev->tbl_entries; + idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) % + viadev->tbl_entries; res = calc_linear_pos(viadev, idx, count); spin_unlock(&chip->reg_lock); @@ -627,11 +638,11 @@ static snd_pcm_uframes_t snd_via686_pcm_pointer(snd_pcm_substream_t *substream) * hw_params callback: * allocate the buffer and build up the buffer description table */ -static int snd_via82xx_hw_params(snd_pcm_substream_t * substream, - snd_pcm_hw_params_t * hw_params) +static int snd_via82xx_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; + struct via82xx_modem *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; int err; err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); @@ -653,10 +664,10 @@ static int snd_via82xx_hw_params(snd_pcm_substream_t * substream, * hw_free callback: * clean up the buffer description table and release the buffer */ -static int snd_via82xx_hw_free(snd_pcm_substream_t * substream) +static int snd_via82xx_hw_free(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; + struct via82xx_modem *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; clean_via_table(viadev, substream, chip->pci); snd_pcm_lib_free_pages(substream); @@ -667,7 +678,7 @@ static int snd_via82xx_hw_free(snd_pcm_substream_t * substream) /* * set up the table pointer */ -static void snd_via82xx_set_table_ptr(via82xx_t *chip, viadev_t *viadev) +static void snd_via82xx_set_table_ptr(struct via82xx_modem *chip, struct viadev *viadev) { snd_via82xx_codec_ready(chip, chip->ac97_secondary); outl((u32)viadev->table.addr, VIADEV_REG(viadev, OFFSET_TABLE_PTR)); @@ -678,10 +689,10 @@ static void snd_via82xx_set_table_ptr(via82xx_t *chip, viadev_t *viadev) /* * prepare callback for playback and capture */ -static int snd_via82xx_pcm_prepare(snd_pcm_substream_t *substream) +static int snd_via82xx_pcm_prepare(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; + struct via82xx_modem *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = substream->runtime->private_data; snd_via82xx_channel_reset(chip, viadev); /* this must be set after channel_reset */ @@ -694,7 +705,7 @@ static int snd_via82xx_pcm_prepare(snd_pcm_substream_t *substream) /* * pcm hardware definition, identical for both playback and capture */ -static snd_pcm_hardware_t snd_via82xx_hw = +static struct snd_pcm_hardware snd_via82xx_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -719,12 +730,13 @@ static snd_pcm_hardware_t snd_via82xx_hw = /* * open callback skeleton */ -static int snd_via82xx_modem_pcm_open(via82xx_t *chip, viadev_t *viadev, snd_pcm_substream_t * substream) +static int snd_via82xx_modem_pcm_open(struct via82xx_modem *chip, struct viadev *viadev, + struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; int err; static unsigned int rates[] = { 8000, 9600, 12000, 16000 }; - static snd_pcm_hw_constraint_list_t hw_constraints_rates = { + static struct snd_pcm_hw_constraint_list hw_constraints_rates = { .count = ARRAY_SIZE(rates), .list = rates, .mask = 0, @@ -732,7 +744,8 @@ static int snd_via82xx_modem_pcm_open(via82xx_t *chip, viadev_t *viadev, snd_pcm runtime->hw = snd_via82xx_hw; - if ((err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates)) < 0) + if ((err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + &hw_constraints_rates)) < 0) return err; /* we may remove following constaint when we modify table entries @@ -750,10 +763,10 @@ static int snd_via82xx_modem_pcm_open(via82xx_t *chip, viadev_t *viadev, snd_pcm /* * open callback for playback */ -static int snd_via82xx_playback_open(snd_pcm_substream_t * substream) +static int snd_via82xx_playback_open(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = &chip->devs[chip->playback_devno + substream->number]; + struct via82xx_modem *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = &chip->devs[chip->playback_devno + substream->number]; return snd_via82xx_modem_pcm_open(chip, viadev, substream); } @@ -761,10 +774,10 @@ static int snd_via82xx_playback_open(snd_pcm_substream_t * substream) /* * open callback for capture */ -static int snd_via82xx_capture_open(snd_pcm_substream_t * substream) +static int snd_via82xx_capture_open(struct snd_pcm_substream *substream) { - via82xx_t *chip = snd_pcm_substream_chip(substream); - viadev_t *viadev = &chip->devs[chip->capture_devno + substream->pcm->device]; + struct via82xx_modem *chip = snd_pcm_substream_chip(substream); + struct viadev *viadev = &chip->devs[chip->capture_devno + substream->pcm->device]; return snd_via82xx_modem_pcm_open(chip, viadev, substream); } @@ -772,9 +785,9 @@ static int snd_via82xx_capture_open(snd_pcm_substream_t * substream) /* * close callback */ -static int snd_via82xx_pcm_close(snd_pcm_substream_t * substream) +static int snd_via82xx_pcm_close(struct snd_pcm_substream *substream) { - viadev_t *viadev = (viadev_t *)substream->runtime->private_data; + struct viadev *viadev = substream->runtime->private_data; viadev->substream = NULL; return 0; @@ -782,7 +795,7 @@ static int snd_via82xx_pcm_close(snd_pcm_substream_t * substream) /* via686 playback callbacks */ -static snd_pcm_ops_t snd_via686_playback_ops = { +static struct snd_pcm_ops snd_via686_playback_ops = { .open = snd_via82xx_playback_open, .close = snd_via82xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, @@ -795,7 +808,7 @@ static snd_pcm_ops_t snd_via686_playback_ops = { }; /* via686 capture callbacks */ -static snd_pcm_ops_t snd_via686_capture_ops = { +static struct snd_pcm_ops snd_via686_capture_ops = { .open = snd_via82xx_capture_open, .close = snd_via82xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, @@ -808,7 +821,8 @@ static snd_pcm_ops_t snd_via686_capture_ops = { }; -static void init_viadev(via82xx_t *chip, int idx, unsigned int reg_offset, int direction) +static void init_viadev(struct via82xx_modem *chip, int idx, unsigned int reg_offset, + int direction) { chip->devs[idx].reg_offset = reg_offset; chip->devs[idx].direction = direction; @@ -818,9 +832,9 @@ static void init_viadev(via82xx_t *chip, int idx, unsigned int reg_offset, int d /* * create a pcm instance for via686a/b */ -static int __devinit snd_via686_pcm_new(via82xx_t *chip) +static int __devinit snd_via686_pcm_new(struct via82xx_modem *chip) { - snd_pcm_t *pcm; + struct snd_pcm *pcm; int err; chip->playback_devno = 0; @@ -841,7 +855,8 @@ static int __devinit snd_via686_pcm_new(via82xx_t *chip) init_viadev(chip, 1, VIA_REG_MI_STATUS, 1); if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, - snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) + snd_dma_pci_data(chip->pci), + 64*1024, 128*1024)) < 0) return err; return 0; @@ -853,24 +868,24 @@ static int __devinit snd_via686_pcm_new(via82xx_t *chip) */ -static void snd_via82xx_mixer_free_ac97_bus(ac97_bus_t *bus) +static void snd_via82xx_mixer_free_ac97_bus(struct snd_ac97_bus *bus) { - via82xx_t *chip = bus->private_data; + struct via82xx_modem *chip = bus->private_data; chip->ac97_bus = NULL; } -static void snd_via82xx_mixer_free_ac97(ac97_t *ac97) +static void snd_via82xx_mixer_free_ac97(struct snd_ac97 *ac97) { - via82xx_t *chip = ac97->private_data; + struct via82xx_modem *chip = ac97->private_data; chip->ac97 = NULL; } -static int __devinit snd_via82xx_mixer_new(via82xx_t *chip) +static int __devinit snd_via82xx_mixer_new(struct via82xx_modem *chip) { - ac97_template_t ac97; + struct snd_ac97_template ac97; int err; - static ac97_bus_ops_t ops = { + static struct snd_ac97_bus_ops ops = { .write = snd_via82xx_codec_write, .read = snd_via82xx_codec_read, .wait = snd_via82xx_codec_wait, @@ -898,9 +913,9 @@ static int __devinit snd_via82xx_mixer_new(via82xx_t *chip) /* * proc interface */ -static void snd_via82xx_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) +static void snd_via82xx_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { - via82xx_t *chip = entry->private_data; + struct via82xx_modem *chip = entry->private_data; int i; snd_iprintf(buffer, "%s\n\n", chip->card->longname); @@ -909,9 +924,9 @@ static void snd_via82xx_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *bu } } -static void __devinit snd_via82xx_proc_init(via82xx_t *chip) +static void __devinit snd_via82xx_proc_init(struct via82xx_modem *chip) { - snd_info_entry_t *entry; + struct snd_info_entry *entry; if (! snd_card_proc_new(chip->card, "via82xx", &entry)) snd_info_set_text_ops(entry, chip, 1024, snd_via82xx_proc_read); @@ -921,7 +936,7 @@ static void __devinit snd_via82xx_proc_init(via82xx_t *chip) * */ -static int snd_via82xx_chip_init(via82xx_t *chip) +static int snd_via82xx_chip_init(struct via82xx_modem *chip) { unsigned int val; unsigned long end_time; @@ -1004,9 +1019,9 @@ static int snd_via82xx_chip_init(via82xx_t *chip) /* * power management */ -static int snd_via82xx_suspend(snd_card_t *card, pm_message_t state) +static int snd_via82xx_suspend(struct snd_card *card, pm_message_t state) { - via82xx_t *chip = card->pm_private_data; + struct via82xx_modem *chip = card->pm_private_data; int i; for (i = 0; i < 2; i++) @@ -1021,9 +1036,9 @@ static int snd_via82xx_suspend(snd_card_t *card, pm_message_t state) return 0; } -static int snd_via82xx_resume(snd_card_t *card) +static int snd_via82xx_resume(struct snd_card *card) { - via82xx_t *chip = card->pm_private_data; + struct via82xx_modem *chip = card->pm_private_data; int i; pci_enable_device(chip->pci); @@ -1041,7 +1056,7 @@ static int snd_via82xx_resume(snd_card_t *card) } #endif /* CONFIG_PM */ -static int snd_via82xx_free(via82xx_t *chip) +static int snd_via82xx_free(struct via82xx_modem *chip) { unsigned int i; @@ -1053,29 +1068,29 @@ static int snd_via82xx_free(via82xx_t *chip) synchronize_irq(chip->irq); __end_hw: if (chip->irq >= 0) - free_irq(chip->irq, (void *)chip); + free_irq(chip->irq, chip); pci_release_regions(chip->pci); pci_disable_device(chip->pci); kfree(chip); return 0; } -static int snd_via82xx_dev_free(snd_device_t *device) +static int snd_via82xx_dev_free(struct snd_device *device) { - via82xx_t *chip = device->device_data; + struct via82xx_modem *chip = device->device_data; return snd_via82xx_free(chip); } -static int __devinit snd_via82xx_create(snd_card_t * card, +static int __devinit snd_via82xx_create(struct snd_card *card, struct pci_dev *pci, int chip_type, int revision, unsigned int ac97_clock, - via82xx_t ** r_via) + struct via82xx_modem ** r_via) { - via82xx_t *chip; + struct via82xx_modem *chip; int err; - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .dev_free = snd_via82xx_dev_free, }; @@ -1099,7 +1114,7 @@ static int __devinit snd_via82xx_create(snd_card_t * card, } chip->port = pci_resource_start(pci, 0); if (request_irq(pci->irq, snd_via82xx_interrupt, SA_INTERRUPT|SA_SHIRQ, - card->driver, (void *)chip)) { + card->driver, chip)) { snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); snd_via82xx_free(chip); return -EBUSY; @@ -1134,8 +1149,8 @@ static int __devinit snd_via82xx_create(snd_card_t * card, static int __devinit snd_via82xx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { - snd_card_t *card; - via82xx_t *chip; + struct snd_card *card; + struct via82xx_modem *chip; unsigned char revision; int chip_type = 0, card_type; unsigned int i;