Commit fc1cee5f authored by Jaroslav Kysela's avatar Jaroslav Kysela

[ALSA] Export snd_ctl_elem_read/write() functions

Control Midlevel,ALSA Core,IOCTL32 emulation
snd_ctl_elem_read() and snd_ctl_elem_write() functions are exported
to be accessible from other kernel modules.  They can be used for
suspend/resume codes, for example.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 74e89507
......@@ -122,9 +122,8 @@ int snd_ctl_unregister(snd_card_t *card);
int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn);
int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn);
/* for ioctl32 */
int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *control);
int snd_ctl_elem_write(snd_ctl_file_t *file, snd_ctl_elem_value_t *control);
int snd_ctl_elem_write(snd_card_t *card, snd_ctl_file_t *file, snd_ctl_elem_value_t *control);
static inline unsigned int snd_ctl_get_ioffnum(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id)
{
......
......@@ -685,9 +685,8 @@ static int snd_ctl_elem_read_user(snd_card_t *card, snd_ctl_elem_value_t __user
return result;
}
int snd_ctl_elem_write(snd_ctl_file_t *file, snd_ctl_elem_value_t *control)
int snd_ctl_elem_write(snd_card_t *card, snd_ctl_file_t *file, snd_ctl_elem_value_t *control)
{
snd_card_t *card = file->card;
snd_kcontrol_t *kctl;
snd_kcontrol_volatile_t *vd;
unsigned int index_offset;
......@@ -706,7 +705,7 @@ int snd_ctl_elem_write(snd_ctl_file_t *file, snd_ctl_elem_value_t *control)
} else {
if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_WRITE) ||
kctl->put == NULL ||
(vd->owner != NULL && vd->owner != file)) {
(file && vd->owner != NULL && vd->owner != file)) {
result = -EPERM;
} else {
snd_ctl_build_ioff(&control->id, kctl, index_offset);
......@@ -735,7 +734,7 @@ static int snd_ctl_elem_write_user(snd_ctl_file_t *file, snd_ctl_elem_value_t __
kfree(control);
return -EFAULT;
}
result = snd_ctl_elem_write(file, control);
result = snd_ctl_elem_write(file->card, file, control);
if (result >= 0)
if (copy_to_user(_control, control, sizeof(*control)))
result = -EFAULT;
......
......@@ -357,7 +357,7 @@ static inline int _snd_ioctl32_ctl_elem_value(unsigned int fd, unsigned int cmd,
if (native_ctl == SNDRV_CTL_IOCTL_ELEM_READ)
err = snd_ctl_elem_read(ctl->card, data);
else
err = snd_ctl_elem_write(ctl, data);
err = snd_ctl_elem_write(ctl->card, ctl, data);
if (err < 0)
goto __end;
/* restore info to 32bit */
......
......@@ -473,10 +473,8 @@ EXPORT_SYMBOL(snd_ctl_find_id);
EXPORT_SYMBOL(snd_ctl_notify);
EXPORT_SYMBOL(snd_ctl_register_ioctl);
EXPORT_SYMBOL(snd_ctl_unregister_ioctl);
#ifdef CONFIG_COMPAT
EXPORT_SYMBOL(snd_ctl_elem_read);
EXPORT_SYMBOL(snd_ctl_elem_write);
#endif
/* misc.c */
EXPORT_SYMBOL(snd_task_name);
#ifdef CONFIG_SND_VERBOSE_PRINTK
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment