diff options
author | Takashi Iwai <tiwai@suse.de> | 2017-05-12 10:02:08 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-05-15 11:21:05 +0200 |
commit | 5f976f58917eafbd8f725b9b7c0efcf6937e0e83 (patch) | |
tree | 90b92404da674fb2a6365a0a71e34914781f0b25 /sound/pci/vx222/vx222_ops.c | |
parent | ALSA: us122l: enable compile testing (diff) | |
download | linux-5f976f58917eafbd8f725b9b7c0efcf6937e0e83.tar.xz linux-5f976f58917eafbd8f725b9b7c0efcf6937e0e83.zip |
ALSA: vx222: Use container_of()
The vx222 driver is using the explicit cast from the parent class
pointer, but it'll be broken when the structure field randomization is
applied. Use container_of() in a modern manner, instead.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to '')
-rw-r--r-- | sound/pci/vx222/vx222_ops.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c index 7df1663ea510..d4298af6d3ee 100644 --- a/sound/pci/vx222/vx222_ops.c +++ b/sound/pci/vx222/vx222_ops.c @@ -86,7 +86,7 @@ static int vx2_reg_index[VX_REG_MAX] = { static inline unsigned long vx2_reg_addr(struct vx_core *_chip, int reg) { - struct snd_vx222 *chip = (struct snd_vx222 *)_chip; + struct snd_vx222 *chip = to_vx222(_chip); return chip->port[vx2_reg_index[reg]] + vx2_reg_offset[reg]; } @@ -159,7 +159,7 @@ static void vx2_outl(struct vx_core *chip, int offset, unsigned int val) static void vx2_reset_dsp(struct vx_core *_chip) { - struct snd_vx222 *chip = (struct snd_vx222 *)_chip; + struct snd_vx222 *chip = to_vx222(_chip); /* set the reset dsp bit to 0 */ vx_outl(chip, CDSP, chip->regCDSP & ~VX_CDSP_DSP_RESET_MASK); @@ -174,7 +174,7 @@ static void vx2_reset_dsp(struct vx_core *_chip) static int vx2_test_xilinx(struct vx_core *_chip) { - struct snd_vx222 *chip = (struct snd_vx222 *)_chip; + struct snd_vx222 *chip = to_vx222(_chip); unsigned int data; dev_dbg(_chip->card->dev, "testing xilinx...\n"); @@ -479,7 +479,7 @@ static int vx2_test_and_ack(struct vx_core *chip) */ static void vx2_validate_irq(struct vx_core *_chip, int enable) { - struct snd_vx222 *chip = (struct snd_vx222 *)_chip; + struct snd_vx222 *chip = to_vx222(_chip); /* Set the interrupt enable bit to 1 in CDSP register */ if (enable) { @@ -730,7 +730,7 @@ static void vx2_old_write_codec_bit(struct vx_core *chip, int codec, unsigned in */ static void vx2_reset_codec(struct vx_core *_chip) { - struct snd_vx222 *chip = (struct snd_vx222 *)_chip; + struct snd_vx222 *chip = to_vx222(_chip); /* Set the reset CODEC bit to 0. */ vx_outl(chip, CDSP, chip->regCDSP &~ VX_CDSP_CODEC_RESET_MASK); @@ -772,7 +772,7 @@ static void vx2_reset_codec(struct vx_core *_chip) */ static void vx2_change_audio_source(struct vx_core *_chip, int src) { - struct snd_vx222 *chip = (struct snd_vx222 *)_chip; + struct snd_vx222 *chip = to_vx222(_chip); switch (src) { case VX_AUDIO_SRC_DIGITAL: @@ -791,7 +791,7 @@ static void vx2_change_audio_source(struct vx_core *_chip, int src) */ static void vx2_set_clock_source(struct vx_core *_chip, int source) { - struct snd_vx222 *chip = (struct snd_vx222 *)_chip; + struct snd_vx222 *chip = to_vx222(_chip); if (source == INTERNAL_QUARTZ) chip->regCFG &= ~VX_CFG_CLOCKIN_SEL_MASK; @@ -805,7 +805,7 @@ static void vx2_set_clock_source(struct vx_core *_chip, int source) */ static void vx2_reset_board(struct vx_core *_chip, int cold_reset) { - struct snd_vx222 *chip = (struct snd_vx222 *)_chip; + struct snd_vx222 *chip = to_vx222(_chip); /* initialize the register values */ chip->regCDSP = VX_CDSP_CODEC_RESET_MASK | VX_CDSP_DSP_RESET_MASK ; @@ -878,7 +878,7 @@ static int vx_input_level_info(struct snd_kcontrol *kcontrol, struct snd_ctl_ele static int vx_input_level_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct vx_core *_chip = snd_kcontrol_chip(kcontrol); - struct snd_vx222 *chip = (struct snd_vx222 *)_chip; + struct snd_vx222 *chip = to_vx222(_chip); mutex_lock(&_chip->mixer_mutex); ucontrol->value.integer.value[0] = chip->input_level[0]; ucontrol->value.integer.value[1] = chip->input_level[1]; @@ -889,7 +889,7 @@ static int vx_input_level_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem static int vx_input_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct vx_core *_chip = snd_kcontrol_chip(kcontrol); - struct snd_vx222 *chip = (struct snd_vx222 *)_chip; + struct snd_vx222 *chip = to_vx222(_chip); if (ucontrol->value.integer.value[0] < 0 || ucontrol->value.integer.value[0] > MIC_LEVEL_MAX) return -EINVAL; @@ -922,7 +922,7 @@ static int vx_mic_level_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_ 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_vx222 *chip = (struct snd_vx222 *)_chip; + struct snd_vx222 *chip = to_vx222(_chip); ucontrol->value.integer.value[0] = chip->mic_level; return 0; } @@ -930,7 +930,7 @@ static int vx_mic_level_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v 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_vx222 *chip = (struct snd_vx222 *)_chip; + struct snd_vx222 *chip = to_vx222(_chip); if (ucontrol->value.integer.value[0] < 0 || ucontrol->value.integer.value[0] > MIC_LEVEL_MAX) return -EINVAL; @@ -973,7 +973,7 @@ static const struct snd_kcontrol_new vx_control_mic_level = { static int vx2_add_mic_controls(struct vx_core *_chip) { - struct snd_vx222 *chip = (struct snd_vx222 *)_chip; + struct snd_vx222 *chip = to_vx222(_chip); int err; if (_chip->type != VX_TYPE_MIC) |