static int vx_mic_level_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
        ucontrol->value.integer.value[0] = chip->mic_level;
        return 0;
 }
 static int vx_mic_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
        unsigned int val = ucontrol->value.integer.value[0];
 
        if (val > MIC_LEVEL_MAX)
 static int vx_mic_boost_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
        ucontrol->value.integer.value[0] = chip->mic_level;
        return 0;
 }
 static int vx_mic_boost_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
        int val = !!ucontrol->value.integer.value[0];
        mutex_lock(&_chip->mixer_mutex);
        if (chip->mic_level != val) {
 
 int vxp_add_mic_controls(struct vx_core *_chip)
 {
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
        int err;
 
        /* mute input levels */
 
 
 static inline unsigned long vxp_reg_addr(struct vx_core *_chip, int reg)
 {
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
        return chip->port + vxp_reg_offset[reg];
 }
 
 
 static void vxp_reset_dsp(struct vx_core *_chip)
 {
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
 
        /* set the reset dsp bit to 1 */
        vx_outb(chip, CDSP, chip->regCDSP | VXP_CDSP_DSP_RESET_MASK);
  */
 static void vxp_reset_codec(struct vx_core *_chip)
 {
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
 
        /* Set the reset CODEC bit to 1. */
        vx_outb(chip, CDSP, chip->regCDSP | VXP_CDSP_CODEC_RESET_MASK);
  */
 static int vxp_load_xilinx_binary(struct vx_core *_chip, const struct firmware *fw)
 {
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
        unsigned int i;
        int c;
        int regCSUER, regRUER;
  */
 static int vxp_test_and_ack(struct vx_core *_chip)
 {
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
 
        /* not booted yet? */
        if (! (_chip->chip_status & VX_STAT_XILINX_LOADED))
  */
 static void vxp_validate_irq(struct vx_core *_chip, int enable)
 {
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
 
        /* Set the interrupt enable bit to 1 in CDSP register */
        if (enable)
  */
 static void vx_setup_pseudo_dma(struct vx_core *_chip, int do_write)
 {
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
 
        /* Interrupt mode and HREQ pin enabled for host transmit / receive data transfers */
        vx_outb(chip, ICR, do_write ? ICR_TREQ : ICR_RREQ);
  */
 static void vx_release_pseudo_dma(struct vx_core *_chip)
 {
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
 
        /* Disable DMA and 16-bit accesses */
        chip->regDIALOG &= ~(VXP_DLG_DMAWRITE_SEL_MASK|
 static void vxp_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime,
                         struct vx_pipe *pipe, int count)
 {
-       struct snd_vxpocket *pchip = (struct snd_vxpocket *)chip;
+       struct snd_vxpocket *pchip = to_vxpocket(chip);
        long port = vxp_reg_addr(chip, VX_DMA);
        int offset = pipe->hw_ptr;
        unsigned short *addr = (unsigned short *)(runtime->dma_area + offset);
  */
 void vx_set_mic_boost(struct vx_core *chip, int boost)
 {
-       struct snd_vxpocket *pchip = (struct snd_vxpocket *)chip;
+       struct snd_vxpocket *pchip = to_vxpocket(chip);
 
        if (chip->chip_status & VX_STAT_IS_STALE)
                return;
  */
 void vx_set_mic_level(struct vx_core *chip, int level)
 {
-       struct snd_vxpocket *pchip = (struct snd_vxpocket *)chip;
+       struct snd_vxpocket *pchip = to_vxpocket(chip);
 
        if (chip->chip_status & VX_STAT_IS_STALE)
                return;
  */
 static void vxp_change_audio_source(struct vx_core *_chip, int src)
 {
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
 
        switch (src) {
        case VX_AUDIO_SRC_DIGITAL:
  */
 static void vxp_set_clock_source(struct vx_core *_chip, int source)
 {
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
 
        if (source == INTERNAL_QUARTZ)
                chip->regCDSP &= ~VXP_CDSP_CLOCKIN_SEL_MASK;
  */
 static void vxp_reset_board(struct vx_core *_chip, int cold_reset)
 {
-       struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+       struct snd_vxpocket *chip = to_vxpocket(_chip);
 
        chip->regCDSP = 0;
        chip->regDIALOG = 0;