aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-02-19 08:30:29 -0500
committerTakashi Iwai <tiwai@suse.de>2015-02-02 08:21:21 -0500
commit23c18d4bfd73ee24070849faf98b3ab01263a3c4 (patch)
tree944e0e24bd847fdbbddd8baf5ab0976c0fdcfa81 /include/sound
parent92b7952da8279189aad352efbf9f2e7001de9524 (diff)
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 {
93 93
94struct pid; 94struct pid;
95 95
96enum {
97 SND_CTL_SUBDEV_PCM,
98 SND_CTL_SUBDEV_RAWMIDI,
99 SND_CTL_SUBDEV_ITEMS,
100};
101
96struct snd_ctl_file { 102struct snd_ctl_file {
97 struct list_head list; /* list of all control files */ 103 struct list_head list; /* list of all control files */
98 struct snd_card *card; 104 struct snd_card *card;
99 struct pid *pid; 105 struct pid *pid;
100 int prefer_pcm_subdevice; 106 int preferred_subdevice[SND_CTL_SUBDEV_ITEMS];
101 int prefer_rawmidi_subdevice;
102 wait_queue_head_t change_sleep; 107 wait_queue_head_t change_sleep;
103 spinlock_t read_lock; 108 spinlock_t read_lock;
104 struct fasync_struct *fasync; 109 struct fasync_struct *fasync;
@@ -138,6 +143,8 @@ int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn);
138#define snd_ctl_unregister_ioctl_compat(fcn) 143#define snd_ctl_unregister_ioctl_compat(fcn)
139#endif 144#endif
140 145
146int snd_ctl_get_preferred_subdevice(struct snd_card *card, int type);
147
141static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id) 148static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
142{ 149{
143 return id->numid - kctl->id.numid; 150 return id->numid - kctl->id.numid;