Skip to content

Commit

Permalink
sound/oss: convert to unlocked_ioctl
Browse files Browse the repository at this point in the history
These are the final conversions for the ioctl file operation so we can remove
it in the next merge window.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Arnd Bergmann authored and Takashi Iwai committed Jul 12, 2010
1 parent 90dc763 commit d209974
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 51 deletions.
54 changes: 34 additions & 20 deletions sound/oss/au1550_ac97.c
Original file line number Diff line number Diff line change
Expand Up @@ -827,22 +827,26 @@ mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd,
return codec->mixer_ioctl(codec, cmd, arg);
}

static int
au1550_ioctl_mixdev(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
static long
au1550_ioctl_mixdev(struct file *file, unsigned int cmd, unsigned long arg)
{
struct au1550_state *s = (struct au1550_state *)file->private_data;
struct ac97_codec *codec = s->codec;
int ret;

lock_kernel();
ret = mixdev_ioctl(codec, cmd, arg);
unlock_kernel();

return mixdev_ioctl(codec, cmd, arg);
return ret;
}

static /*const */ struct file_operations au1550_mixer_fops = {
owner:THIS_MODULE,
llseek:au1550_llseek,
ioctl:au1550_ioctl_mixdev,
open:au1550_open_mixdev,
release:au1550_release_mixdev,
.owner = THIS_MODULE,
.llseek = au1550_llseek,
.unlocked_ioctl = au1550_ioctl_mixdev,
.open = au1550_open_mixdev,
.release = au1550_release_mixdev,
};

static int
Expand Down Expand Up @@ -1346,8 +1350,7 @@ dma_count_done(struct dmabuf *db)


static int
au1550_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
au1550_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct au1550_state *s = (struct au1550_state *)file->private_data;
unsigned long flags;
Expand Down Expand Up @@ -1783,6 +1786,17 @@ au1550_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
return mixdev_ioctl(s->codec, cmd, arg);
}

static long
au1550_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
int ret;

lock_kernel();
ret = au1550_ioctl(file, cmd, arg);
unlock_kernel();

return ret;
}

static int
au1550_open(struct inode *inode, struct file *file)
Expand Down Expand Up @@ -1893,15 +1907,15 @@ au1550_release(struct inode *inode, struct file *file)
}

static /*const */ struct file_operations au1550_audio_fops = {
owner: THIS_MODULE,
llseek: au1550_llseek,
read: au1550_read,
write: au1550_write,
poll: au1550_poll,
ioctl: au1550_ioctl,
mmap: au1550_mmap,
open: au1550_open,
release: au1550_release,
.owner = THIS_MODULE,
.llseek = au1550_llseek,
.read = au1550_read,
.write = au1550_write,
.poll = au1550_poll,
.unlocked_ioctl = au1550_unlocked_ioctl,
.mmap = au1550_mmap,
.open = au1550_open,
.release = au1550_release,
};

MODULE_AUTHOR("Advanced Micro Devices (AMD), dan@embeddededge.com");
Expand Down
35 changes: 28 additions & 7 deletions sound/oss/dmasound/dmasound_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ static int mixer_release(struct inode *inode, struct file *file)
unlock_kernel();
return 0;
}
static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd,
u_long arg)

static int mixer_ioctl(struct file *file, u_int cmd, u_long arg)
{
if (_SIOC_DIR(cmd) & _SIOC_WRITE)
mixer.modify_counter++;
Expand All @@ -366,11 +366,22 @@ static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd,
return -EINVAL;
}

static long mixer_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
{
int ret;

lock_kernel();
ret = mixer_ioctl(file, cmd, arg);
unlock_kernel();

return ret;
}

static const struct file_operations mixer_fops =
{
.owner = THIS_MODULE,
.llseek = no_llseek,
.ioctl = mixer_ioctl,
.unlocked_ioctl = mixer_unlocked_ioctl,
.open = mixer_open,
.release = mixer_release,
};
Expand Down Expand Up @@ -963,8 +974,7 @@ printk("dmasound_core: tried to set_queue_frags on a locked queue\n") ;
return 0 ;
}

static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
u_long arg)
static int sq_ioctl(struct file *file, u_int cmd, u_long arg)
{
int val, result;
u_long fmt;
Expand Down Expand Up @@ -1122,18 +1132,29 @@ static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
return IOCTL_OUT(arg,val);

default:
return mixer_ioctl(inode, file, cmd, arg);
return mixer_ioctl(file, cmd, arg);
}
return -EINVAL;
}

static long sq_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
{
int ret;

lock_kernel();
ret = sq_ioctl(file, cmd, arg);
unlock_kernel();

return ret;
}

static const struct file_operations sq_fops =
{
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = sq_write,
.poll = sq_poll,
.ioctl = sq_ioctl,
.unlocked_ioctl = sq_unlocked_ioctl,
.open = sq_open,
.release = sq_release,
};
Expand Down
15 changes: 10 additions & 5 deletions sound/oss/msnd_pinnacle.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,21 +639,26 @@ static int mixer_ioctl(unsigned int cmd, unsigned long arg)
return -EINVAL;
}

static int dev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
static long dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
int minor = iminor(inode);
int ret;

if (cmd == OSS_GETVERSION) {
int sound_version = SOUND_VERSION;
return put_user(sound_version, (int __user *)arg);
}

ret = -EINVAL;

lock_kernel();
if (minor == dev.dsp_minor)
return dsp_ioctl(file, cmd, arg);
ret = dsp_ioctl(file, cmd, arg);
else if (minor == dev.mixer_minor)
return mixer_ioctl(cmd, arg);
ret = mixer_ioctl(cmd, arg);
unlock_kernel();

return -EINVAL;
return ret;
}

static void dsp_write_flush(void)
Expand Down Expand Up @@ -1109,7 +1114,7 @@ static const struct file_operations dev_fileops = {
.owner = THIS_MODULE,
.read = dev_read,
.write = dev_write,
.ioctl = dev_ioctl,
.unlocked_ioctl = dev_ioctl,
.open = dev_open,
.release = dev_release,
};
Expand Down
18 changes: 15 additions & 3 deletions sound/oss/sh_dac_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/linkage.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/smp_lock.h>
#include <linux/sound.h>
#include <linux/smp_lock.h>
#include <linux/soundcard.h>
Expand Down Expand Up @@ -93,7 +94,7 @@ static void dac_audio_set_rate(void)
wakeups_per_second = ktime_set(0, 1000000000 / rate);
}

static int dac_audio_ioctl(struct inode *inode, struct file *file,
static int dac_audio_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
int val;
Expand Down Expand Up @@ -159,6 +160,17 @@ static int dac_audio_ioctl(struct inode *inode, struct file *file,
return -EINVAL;
}

static long dac_audio_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
{
int ret;

lock_kernel();
ret = dac_audio_ioctl(file, cmd, arg);
unlock_kernel();

return ret;
}

static ssize_t dac_audio_write(struct file *file, const char *buf, size_t count,
loff_t * ppos)
{
Expand Down Expand Up @@ -242,8 +254,8 @@ static int dac_audio_release(struct inode *inode, struct file *file)

const struct file_operations dac_audio_fops = {
.read = dac_audio_read,
.write = dac_audio_write,
.ioctl = dac_audio_ioctl,
.write = dac_audio_write,
.unlocked_ioctl = dac_audio_unlocked_ioctl,
.open = dac_audio_open,
.release = dac_audio_release,
};
Expand Down
24 changes: 19 additions & 5 deletions sound/oss/swarm_cs4297a.c
Original file line number Diff line number Diff line change
Expand Up @@ -1571,11 +1571,15 @@ static int cs4297a_release_mixdev(struct inode *inode, struct file *file)
}


static int cs4297a_ioctl_mixdev(struct inode *inode, struct file *file,
static int cs4297a_ioctl_mixdev(struct file *file,
unsigned int cmd, unsigned long arg)
{
return mixer_ioctl((struct cs4297a_state *) file->private_data, cmd,
int ret;
lock_kernel();
ret = mixer_ioctl((struct cs4297a_state *) file->private_data, cmd,
arg);
unlock_kernel();
return ret;
}


Expand All @@ -1585,7 +1589,7 @@ static int cs4297a_ioctl_mixdev(struct inode *inode, struct file *file,
static const struct file_operations cs4297a_mixer_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.ioctl = cs4297a_ioctl_mixdev,
.unlocked_ioctl = cs4297a_ioctl_mixdev,
.open = cs4297a_open_mixdev,
.release = cs4297a_release_mixdev,
};
Expand Down Expand Up @@ -1949,7 +1953,7 @@ static int cs4297a_mmap(struct file *file, struct vm_area_struct *vma)
}


static int cs4297a_ioctl(struct inode *inode, struct file *file,
static int cs4297a_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
struct cs4297a_state *s =
Expand Down Expand Up @@ -2342,6 +2346,16 @@ static int cs4297a_ioctl(struct inode *inode, struct file *file,
return mixer_ioctl(s, cmd, arg);
}

static long cs4297a_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
{
int ret;

lock_kernel();
ret = cs4297a_ioctl(file, cmd, arg);
unlock_kernel();

return ret;
}

static int cs4297a_release(struct inode *inode, struct file *file)
{
Expand Down Expand Up @@ -2511,7 +2525,7 @@ static const struct file_operations cs4297a_audio_fops = {
.read = cs4297a_read,
.write = cs4297a_write,
.poll = cs4297a_poll,
.ioctl = cs4297a_ioctl,
.unlocked_ioctl = cs4297a_unlocked_ioctl,
.mmap = cs4297a_mmap,
.open = cs4297a_open,
.release = cs4297a_release,
Expand Down
Loading

0 comments on commit d209974

Please sign in to comment.