skypopen: OSS driver now compiles on newer kernels (no more .ioctl)

This commit is contained in:
Giovanni Maruzzelli 2011-08-15 05:37:31 -05:00
parent 38cfa1ff31
commit 4ffa20d1a4
1 changed files with 26 additions and 0 deletions

View File

@ -283,6 +283,7 @@ static ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t
* The ioctl() implementation
*/
#ifndef HAVE_UNLOCKED_IOCTL
static int skypopen_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
@ -302,13 +303,38 @@ static int skypopen_ioctl(struct inode *inode, struct file *filp,
}
}
#else// HAVE_UNLOCKED_IOCTL
static long skypopen_unlocked_ioctl(struct file *filp,
unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
switch (cmd) {
case OSS_GETVERSION:
return put_user(SOUND_VERSION, p);
case SNDCTL_DSP_GETBLKSIZE:
return put_user(SKYPOPEN_BLK, p);
case SNDCTL_DSP_GETFMTS:
return put_user(28731, p);
default:
return 0;
}
}
#endif// HAVE_UNLOCKED_IOCTL
struct file_operations skypopen_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = skypopen_read,
.write = skypopen_write,
#ifndef HAVE_UNLOCKED_IOCTL
.ioctl = skypopen_ioctl,
#else// HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = skypopen_unlocked_ioctl,
#endif// HAVE_UNLOCKED_IOCTL
.open = skypopen_c_open,
.release = skypopen_c_release,
};