Commit 8360da64 authored by Jaroslav Kysela's avatar Jaroslav Kysela

[ALSA] unlocked/compat_ioctl rewrite for OSS compatible drivers

ALSA<-OSS emulation,ALSA<-OSS sequencer
The ioctl handlers for OSS compatible drivers are rewritten using
unlocked/compat_ioctl.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 90efff42
...@@ -359,16 +359,9 @@ static int snd_mixer_oss_ioctl1(snd_mixer_oss_file_t *fmixer, unsigned int cmd, ...@@ -359,16 +359,9 @@ static int snd_mixer_oss_ioctl1(snd_mixer_oss_file_t *fmixer, unsigned int cmd,
return -ENXIO; return -ENXIO;
} }
/* FIXME: need to unlock BKL to allow preemption */ static long snd_mixer_oss_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
static int snd_mixer_oss_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{ {
int err; return snd_mixer_oss_ioctl1((snd_mixer_oss_file_t *) file->private_data, cmd, arg);
/* FIXME: need to unlock BKL to allow preemption */
unlock_kernel();
err = snd_mixer_oss_ioctl1((snd_mixer_oss_file_t *) file->private_data, cmd, arg);
lock_kernel();
return err;
} }
int snd_mixer_oss_ioctl_card(snd_card_t *card, unsigned int cmd, unsigned long arg) int snd_mixer_oss_ioctl_card(snd_card_t *card, unsigned int cmd, unsigned long arg)
...@@ -384,6 +377,13 @@ int snd_mixer_oss_ioctl_card(snd_card_t *card, unsigned int cmd, unsigned long a ...@@ -384,6 +377,13 @@ int snd_mixer_oss_ioctl_card(snd_card_t *card, unsigned int cmd, unsigned long a
return snd_mixer_oss_ioctl1(&fmixer, cmd, arg); return snd_mixer_oss_ioctl1(&fmixer, cmd, arg);
} }
#ifdef CONFIG_COMPAT
/* all compatible */
#define snd_mixer_oss_ioctl_compat snd_mixer_oss_ioctl
#else
#define snd_mixer_oss_ioctl_compat NULL
#endif
/* /*
* REGISTRATION PART * REGISTRATION PART
*/ */
...@@ -393,7 +393,8 @@ static struct file_operations snd_mixer_oss_f_ops = ...@@ -393,7 +393,8 @@ static struct file_operations snd_mixer_oss_f_ops =
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = snd_mixer_oss_open, .open = snd_mixer_oss_open,
.release = snd_mixer_oss_release, .release = snd_mixer_oss_release,
.ioctl = snd_mixer_oss_ioctl, .unlocked_ioctl = snd_mixer_oss_ioctl,
.compat_ioctl = snd_mixer_oss_ioctl_compat,
}; };
static snd_minor_t snd_mixer_oss_reg = static snd_minor_t snd_mixer_oss_reg =
......
...@@ -1913,8 +1913,7 @@ static int snd_pcm_oss_release(struct inode *inode, struct file *file) ...@@ -1913,8 +1913,7 @@ static int snd_pcm_oss_release(struct inode *inode, struct file *file)
return 0; return 0;
} }
static inline int _snd_pcm_oss_ioctl(struct inode *inode, struct file *file, static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
snd_pcm_oss_file_t *pcm_oss_file; snd_pcm_oss_file_t *pcm_oss_file;
int __user *p = (int __user *)arg; int __user *p = (int __user *)arg;
...@@ -2073,16 +2072,12 @@ static inline int _snd_pcm_oss_ioctl(struct inode *inode, struct file *file, ...@@ -2073,16 +2072,12 @@ static inline int _snd_pcm_oss_ioctl(struct inode *inode, struct file *file,
return -EINVAL; return -EINVAL;
} }
/* FIXME: need to unlock BKL to allow preemption */ #ifdef CONFIG_COMPAT
static int snd_pcm_oss_ioctl(struct inode *inode, struct file *file, /* all compatible */
unsigned int cmd, unsigned long arg) #define snd_pcm_oss_ioctl_compat snd_pcm_oss_ioctl
{ #else
int err; #define snd_pcm_oss_ioctl_compat NULL
unlock_kernel(); #endif
err = _snd_pcm_oss_ioctl(inode, file, cmd, arg);
lock_kernel();
return err;
}
static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t count, loff_t *offset) static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{ {
...@@ -2410,7 +2405,8 @@ static struct file_operations snd_pcm_oss_f_reg = ...@@ -2410,7 +2405,8 @@ static struct file_operations snd_pcm_oss_f_reg =
.open = snd_pcm_oss_open, .open = snd_pcm_oss_open,
.release = snd_pcm_oss_release, .release = snd_pcm_oss_release,
.poll = snd_pcm_oss_poll, .poll = snd_pcm_oss_poll,
.ioctl = snd_pcm_oss_ioctl, .unlocked_ioctl = snd_pcm_oss_ioctl,
.compat_ioctl = snd_pcm_oss_ioctl_compat,
.mmap = snd_pcm_oss_mmap, .mmap = snd_pcm_oss_mmap,
}; };
......
...@@ -59,7 +59,7 @@ static int odev_open(struct inode *inode, struct file *file); ...@@ -59,7 +59,7 @@ static int odev_open(struct inode *inode, struct file *file);
static int odev_release(struct inode *inode, struct file *file); static int odev_release(struct inode *inode, struct file *file);
static ssize_t odev_read(struct file *file, char __user *buf, size_t count, loff_t *offset); static ssize_t odev_read(struct file *file, char __user *buf, size_t count, loff_t *offset);
static ssize_t odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offset); static ssize_t odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offset);
static int odev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); static long odev_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
static unsigned int odev_poll(struct file *file, poll_table * wait); static unsigned int odev_poll(struct file *file, poll_table * wait);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static void info_read(snd_info_entry_t *entry, snd_info_buffer_t *buf); static void info_read(snd_info_entry_t *entry, snd_info_buffer_t *buf);
...@@ -177,20 +177,20 @@ odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offs ...@@ -177,20 +177,20 @@ odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offs
return snd_seq_oss_write(dp, buf, count, file); return snd_seq_oss_write(dp, buf, count, file);
} }
static int static long
odev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) odev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
seq_oss_devinfo_t *dp; seq_oss_devinfo_t *dp;
int err;
dp = file->private_data; dp = file->private_data;
snd_assert(dp != NULL, return -EIO); snd_assert(dp != NULL, return -EIO);
/* FIXME: need to unlock BKL to allow preemption */ return snd_seq_oss_ioctl(dp, cmd, arg);
unlock_kernel();
err = snd_seq_oss_ioctl(dp, cmd, arg);
lock_kernel();
return err;
} }
#ifdef CONFIG_COMPAT
#define odev_ioctl_compat odev_ioctl
#else
#define odev_ioctl_compat NULL
#endif
static unsigned int static unsigned int
odev_poll(struct file *file, poll_table * wait) odev_poll(struct file *file, poll_table * wait)
...@@ -213,7 +213,8 @@ static struct file_operations seq_oss_f_ops = ...@@ -213,7 +213,8 @@ static struct file_operations seq_oss_f_ops =
.open = odev_open, .open = odev_open,
.release = odev_release, .release = odev_release,
.poll = odev_poll, .poll = odev_poll,
.ioctl = odev_ioctl, .unlocked_ioctl = odev_ioctl,
.compat_ioctl = odev_ioctl_compat,
}; };
static snd_minor_t seq_oss_reg = { static snd_minor_t seq_oss_reg = {
......
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