ALSA: use snd_kcontrol_chip()
Subsystems (4)
cover ALSA: use snd_kcontrol_chip()
Takashi-san
Many drivers are getting its private data via kcontrol->private_data, but we already have common snd_kcontrol_chip(). We should use it.
Kuninori Morimoto (12):
ALSA: sh: use snd_kcontrol_chip()
ALSA: i2c: use snd_kcontrol_chip()
ALSA: core: use snd_kcontrol_chip()
ALSA: virtio: use snd_kcontrol_chip()
ALSA: pci: hda: use snd_kcontrol_chip()
ALSA: usb: midi: use snd_kcontrol_chip()
ALSA: usb: mixer: use snd_kcontrol_chip()
ALSA: pci: au88x0: use snd_kcontrol_chip()
ALSA: pci: asihpi: use snd_kcontrol_chip()
ALSA: pci: ali5451: use snd_kcontrol_chip()
ALSA: usb: mixer_quirks: use snd_kcontrol_chip()
ALSA: usb: mixer_us16x08: use snd_kcontrol_chip()
sound/core/control.c | 14 +++++++------- sound/i2c/other/pt2258.c | 8 ++++---- sound/pci/ali5451/ali5451.c | 4 ++-- sound/pci/asihpi/asihpi.c | 9 +++------ sound/pci/au88x0/au88x0_a3d.c | 10 +++++----- sound/pci/hda/cs35l56_hda.c | 12 ++++++------ sound/sh/aica.c | 8 ++++---- sound/usb/midi.c | 2 +- sound/usb/mixer.c | 22 +++++++++++----------- sound/usb/mixer_quirks.c | 2 +- sound/usb/mixer_us16x08.c | 32 ++++++++++++++++---------------- sound/virtio/virtio_kctl.c | 8 ++++---- 12 files changed, 64 insertions(+), 67 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/12 ALSA: sh: use snd_kcontrol_chip()
We can use snd_kcontrol_chip(). Let's use it.
--- sound/sh/aica.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/sh/aica.c +4 -4
@@ -469,8 +469,8 @@ static int aica_pcmvolume_info(struct snd_kcontrol *kcontrol,static int aica_pcmvolume_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct snd_card_aica *dreamcastcard; - dreamcastcard = kcontrol->private_data; +struct snd_card_aica *dreamcastcard =snd_kcontrol_chip (kcontrol); +if (unlikely (!dreamcastcard->channel))return -ETXTBSY ;/* we've not yet been set up */ ucontrol->value.integer.value[0 ] = dreamcastcard->channel->vol;
@@ -480,9 +480,9 @@ static int aica_pcmvolume_get(struct snd_kcontrol *kcontrol,static int aica_pcmvolume_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct snd_card_aica *dreamcastcard; +struct snd_card_aica *dreamcastcard =snd_kcontrol_chip (kcontrol);unsigned int vol; - dreamcastcard = kcontrol->private_data; +if (unlikely (!dreamcastcard->channel))return -ETXTBSY ; vol = ucontrol->value.integer.value[0 ];
Signature · 1 line
2.43.0
PATCH 2/12 ALSA: i2c: use snd_kcontrol_chip()
In reply to Kuninori MorimotoWe can use snd_kcontrol_chip(). Let's use it.
--- sound/i2c/other/pt2258.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/i2c/other/pt2258.c +4 -4
@@ -80,7 +80,7 @@ static int pt2258_stereo_volume_info(struct snd_kcontrol *kcontrol,static int pt2258_stereo_volume_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct snd_pt2258 *pt = kcontrol->private_data; +struct snd_pt2258 *pt =snd_kcontrol_chip (kcontrol);int base = kcontrol->private_value;/* chip does not support register reads */
@@ -92,7 +92,7 @@ static int pt2258_stereo_volume_get(struct snd_kcontrol *kcontrol,static int pt2258_stereo_volume_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct snd_pt2258 *pt = kcontrol->private_data; +struct snd_pt2258 *pt =snd_kcontrol_chip (kcontrol);int base = kcontrol->private_value;unsigned char bytes[2 ];int val0, val1;
@@ -133,7 +133,7 @@ static int pt2258_stereo_volume_put(struct snd_kcontrol *kcontrol,static int pt2258_switch_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct snd_pt2258 *pt = kcontrol->private_data; +struct snd_pt2258 *pt =snd_kcontrol_chip (kcontrol); ucontrol->value.integer.value[0 ] = !pt->mute;return 0 ;
@@ -142,7 +142,7 @@ static int pt2258_switch_get(struct snd_kcontrol *kcontrol,static int pt2258_switch_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct snd_pt2258 *pt = kcontrol->private_data; +struct snd_pt2258 *pt =snd_kcontrol_chip (kcontrol);unsigned char bytes[2 ];int val;
Signature · 1 line
2.43.0
PATCH 3/12 ALSA: core: use snd_kcontrol_chip()
In reply to Kuninori MorimotoWe can use snd_kcontrol_chip(). Let's use it.
--- sound/core/control.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
sound/core/control.c +7 -7
@@ -1405,7 +1405,7 @@ static bool check_user_elem_overflow(struct snd_card *card, ssize_t add)static int snd_ctl_elem_user_info (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_info *uinfo) { -struct user_element *ue = kcontrol->private_data; +struct user_element *ue =snd_kcontrol_chip (kcontrol);unsigned int offset; offset =snd_ctl_get_ioff (kcontrol, &uinfo->id);
@@ -1418,7 +1418,7 @@ static int snd_ctl_elem_user_info(struct snd_kcontrol *kcontrol,static int snd_ctl_elem_user_enum_info (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_info *uinfo) { -struct user_element *ue = kcontrol->private_data; +struct user_element *ue =snd_kcontrol_chip (kcontrol);const char *names;unsigned int item;unsigned int offset;
@@ -1443,7 +1443,7 @@ static int snd_ctl_elem_user_enum_info(struct snd_kcontrol *kcontrol,static int snd_ctl_elem_user_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct user_element *ue = kcontrol->private_data; +struct user_element *ue =snd_kcontrol_chip (kcontrol);unsigned int size = ue->elem_data_size;char *src = ue->elem_data +snd_ctl_get_ioff (kcontrol, &ucontrol->id) * size;
@@ -1456,7 +1456,7 @@ static int snd_ctl_elem_user_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) {int err, change; -struct user_element *ue = kcontrol->private_data; +struct user_element *ue =snd_kcontrol_chip (kcontrol);unsigned int size = ue->elem_data_size;char *dst = ue->elem_data +snd_ctl_get_ioff (kcontrol, &ucontrol->id) * size;
@@ -1475,7 +1475,7 @@ static int snd_ctl_elem_user_put(struct snd_kcontrol *kcontrol,static int replace_user_tlv (struct snd_kcontrol *kctl,unsigned int __user *buf,unsigned int size) { -struct user_element *ue = kctl->private_data; +struct user_element *ue =snd_kcontrol_chip (kctl);unsigned int *container;unsigned int mask =0 ;int i;
@@ -1528,7 +1528,7 @@ static int replace_user_tlv(struct snd_kcontrol *kctl, unsigned int __user *buf,static int read_user_tlv (struct snd_kcontrol *kctl,unsigned int __user *buf,unsigned int size) { -struct user_element *ue = kctl->private_data; +struct user_element *ue =snd_kcontrol_chip (kctl);if (ue->tlv_data_size ==0 || ue->tlv_data ==NULL )return -ENXIO ;
@@ -1598,7 +1598,7 @@ static size_t compute_user_elem_size(size_t size, unsigned int count)static void snd_ctl_elem_user_free (struct snd_kcontrol *kcontrol) { -struct user_element *ue = kcontrol->private_data; +struct user_element *ue =snd_kcontrol_chip (kcontrol);// decrement the allocation size. ue->card->user_ctl_alloc_size -=compute_user_elem_size (ue->elem_data_size, kcontrol->count);
Signature · 1 line
2.43.0
PATCH 4/12 ALSA: virtio: use snd_kcontrol_chip()
In reply to Kuninori MorimotoWe can use snd_kcontrol_chip(). Let's use it.
--- sound/virtio/virtio_kctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/virtio/virtio_kctl.c +4 -4
@@ -47,7 +47,7 @@ static const unsigned int g_v2a_mask_map[] = {static int virtsnd_kctl_info (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_info *uinfo) { -struct virtio_snd *snd = kcontrol->private_data; +struct virtio_snd *snd =snd_kcontrol_chip (kcontrol);struct virtio_kctl *kctl = &snd->kctls[kcontrol->private_value];struct virtio_snd_ctl_info *kinfo = &snd->kctl_infos[kcontrol->private_value];
@@ -102,7 +102,7 @@ static int virtsnd_kctl_info(struct snd_kcontrol *kcontrol,static int virtsnd_kctl_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *uvalue) { -struct virtio_snd *snd = kcontrol->private_data; +struct virtio_snd *snd =snd_kcontrol_chip (kcontrol);struct virtio_snd_ctl_info *kinfo = &snd->kctl_infos[kcontrol->private_value];unsigned int type =le32_to_cpu (kinfo->type);
@@ -175,7 +175,7 @@ static int virtsnd_kctl_get(struct snd_kcontrol *kcontrol,static int virtsnd_kctl_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *uvalue) { -struct virtio_snd *snd = kcontrol->private_data; +struct virtio_snd *snd =snd_kcontrol_chip (kcontrol);struct virtio_snd_ctl_info *kinfo = &snd->kctl_infos[kcontrol->private_value];unsigned int type =le32_to_cpu (kinfo->type);
@@ -239,7 +239,7 @@ static int virtsnd_kctl_put(struct snd_kcontrol *kcontrol,static int virtsnd_kctl_tlv_op (struct snd_kcontrol *kcontrol,int op_flag,unsigned int size,unsigned int __user *utlv) { -struct virtio_snd *snd = kcontrol->private_data; +struct virtio_snd *snd =snd_kcontrol_chip (kcontrol);struct virtio_snd_msg *msg;struct virtio_snd_ctl_hdr *hdr;unsigned int *tlv;
Signature · 1 line
2.43.0
PATCH 5/12 ALSA: pci: hda: use snd_kcontrol_chip()
In reply to Kuninori MorimotoWe can use snd_kcontrol_chip(). Let's use it.
--- sound/pci/hda/cs35l56_hda.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/pci/hda/cs35l56_hda.c +6 -6
@@ -179,7 +179,7 @@ static int cs35l56_hda_mixer_info(struct snd_kcontrol *kcontrol,static int cs35l56_hda_mixer_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct cs35l56_hda *cs35l56 = (struct cs35l56_hda *)kcontrol->private_data; +struct cs35l56_hda *cs35l56 =snd_kcontrol_chip (kcontrol);unsigned int reg_val;int i;
@@ -201,7 +201,7 @@ static int cs35l56_hda_mixer_get(struct snd_kcontrol *kcontrol,static int cs35l56_hda_mixer_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct cs35l56_hda *cs35l56 = (struct cs35l56_hda *)kcontrol->private_data; +struct cs35l56_hda *cs35l56 =snd_kcontrol_chip (kcontrol);unsigned int item = ucontrol->value.enumerated.item[0 ];bool changed;
@@ -230,7 +230,7 @@ static int cs35l56_hda_posture_info(struct snd_kcontrol *kcontrol,static int cs35l56_hda_posture_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct cs35l56_hda *cs35l56 = (struct cs35l56_hda *)kcontrol->private_data; +struct cs35l56_hda *cs35l56 =snd_kcontrol_chip (kcontrol);unsigned int pos;int ret;
@@ -248,7 +248,7 @@ static int cs35l56_hda_posture_get(struct snd_kcontrol *kcontrol,static int cs35l56_hda_posture_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct cs35l56_hda *cs35l56 = (struct cs35l56_hda *)kcontrol->private_data; +struct cs35l56_hda *cs35l56 =snd_kcontrol_chip (kcontrol);unsigned long pos = ucontrol->value.integer.value[0 ];bool changed;int ret;
@@ -297,7 +297,7 @@ static int cs35l56_hda_vol_info(struct snd_kcontrol *kcontrol,static int cs35l56_hda_vol_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct cs35l56_hda *cs35l56 = (struct cs35l56_hda *)kcontrol->private_data; +struct cs35l56_hda *cs35l56 =snd_kcontrol_chip (kcontrol);unsigned int raw_vol;int vol;int ret;
@@ -323,7 +323,7 @@ static int cs35l56_hda_vol_get(struct snd_kcontrol *kcontrol,static int cs35l56_hda_vol_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct cs35l56_hda *cs35l56 = (struct cs35l56_hda *)kcontrol->private_data; +struct cs35l56_hda *cs35l56 =snd_kcontrol_chip (kcontrol);long vol = ucontrol->value.integer.value[0 ];unsigned int raw_vol;bool changed;
Signature · 1 line
2.43.0
PATCH 6/12 ALSA: usb: midi: use snd_kcontrol_chip()
In reply to Kuninori MorimotoWe can use snd_kcontrol_chip(). Let's use it.
--- sound/usb/midi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/midi.c +1 -1
@@ -2088,7 +2088,7 @@ static int roland_load_get(struct snd_kcontrol *kcontrol,static int roland_load_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *value) { -struct snd_usb_midi *umidi = kcontrol->private_data; +struct snd_usb_midi *umidi =snd_kcontrol_chip (kcontrol);int changed;if (value->value.enumerated.item[0 ] >1 )
Signature · 1 line
2.43.0
PATCH 7/12 ALSA: usb: mixer: use snd_kcontrol_chip()
In reply to Kuninori MorimotoWe can use snd_kcontrol_chip(). Let's use it.
--- sound/usb/mixer.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
sound/usb/mixer.c +11 -11
@@ -547,7 +547,7 @@ int snd_usb_set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel,int snd_usb_mixer_vol_tlv (struct snd_kcontrol *kcontrol,int op_flag,unsigned int size,unsigned int __user *_tlv) { -struct usb_mixer_elem_info *cval = kcontrol->private_data; +struct usb_mixer_elem_info *cval =snd_kcontrol_chip (kcontrol);DECLARE_TLV_DB_MINMAX (scale,0 ,0 );if (size <sizeof (scale))
@@ -1367,7 +1367,7 @@ static int get_max_exposed(struct usb_mixer_elem_info *cval)static int mixer_ctl_feature_info (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_info *uinfo) { -struct usb_mixer_elem_info *cval = kcontrol->private_data; +struct usb_mixer_elem_info *cval =snd_kcontrol_chip (kcontrol);if (cval->val_type ==USB_MIXER_BOOLEAN || cval->val_type ==USB_MIXER_INV_BOOLEAN )
@@ -1399,7 +1399,7 @@ static int mixer_ctl_feature_info(struct snd_kcontrol *kcontrol,static int mixer_ctl_feature_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *cval = kcontrol->private_data; +struct usb_mixer_elem_info *cval =snd_kcontrol_chip (kcontrol);int c, cnt, val, err; ucontrol->value.integer.value[0 ] = cval->min;
@@ -1431,7 +1431,7 @@ static int mixer_ctl_feature_get(struct snd_kcontrol *kcontrol,static int mixer_ctl_feature_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *cval = kcontrol->private_data; +struct usb_mixer_elem_info *cval =snd_kcontrol_chip (kcontrol);int max_val =get_max_exposed (cval);int c, cnt, val, oval, err;int changed =0 ;
@@ -1475,7 +1475,7 @@ static int mixer_ctl_feature_put(struct snd_kcontrol *kcontrol,static int mixer_ctl_master_bool_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *cval = kcontrol->private_data; +struct usb_mixer_elem_info *cval =snd_kcontrol_chip (kcontrol);int val, err; err =snd_usb_get_cur_mix_value (cval,0 ,0 , &val);
@@ -1543,7 +1543,7 @@ static int get_connector_value(struct usb_mixer_elem_info *cval,static int mixer_ctl_connector_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *cval = kcontrol->private_data; +struct usb_mixer_elem_info *cval =snd_kcontrol_chip (kcontrol);int ret, val; ret =get_connector_value (cval, kcontrol->id.name, &val);
@@ -2302,7 +2302,7 @@ static int parse_audio_mixer_unit(struct mixer_build *state, int unitid,static int mixer_ctl_procunit_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *cval = kcontrol->private_data; +struct usb_mixer_elem_info *cval =snd_kcontrol_chip (kcontrol);int err, val; err =get_cur_ctl_value (cval, cval->control <<8 , &val);
@@ -2319,7 +2319,7 @@ static int mixer_ctl_procunit_get(struct snd_kcontrol *kcontrol,static int mixer_ctl_procunit_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *cval = kcontrol->private_data; +struct usb_mixer_elem_info *cval =snd_kcontrol_chip (kcontrol);int val, oval, err; err =get_cur_ctl_value (cval, cval->control <<8 , &oval);
@@ -2654,7 +2654,7 @@ static int parse_audio_extension_unit(struct mixer_build *state, int unitid,static int mixer_ctl_selector_info (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_info *uinfo) { -struct usb_mixer_elem_info *cval = kcontrol->private_data; +struct usb_mixer_elem_info *cval =snd_kcontrol_chip (kcontrol);const char **itemlist = (const char **)kcontrol->private_value;if (snd_BUG_ON (!itemlist))
@@ -2666,7 +2666,7 @@ static int mixer_ctl_selector_info(struct snd_kcontrol *kcontrol,static int mixer_ctl_selector_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *cval = kcontrol->private_data; +struct usb_mixer_elem_info *cval =snd_kcontrol_chip (kcontrol);int val, err; err =get_cur_ctl_value (cval, cval->control <<8 , &val);
@@ -2683,7 +2683,7 @@ static int mixer_ctl_selector_get(struct snd_kcontrol *kcontrol,static int mixer_ctl_selector_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *cval = kcontrol->private_data; +struct usb_mixer_elem_info *cval =snd_kcontrol_chip (kcontrol);int val, oval, err; err =get_cur_ctl_value (cval, cval->control <<8 , &oval);
Signature · 1 line
2.43.0
PATCH 8/12 ALSA: pci: au88x0: use snd_kcontrol_chip()
In reply to Kuninori MorimotoWe can use snd_kcontrol_chip(). Let's use it.
--- sound/pci/au88x0/au88x0_a3d.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/pci/au88x0/au88x0_a3d.c +5 -5
@@ -754,7 +754,7 @@ snd_vortex_a3d_filter_info(struct snd_kcontrol *kcontrol,static int snd_vortex_a3d_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -//a3dsrc_t *a = kcontrol->private_data; +//a3dsrc_t *a = snd_kcontrol_chip(kcontrol); /* No read yet. Would this be really useable/needed ? */ return 0 ;
@@ -764,7 +764,7 @@ static int snd_vortex_a3d_hrtf_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - a3dsrc_t *a = kcontrol->private_data; + a3dsrc_t *a = snd_kcontrol_chip(kcontrol);int i;int coord[6 ];for (i =0 ; i <6 ; i++)
@@ -781,7 +781,7 @@ static int snd_vortex_a3d_itd_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - a3dsrc_t *a = kcontrol->private_data; + a3dsrc_t *a = snd_kcontrol_chip(kcontrol);int coord[6 ];int i;for (i =0 ; i <6 ; i++)
@@ -800,7 +800,7 @@ static int snd_vortex_a3d_ild_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - a3dsrc_t *a = kcontrol->private_data; + a3dsrc_t *a = snd_kcontrol_chip(kcontrol);int l, r;/* There may be some scale tranlation needed here. */ l = ucontrol->value.integer.value[0 ];
@@ -816,7 +816,7 @@ static int snd_vortex_a3d_filter_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - a3dsrc_t *a = kcontrol->private_data; + a3dsrc_t *a = snd_kcontrol_chip(kcontrol);int i;int params[6 ];for (i =0 ; i <6 ; i++)
Signature · 1 line
2.43.0
PATCH 9/12 ALSA: pci: asihpi: use snd_kcontrol_chip()
In reply to Kuninori MorimotoWe can use snd_kcontrol_chip(). Let's use it.
--- sound/pci/asihpi/asihpi.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
sound/pci/asihpi/asihpi.c +3 -6
@@ -2300,8 +2300,7 @@ static const char * const sampleclock_sources[] = {static int snd_asihpi_clksrc_info (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_info *uinfo) { -struct snd_card_asihpi *asihpi = - (struct snd_card_asihpi *)(kcontrol->private_data); +struct snd_card_asihpi *asihpi =snd_kcontrol_chip (kcontrol);struct clk_cache *clkcache = &asihpi->cc; uinfo->type =SNDRV_CTL_ELEM_TYPE_ENUMERATED ; uinfo->count =1 ;
@@ -2319,8 +2318,7 @@ static int snd_asihpi_clksrc_info(struct snd_kcontrol *kcontrol,static int snd_asihpi_clksrc_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct snd_card_asihpi *asihpi = - (struct snd_card_asihpi *)(kcontrol->private_data); +struct snd_card_asihpi *asihpi =snd_kcontrol_chip (kcontrol);struct clk_cache *clkcache = &asihpi->cc;u32 h_control = kcontrol->private_value;u16 source, srcindex =0 ;
@@ -2347,8 +2345,7 @@ static int snd_asihpi_clksrc_get(struct snd_kcontrol *kcontrol,static int snd_asihpi_clksrc_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct snd_card_asihpi *asihpi = - (struct snd_card_asihpi *)(kcontrol->private_data); +struct snd_card_asihpi *asihpi =snd_kcontrol_chip (kcontrol);struct clk_cache *clkcache = &asihpi->cc;unsigned int item;int change;
Signature · 1 line
2.43.0
PATCH 10/12 ALSA: pci: ali5451: use snd_kcontrol_chip()
In reply to Kuninori MorimotoWe can use snd_kcontrol_chip(). Let's use it.
--- sound/pci/ali5451/ali5451.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/ali5451/ali5451.c +2 -2
@@ -1688,7 +1688,7 @@ static int snd_ali_build_pcms(struct snd_ali *codec)static int snd_ali5451_spdif_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct snd_ali *codec = kcontrol->private_data; +struct snd_ali *codec =snd_kcontrol_chip (kcontrol);unsigned int spdif_enable; spdif_enable = ucontrol->value.integer.value[0 ] ?1 :0 ;
@@ -1716,7 +1716,7 @@ static int snd_ali5451_spdif_get(struct snd_kcontrol *kcontrol,static int snd_ali5451_spdif_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct snd_ali *codec = kcontrol->private_data; +struct snd_ali *codec =snd_kcontrol_chip (kcontrol);unsigned int change =0 , spdif_enable =0 ; spdif_enable = ucontrol->value.integer.value[0 ] ?1 :0 ;
Signature · 1 line
2.43.0
PATCH 11/12 ALSA: usb: mixer_quirks: use snd_kcontrol_chip()
In reply to Kuninori MorimotoWe can use snd_kcontrol_chip(). Let's use it.
--- sound/usb/mixer_quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/mixer_quirks.c +1 -1
@@ -2000,7 +2000,7 @@ static int realtek_hda_get(struct snd_usb_audio *chip, u32 cmd, u32 *value)static int realtek_ctl_connector_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *cval = kcontrol->private_data; +struct usb_mixer_elem_info *cval =snd_kcontrol_chip (kcontrol);struct snd_usb_audio *chip = cval->head.mixer->chip;u32 pv = kcontrol->private_value;u32 node_id = pv &0xff ;
Signature · 1 line
2.43.0
PATCH 12/12 ALSA: usb: mixer_us16x08: use snd_kcontrol_chip()
In reply to Kuninori MorimotoWe can use snd_kcontrol_chip(). Let's use it.
--- sound/usb/mixer_us16x08.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
sound/usb/mixer_us16x08.c +16 -16
@@ -180,7 +180,7 @@ static int snd_us16x08_route_info(struct snd_kcontrol *kcontrol,static int snd_us16x08_route_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);int index = ucontrol->id.index;/* route has no bias */
@@ -192,7 +192,7 @@ static int snd_us16x08_route_get(struct snd_kcontrol *kcontrol,static int snd_us16x08_route_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);struct snd_usb_audio *chip = elem->head.mixer->chip;int index = ucontrol->id.index;char buf[sizeof (route_msg)];
@@ -249,7 +249,7 @@ static int snd_us16x08_master_info(struct snd_kcontrol *kcontrol,static int snd_us16x08_master_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);int index = ucontrol->id.index; ucontrol->value.integer.value[0 ] = elem->cache_val[index];
@@ -260,7 +260,7 @@ static int snd_us16x08_master_get(struct snd_kcontrol *kcontrol,static int snd_us16x08_master_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);struct snd_usb_audio *chip = elem->head.mixer->chip;char buf[sizeof (mix_msg_out)];int val, err;
@@ -297,7 +297,7 @@ static int snd_us16x08_master_put(struct snd_kcontrol *kcontrol,static int snd_us16x08_bus_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);struct snd_usb_audio *chip = elem->head.mixer->chip;char buf[sizeof (mix_msg_out)];int val, err =0 ;
@@ -338,7 +338,7 @@ static int snd_us16x08_bus_put(struct snd_kcontrol *kcontrol,static int snd_us16x08_bus_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);switch (elem->head.id) {case SND_US16X08_ID_BUSS_OUT :
@@ -359,7 +359,7 @@ static int snd_us16x08_bus_get(struct snd_kcontrol *kcontrol,static int snd_us16x08_channel_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);int index = ucontrol->id.index; ucontrol->value.integer.value[0 ] = elem->cache_val[index];
@@ -370,7 +370,7 @@ static int snd_us16x08_channel_get(struct snd_kcontrol *kcontrol,static int snd_us16x08_channel_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);struct snd_usb_audio *chip = elem->head.mixer->chip;char buf[sizeof (mix_msg_in)];int val, err;
@@ -417,7 +417,7 @@ static int snd_us16x08_mix_info(struct snd_kcontrol *kcontrol,static int snd_us16x08_comp_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);struct snd_us16x08_comp_store *store = elem->private_data;int index = ucontrol->id.index;int val_idx =COMP_STORE_IDX (elem->head.id);
@@ -430,7 +430,7 @@ static int snd_us16x08_comp_get(struct snd_kcontrol *kcontrol,static int snd_us16x08_comp_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);struct snd_usb_audio *chip = elem->head.mixer->chip;struct snd_us16x08_comp_store *store = elem->private_data;int index = ucontrol->id.index;
@@ -485,7 +485,7 @@ static int snd_us16x08_eqswitch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) {int val; -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);struct snd_us16x08_eq_store *store = elem->private_data;int index = ucontrol->id.index;
@@ -500,7 +500,7 @@ static int snd_us16x08_eqswitch_get(struct snd_kcontrol *kcontrol,static int snd_us16x08_eqswitch_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);struct snd_usb_audio *chip = elem->head.mixer->chip;struct snd_us16x08_eq_store *store = elem->private_data;int index = ucontrol->id.index;
@@ -544,7 +544,7 @@ static int snd_us16x08_eq_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) {int val; -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);struct snd_us16x08_eq_store *store = elem->private_data;int index = ucontrol->id.index;int b_idx =EQ_STORE_BAND_IDX (elem->head.id) -1 ;
@@ -560,7 +560,7 @@ static int snd_us16x08_eq_get(struct snd_kcontrol *kcontrol,static int snd_us16x08_eq_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);struct snd_usb_audio *chip = elem->head.mixer->chip;struct snd_us16x08_eq_store *store = elem->private_data;int index = ucontrol->id.index;
@@ -684,7 +684,7 @@ static int snd_us16x08_meter_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) {int i, set; -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);struct snd_usb_audio *chip = elem->head.mixer->chip;struct snd_us16x08_meter_store *store = elem->private_data;u8 meter_urb[64 ] = {0 };
@@ -744,7 +744,7 @@ static int snd_us16x08_meter_get(struct snd_kcontrol *kcontrol,static int snd_us16x08_meter_put (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) { -struct usb_mixer_elem_info *elem = kcontrol->private_data; +struct usb_mixer_elem_info *elem =snd_kcontrol_chip (kcontrol);struct snd_us16x08_meter_store *store = elem->private_data;int val;
Signature · 1 line
2.43.0
Takashi Iwai
AppliedQuoted 7 lines · Kuninori Morimoto
Takashi-san
Many drivers are getting its private data via
kcontrol->private_data, but we already have commonsnd_kcontrol_chip(). We should use it.
Quoted 13 lines
Kuninori Morimoto (12):
ALSA: sh: usesnd_kcontrol_chip()
ALSA: i2c: usesnd_kcontrol_chip()
ALSA: core: usesnd_kcontrol_chip()
ALSA: virtio: usesnd_kcontrol_chip()
ALSA: pci: hda: usesnd_kcontrol_chip()
ALSA: usb: midi: usesnd_kcontrol_chip()
ALSA: usb: mixer: usesnd_kcontrol_chip()
ALSA: pci: au88x0: usesnd_kcontrol_chip()
ALSA: pci: asihpi: usesnd_kcontrol_chip()
ALSA: pci: ali5451: usesnd_kcontrol_chip()
ALSA: usb:mixer_quirks: usesnd_kcontrol_chip()
ALSA: usb:mixer_us16x08: usesnd_kcontrol_chip()
Applied all patches now to for-next branch.
thanks,
Takashi