static int via_init_one (struct pci_dev *dev, const struct pci_device_id *id);
static void __devexit via_remove_one (struct pci_dev *pdev);
-static ssize_t via_dsp_read(struct file *file, char *buffer, size_t count, loff_t *ppos);
-static ssize_t via_dsp_write(struct file *file, const char *buffer, size_t count, loff_t *ppos);
+static ssize_t via_dsp_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos);
+static ssize_t via_dsp_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos);
static unsigned int via_dsp_poll(struct file *file, struct poll_table_struct *wait);
static int via_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
static int via_dsp_open (struct inode *inode, struct file *file);
static ssize_t via_dsp_do_read (struct via_info *card,
- char *userbuf, size_t count,
+ char __user *userbuf, size_t count,
int nonblock)
{
DECLARE_WAITQUEUE(wait, current);
- const char *orig_userbuf = userbuf;
+ const char __user *orig_userbuf = userbuf;
struct via_channel *chan = &card->ch_in;
size_t size;
int n, tmp;
}
-static ssize_t via_dsp_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t via_dsp_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
{
struct via_info *card;
int nonblock = (file->f_flags & O_NONBLOCK);
static ssize_t via_dsp_do_write (struct via_info *card,
- const char *userbuf, size_t count,
+ const char __user *userbuf, size_t count,
int nonblock)
{
DECLARE_WAITQUEUE(wait, current);
- const char *orig_userbuf = userbuf;
+ const char __user *orig_userbuf = userbuf;
struct via_channel *chan = &card->ch_out;
volatile struct via_sgd_table *sgtable = chan->sgtable;
size_t size;
}
-static ssize_t via_dsp_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t via_dsp_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
{
struct via_info *card;
ssize_t rc;
static int via_dsp_ioctl_space (struct via_info *card,
struct via_channel *chan,
- void *arg)
+ void __user *arg)
{
audio_buf_info info;
static int via_dsp_ioctl_ptr (struct via_info *card,
struct via_channel *chan,
- void *arg)
+ void __user *arg)
{
count_info info;
struct via_info *card;
struct via_channel *chan;
int nonblock = (file->f_flags & O_NONBLOCK);
+ int __user *ip = (int __user *)arg;
+ void __user *p = (void __user *)arg;
assert (file != NULL);
card = file->private_data;
/* OSS API version. XXX unverified */
case OSS_GETVERSION:
DPRINTK ("ioctl OSS_GETVERSION, EXIT, returning SOUND_VERSION\n");
- rc = put_user (SOUND_VERSION, (int *)arg);
+ rc = put_user (SOUND_VERSION, ip);
break;
/* list of supported PCM data formats */
case SNDCTL_DSP_GETFMTS:
DPRINTK ("DSP_GETFMTS, EXIT, returning AFMT U8|S16_LE\n");
- rc = put_user (AFMT_U8 | AFMT_S16_LE, (int *)arg);
+ rc = put_user (AFMT_U8 | AFMT_S16_LE, ip);
break;
/* query or set current channel's PCM data format */
case SNDCTL_DSP_SETFMT:
- if (get_user(val, (int *)arg)) {
+ if (get_user(val, ip)) {
rc = -EFAULT;
break;
}
val = AFMT_U8;
}
DPRINTK ("SETFMT EXIT, returning %d\n", val);
- rc = put_user (val, (int *)arg);
+ rc = put_user (val, ip);
break;
/* query or set number of channels (1=mono, 2=stereo, 4/6 for multichannel) */
case SNDCTL_DSP_CHANNELS:
- if (get_user(val, (int *)arg)) {
+ if (get_user(val, ip)) {
rc = -EFAULT;
break;
}
val = card->ch_out.channels;
}
DPRINTK ("CHANNELS EXIT, returning %d\n", val);
- rc = put_user (val, (int *)arg);
+ rc = put_user (val, ip);
break;
/* enable (val is not zero) or disable (val == 0) stereo */
case SNDCTL_DSP_STEREO:
- if (get_user(val, (int *)arg)) {
+ if (get_user(val, ip)) {
rc = -EFAULT;
break;
}
val = rc - 1;
DPRINTK ("STEREO EXIT, returning %d\n", val);
- rc = put_user(val, (int *) arg);
+ rc = put_user(val, ip);
break;
/* query or set sampling rate */
case SNDCTL_DSP_SPEED:
- if (get_user(val, (int *)arg)) {
+ if (get_user(val, ip)) {
rc = -EFAULT;
break;
}
val = 0;
}
DPRINTK ("SPEED EXIT, returning %d\n", val);
- rc = put_user (val, (int *)arg);
+ rc = put_user (val, ip);
break;
/* wait until all buffers have been played, and then stop device */
/* obtain bitmask of device capabilities, such as mmap, full duplex, etc. */
case SNDCTL_DSP_GETCAPS:
DPRINTK ("DSP_GETCAPS\n");
- rc = put_user(VIA_DSP_CAP, (int *)arg);
+ rc = put_user(VIA_DSP_CAP, ip);
break;
/* obtain buffer fragment size */
if (rd) {
via_chan_set_buffering(card, &card->ch_in, -1);
- rc = put_user(card->ch_in.frag_size, (int *)arg);
+ rc = put_user(card->ch_in.frag_size, ip);
} else if (wr) {
via_chan_set_buffering(card, &card->ch_out, -1);
- rc = put_user(card->ch_out.frag_size, (int *)arg);
+ rc = put_user(card->ch_out.frag_size, ip);
}
break;
case SNDCTL_DSP_GETISPACE:
DPRINTK ("DSP_GETISPACE\n");
if (rd)
- rc = via_dsp_ioctl_space (card, &card->ch_in, (void*) arg);
+ rc = via_dsp_ioctl_space (card, &card->ch_in, p);
break;
/* obtain information about output buffering */
case SNDCTL_DSP_GETOSPACE:
DPRINTK ("DSP_GETOSPACE\n");
if (wr)
- rc = via_dsp_ioctl_space (card, &card->ch_out, (void*) arg);
+ rc = via_dsp_ioctl_space (card, &card->ch_out, p);
break;
/* obtain information about input hardware pointer */
case SNDCTL_DSP_GETIPTR:
DPRINTK ("DSP_GETIPTR\n");
if (rd)
- rc = via_dsp_ioctl_ptr (card, &card->ch_in, (void*) arg);
+ rc = via_dsp_ioctl_ptr (card, &card->ch_in, p);
break;
/* obtain information about output hardware pointer */
case SNDCTL_DSP_GETOPTR:
DPRINTK ("DSP_GETOPTR\n");
if (wr)
- rc = via_dsp_ioctl_ptr (card, &card->ch_out, (void*) arg);
+ rc = via_dsp_ioctl_ptr (card, &card->ch_out, p);
break;
/* return number of bytes remaining to be played by DMA engine */
assert (val <= (chan->frag_size * chan->frag_number));
DPRINTK ("GETODELAY EXIT, val = %d bytes\n", val);
- rc = put_user (val, (int *)arg);
+ rc = put_user (val, ip);
break;
}
* occur in the future
*/
case SNDCTL_DSP_SETTRIGGER:
- if (get_user(val, (int *)arg)) {
+ if (get_user(val, ip)) {
rc = -EFAULT;
break;
}
val |= PCM_ENABLE_INPUT;
if ((file->f_mode & FMODE_WRITE) && card->ch_out.is_enabled)
val |= PCM_ENABLE_OUTPUT;
- rc = put_user(val, (int *)arg);
+ rc = put_user(val, ip);
break;
/* Enable full duplex. Since we do this as soon as we are opened
/* set fragment size. implemented as a successful no-op for now */
case SNDCTL_DSP_SETFRAGMENT:
- if (get_user(val, (int *)arg)) {
+ if (get_user(val, ip)) {
rc = -EFAULT;
break;
}
/* not implemented */
default:
DPRINTK ("unhandled ioctl, cmd==%u, arg==%p\n",
- cmd, (void*) arg);
+ cmd, p);
break;
}