hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/include/sound/control.h
....@@ -1,25 +1,10 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 #ifndef __SOUND_CONTROL_H
23 #define __SOUND_CONTROL_H
34
45 /*
56 * Header file for control interface
67 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
7
- *
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation; either version 2 of the License, or
12
- * (at your option) any later version.
13
- *
14
- * This program is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with this program; if not, write to the Free Software
21
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
- *
238 */
249
2510 #include <linux/wait.h>
....@@ -37,6 +22,16 @@
3722 unsigned int size,
3823 unsigned int __user *tlv);
3924
25
+/* internal flag for skipping validations */
26
+#ifdef CONFIG_SND_CTL_VALIDATION
27
+#define SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK (1 << 27)
28
+#define snd_ctl_skip_validation(info) \
29
+ ((info)->access & SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK)
30
+#else
31
+#define SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK 0
32
+#define snd_ctl_skip_validation(info) true
33
+#endif
34
+
4035 enum {
4136 SNDRV_CTL_TLV_OP_READ = 0,
4237 SNDRV_CTL_TLV_OP_WRITE = 1,
....@@ -47,7 +42,7 @@
4742 snd_ctl_elem_iface_t iface; /* interface identifier */
4843 unsigned int device; /* device/client number */
4944 unsigned int subdevice; /* subdevice (substream) number */
50
- const unsigned char *name; /* ASCII name of item */
45
+ const char *name; /* ASCII name of item */
5146 unsigned int index; /* index of item */
5247 unsigned int access; /* access rights */
5348 unsigned int count; /* count of same elements */
....@@ -80,7 +75,7 @@
8075 unsigned long private_value;
8176 void *private_data;
8277 void (*private_free)(struct snd_kcontrol *kcontrol);
83
- struct snd_kcontrol_volatile vd[0]; /* volatile data */
78
+ struct snd_kcontrol_volatile vd[]; /* volatile data */
8479 };
8580
8681 #define snd_kcontrol(n) list_entry(n, struct snd_kcontrol, list)
....@@ -193,20 +188,21 @@
193188 */
194189 struct snd_kcontrol *snd_ctl_make_virtual_master(char *name,
195190 const unsigned int *tlv);
196
-int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave,
197
- unsigned int flags);
198
-/* optional flags for slave */
199
-#define SND_CTL_SLAVE_NEED_UPDATE (1 << 0)
191
+int _snd_ctl_add_follower(struct snd_kcontrol *master,
192
+ struct snd_kcontrol *follower,
193
+ unsigned int flags);
194
+/* optional flags for follower */
195
+#define SND_CTL_FOLLOWER_NEED_UPDATE (1 << 0)
200196
201197 /**
202
- * snd_ctl_add_slave - Add a virtual slave control
198
+ * snd_ctl_add_follower - Add a virtual follower control
203199 * @master: vmaster element
204
- * @slave: slave element to add
200
+ * @follower: follower element to add
205201 *
206
- * Add a virtual slave control to the given master element created via
202
+ * Add a virtual follower control to the given master element created via
207203 * snd_ctl_create_virtual_master() beforehand.
208204 *
209
- * All slaves must be the same type (returning the same information
205
+ * All followers must be the same type (returning the same information
210206 * via info callback). The function doesn't check it, so it's your
211207 * responsibility.
212208 *
....@@ -218,18 +214,18 @@
218214 * Return: Zero if successful or a negative error code.
219215 */
220216 static inline int
221
-snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave)
217
+snd_ctl_add_follower(struct snd_kcontrol *master, struct snd_kcontrol *follower)
222218 {
223
- return _snd_ctl_add_slave(master, slave, 0);
219
+ return _snd_ctl_add_follower(master, follower, 0);
224220 }
225221
226222 /**
227
- * snd_ctl_add_slave_uncached - Add a virtual slave control
223
+ * snd_ctl_add_follower_uncached - Add a virtual follower control
228224 * @master: vmaster element
229
- * @slave: slave element to add
225
+ * @follower: follower element to add
230226 *
231
- * Add a virtual slave control to the given master.
232
- * Unlike snd_ctl_add_slave(), the element added via this function
227
+ * Add a virtual follower control to the given master.
228
+ * Unlike snd_ctl_add_follower(), the element added via this function
233229 * is supposed to have volatile values, and get callback is called
234230 * at each time queried from the master.
235231 *
....@@ -240,10 +236,10 @@
240236 * Return: Zero if successful or a negative error code.
241237 */
242238 static inline int
243
-snd_ctl_add_slave_uncached(struct snd_kcontrol *master,
244
- struct snd_kcontrol *slave)
239
+snd_ctl_add_follower_uncached(struct snd_kcontrol *master,
240
+ struct snd_kcontrol *follower)
245241 {
246
- return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE);
242
+ return _snd_ctl_add_follower(master, follower, SND_CTL_FOLLOWER_NEED_UPDATE);
247243 }
248244
249245 int snd_ctl_add_vmaster_hook(struct snd_kcontrol *kctl,
....@@ -251,11 +247,11 @@
251247 void *private_data);
252248 void snd_ctl_sync_vmaster(struct snd_kcontrol *kctl, bool hook_only);
253249 #define snd_ctl_sync_vmaster_hook(kctl) snd_ctl_sync_vmaster(kctl, true)
254
-int snd_ctl_apply_vmaster_slaves(struct snd_kcontrol *kctl,
255
- int (*func)(struct snd_kcontrol *vslave,
256
- struct snd_kcontrol *slave,
257
- void *arg),
258
- void *arg);
250
+int snd_ctl_apply_vmaster_followers(struct snd_kcontrol *kctl,
251
+ int (*func)(struct snd_kcontrol *vfollower,
252
+ struct snd_kcontrol *follower,
253
+ void *arg),
254
+ void *arg);
259255
260256 /*
261257 * Helper functions for jack-detection controls