summaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-02-19 14:30:29 +0100
committerTakashi Iwai <tiwai@suse.de>2015-02-02 14:21:21 +0100
commit23c18d4bfd73ee24070849faf98b3ab01263a3c4 (patch)
tree944e0e24bd847fdbbddd8baf5ab0976c0fdcfa81 /include/sound
parent92b7952da8279189aad352efbf9f2e7001de9524 (diff)
downloadlinux-23c18d4bfd73ee24070849faf98b3ab01263a3c4.tar.bz2
ALSA: control: Provide a helper to look for the preferred subdevice
Instead of open-coding the search over the control file loop, provide a helper function for the preferred subdevice assigned to the current process. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/control.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/sound/control.h b/include/sound/control.h
index 042613938a1d..75f3054023f7 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -93,12 +93,17 @@ struct snd_kctl_event {
struct pid;
+enum {
+ SND_CTL_SUBDEV_PCM,
+ SND_CTL_SUBDEV_RAWMIDI,
+ SND_CTL_SUBDEV_ITEMS,
+};
+
struct snd_ctl_file {
struct list_head list; /* list of all control files */
struct snd_card *card;
struct pid *pid;
- int prefer_pcm_subdevice;
- int prefer_rawmidi_subdevice;
+ int preferred_subdevice[SND_CTL_SUBDEV_ITEMS];
wait_queue_head_t change_sleep;
spinlock_t read_lock;
struct fasync_struct *fasync;
@@ -138,6 +143,8 @@ int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn);
#define snd_ctl_unregister_ioctl_compat(fcn)
#endif
+int snd_ctl_get_preferred_subdevice(struct snd_card *card, int type);
+
static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
{
return id->numid - kctl->id.numid;