ALSA: virtio: use snd_kcontrol_chip()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 7 May 2025 04:59:39 +0000 (04:59 +0000)
committerTakashi Iwai <tiwai@suse.de>
Thu, 8 May 2025 09:53:34 +0000 (11:53 +0200)
We can use snd_kcontrol_chip(). Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/87r011audg.wl-kuninori.morimoto.gx@renesas.com
sound/virtio/virtio_kctl.c

index 7aa79c05b46482978b8bc23cc88171abbc16c935..ffb903d56297a74cef3fbeca983c129c4259d3a4 100644 (file)
@@ -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 @@ on_failure:
 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;