static int snd_pcm_lib_write_transfer(snd_pcm_substream_t *substream,
unsigned int hwoff,
- void *data, unsigned int off,
+ unsigned long data, unsigned int off,
snd_pcm_uframes_t frames)
{
snd_pcm_runtime_t *runtime = substream->runtime;
int err;
- char *buf = (char *) data + frames_to_bytes(runtime, off);
+ char __user *buf = (char __user *) data + frames_to_bytes(runtime, off);
if (substream->ops->copy) {
if ((err = substream->ops->copy(substream, -1, hwoff, buf, frames)) < 0)
return err;
}
typedef int (*transfer_f)(snd_pcm_substream_t *substream, unsigned int hwoff,
- void *data, unsigned int off, snd_pcm_uframes_t size);
+ unsigned long data, unsigned int off,
+ snd_pcm_uframes_t size);
static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream,
- const void *data, snd_pcm_uframes_t size,
+ unsigned long data,
+ snd_pcm_uframes_t size,
int nonblock,
transfer_f transfer)
{
appl_ptr = runtime->control->appl_ptr;
appl_ofs = appl_ptr % runtime->buffer_size;
snd_pcm_stream_unlock_irq(substream);
- if ((err = transfer(substream, appl_ofs, (void *)data, offset, frames)) < 0)
+ if ((err = transfer(substream, appl_ofs, data, offset, frames)) < 0)
goto _end;
snd_pcm_stream_lock_irq(substream);
switch (runtime->status->state) {
return xfer > 0 ? (snd_pcm_sframes_t)xfer : err;
}
-snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void *buf, snd_pcm_uframes_t size)
+snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void __user *buf, snd_pcm_uframes_t size)
{
snd_pcm_runtime_t *runtime;
int nonblock;
if (runtime->access != SNDRV_PCM_ACCESS_RW_INTERLEAVED &&
runtime->channels > 1)
return -EINVAL;
- return snd_pcm_lib_write1(substream, buf, size, nonblock,
+ return snd_pcm_lib_write1(substream, (unsigned long)buf, size, nonblock,
snd_pcm_lib_write_transfer);
}
static int snd_pcm_lib_writev_transfer(snd_pcm_substream_t *substream,
unsigned int hwoff,
- void *data, unsigned int off,
+ unsigned long data, unsigned int off,
snd_pcm_uframes_t frames)
{
snd_pcm_runtime_t *runtime = substream->runtime;
int err;
- void **bufs = data;
+ void __user **bufs = (void __user **)data;
int channels = runtime->channels;
int c;
if (substream->ops->copy) {
if ((err = substream->ops->silence(substream, c, hwoff, frames)) < 0)
return err;
} else {
- char *buf = *bufs + samples_to_bytes(runtime, off);
+ char __user *buf = *bufs + samples_to_bytes(runtime, off);
if ((err = substream->ops->copy(substream, c, hwoff, buf, frames)) < 0)
return err;
}
if (*bufs == NULL) {
snd_pcm_format_set_silence(runtime->format, hwbuf, frames);
} else {
- char *buf = *bufs + samples_to_bytes(runtime, off);
+ char __user *buf = *bufs + samples_to_bytes(runtime, off);
if (copy_from_user(hwbuf, buf, samples_to_bytes(runtime, frames)))
return -EFAULT;
}
return 0;
}
-snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, void **bufs,
+snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream,
+ void __user **bufs,
snd_pcm_uframes_t frames)
{
snd_pcm_runtime_t *runtime;
if (runtime->access != SNDRV_PCM_ACCESS_RW_NONINTERLEAVED)
return -EINVAL;
- return snd_pcm_lib_write1(substream, bufs, frames, nonblock,
- snd_pcm_lib_writev_transfer);
+ return snd_pcm_lib_write1(substream, (unsigned long)bufs, frames,
+ nonblock, snd_pcm_lib_writev_transfer);
}
static int snd_pcm_lib_read_transfer(snd_pcm_substream_t *substream,
unsigned int hwoff,
- void *data, unsigned int off,
+ unsigned long data, unsigned int off,
snd_pcm_uframes_t frames)
{
snd_pcm_runtime_t *runtime = substream->runtime;
int err;
- char *buf = (char *) data + frames_to_bytes(runtime, off);
+ char __user *buf = (char __user *) data + frames_to_bytes(runtime, off);
if (substream->ops->copy) {
if ((err = substream->ops->copy(substream, -1, hwoff, buf, frames)) < 0)
return err;
return 0;
}
-static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, void *data, snd_pcm_uframes_t size, int nonblock,
+static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream,
+ unsigned long data,
+ snd_pcm_uframes_t size,
+ int nonblock,
transfer_f transfer)
{
snd_pcm_runtime_t *runtime = substream->runtime;
appl_ptr = runtime->control->appl_ptr;
appl_ofs = appl_ptr % runtime->buffer_size;
snd_pcm_stream_unlock_irq(substream);
- if ((err = transfer(substream, appl_ofs, (void *)data, offset, frames)) < 0)
+ if ((err = transfer(substream, appl_ofs, data, offset, frames)) < 0)
goto _end;
snd_pcm_stream_lock_irq(substream);
switch (runtime->status->state) {
return xfer > 0 ? (snd_pcm_sframes_t)xfer : err;
}
-snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void *buf, snd_pcm_uframes_t size)
+snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void __user *buf, snd_pcm_uframes_t size)
{
snd_pcm_runtime_t *runtime;
int nonblock;
#endif
if (runtime->access != SNDRV_PCM_ACCESS_RW_INTERLEAVED)
return -EINVAL;
- return snd_pcm_lib_read1(substream, buf, size, nonblock, snd_pcm_lib_read_transfer);
+ return snd_pcm_lib_read1(substream, (unsigned long)buf, size, nonblock, snd_pcm_lib_read_transfer);
}
static int snd_pcm_lib_readv_transfer(snd_pcm_substream_t *substream,
unsigned int hwoff,
- void *data, unsigned int off,
+ unsigned long data, unsigned int off,
snd_pcm_uframes_t frames)
{
snd_pcm_runtime_t *runtime = substream->runtime;
int err;
- void **bufs = data;
+ void __user **bufs = (void __user **)data;
int channels = runtime->channels;
int c;
if (substream->ops->copy) {
for (c = 0; c < channels; ++c, ++bufs) {
- char *buf;
+ char __user *buf;
if (*bufs == NULL)
continue;
buf = *bufs + samples_to_bytes(runtime, off);
snd_pcm_uframes_t dma_csize = runtime->dma_bytes / channels;
snd_assert(runtime->dma_area, return -EFAULT);
for (c = 0; c < channels; ++c, ++bufs) {
- char *hwbuf, *buf;
+ char *hwbuf;
+ char __user *buf;
if (*bufs == NULL)
continue;
return 0;
}
-snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, void **bufs,
+snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream,
+ void __user **bufs,
snd_pcm_uframes_t frames)
{
snd_pcm_runtime_t *runtime;
if (runtime->access != SNDRV_PCM_ACCESS_RW_NONINTERLEAVED)
return -EINVAL;
- return snd_pcm_lib_read1(substream, bufs, frames, nonblock, snd_pcm_lib_readv_transfer);
+ return snd_pcm_lib_read1(substream, (unsigned long)bufs, frames, nonblock, snd_pcm_lib_readv_transfer);
}
/*
#define SNDRV_PCM_IOCTL_HW_REFINE_OLD _IOWR('A', 0x10, struct sndrv_pcm_hw_params_old)
#define SNDRV_PCM_IOCTL_HW_PARAMS_OLD _IOWR('A', 0x11, struct sndrv_pcm_hw_params_old)
-static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams);
-static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams);
+static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams);
+static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams);
/*
*
return 0;
}
-int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t * _info)
+int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user * _info)
{
snd_pcm_info_t info;
int err = snd_pcm_info(substream, &info);
return 0;
}
-static int snd_pcm_hw_refine_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * _params)
+static int snd_pcm_hw_refine_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t __user * _params)
{
snd_pcm_hw_params_t params;
int err;
return err;
}
-static int snd_pcm_hw_params_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * _params)
+static int snd_pcm_hw_params_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t __user * _params)
{
snd_pcm_hw_params_t params;
int err;
return 0;
}
-static int snd_pcm_sw_params_user(snd_pcm_substream_t * substream, snd_pcm_sw_params_t * _params)
+static int snd_pcm_sw_params_user(snd_pcm_substream_t * substream, snd_pcm_sw_params_t __user * _params)
{
snd_pcm_sw_params_t params;
int err;
return 0;
}
-static int snd_pcm_status_user(snd_pcm_substream_t * substream, snd_pcm_status_t * _status)
+static int snd_pcm_status_user(snd_pcm_substream_t * substream, snd_pcm_status_t __user * _status)
{
snd_pcm_status_t status;
snd_pcm_runtime_t *runtime;
return 0;
}
-static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel_info_t * _info)
+static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel_info_t __user * _info)
{
snd_pcm_channel_info_t info;
snd_pcm_runtime_t *runtime;
return err;
}
-static int snd_pcm_delay(snd_pcm_substream_t *substream, snd_pcm_sframes_t *res)
+static int snd_pcm_delay(snd_pcm_substream_t *substream, snd_pcm_sframes_t __user *res)
{
snd_pcm_runtime_t *runtime = substream->runtime;
int err;
return err;
}
-static int snd_pcm_sync_ptr(snd_pcm_substream_t *substream, struct sndrv_pcm_sync_ptr *_sync_ptr)
+static int snd_pcm_sync_ptr(snd_pcm_substream_t *substream, struct sndrv_pcm_sync_ptr __user *_sync_ptr)
{
snd_pcm_runtime_t *runtime = substream->runtime;
struct sndrv_pcm_sync_ptr sync_ptr;
int err;
memset(&sync_ptr, 0, sizeof(sync_ptr));
- if (get_user(sync_ptr.flags, (unsigned int *) &(_sync_ptr->flags)))
+ if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags)))
return -EFAULT;
if (copy_from_user(&sync_ptr.c.control, &(_sync_ptr->c.control), sizeof(struct sndrv_pcm_mmap_control)))
return -EFAULT;
}
static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream,
- unsigned int cmd, void *arg);
+ unsigned int cmd, void __user *arg);
static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream,
- unsigned int cmd, void *arg);
+ unsigned int cmd, void __user *arg);
static int snd_pcm_common_ioctl1(snd_pcm_substream_t *substream,
- unsigned int cmd, void *arg)
+ unsigned int cmd, void __user *arg)
{
snd_assert(substream != NULL, return -ENXIO);
switch (cmd) {
case SNDRV_PCM_IOCTL_PVERSION:
- return put_user(SNDRV_PCM_VERSION, (int *)arg) ? -EFAULT : 0;
+ return put_user(SNDRV_PCM_VERSION, (int __user *)arg) ? -EFAULT : 0;
case SNDRV_PCM_IOCTL_INFO:
- return snd_pcm_info_user(substream, (snd_pcm_info_t *) arg);
+ return snd_pcm_info_user(substream, arg);
case SNDRV_PCM_IOCTL_TSTAMP:
{
int xarg;
- if (get_user(xarg, (int *) arg))
+ if (get_user(xarg, (int __user *)arg))
return -EFAULT;
substream->runtime->tstamp_timespec = xarg ? 1 : 0;
return 0;
}
case SNDRV_PCM_IOCTL_HW_REFINE:
- return snd_pcm_hw_refine_user(substream, (snd_pcm_hw_params_t *) arg);
+ return snd_pcm_hw_refine_user(substream, arg);
case SNDRV_PCM_IOCTL_HW_PARAMS:
- return snd_pcm_hw_params_user(substream, (snd_pcm_hw_params_t *) arg);
+ return snd_pcm_hw_params_user(substream, arg);
case SNDRV_PCM_IOCTL_HW_FREE:
return snd_pcm_hw_free(substream);
case SNDRV_PCM_IOCTL_SW_PARAMS:
- return snd_pcm_sw_params_user(substream, (snd_pcm_sw_params_t *) arg);
+ return snd_pcm_sw_params_user(substream, arg);
case SNDRV_PCM_IOCTL_STATUS:
- return snd_pcm_status_user(substream, (snd_pcm_status_t *) arg);
+ return snd_pcm_status_user(substream, arg);
case SNDRV_PCM_IOCTL_CHANNEL_INFO:
- return snd_pcm_channel_info(substream, (snd_pcm_channel_info_t *) arg);
+ return snd_pcm_channel_info(substream, arg);
case SNDRV_PCM_IOCTL_PREPARE:
return snd_pcm_prepare(substream);
case SNDRV_PCM_IOCTL_RESET:
case SNDRV_PCM_IOCTL_START:
return snd_pcm_action_lock_irq(&snd_pcm_action_start, substream, 0, 0);
case SNDRV_PCM_IOCTL_LINK:
- return snd_pcm_link(substream, (long) arg);
+ return snd_pcm_link(substream, (int)(unsigned long) arg);
case SNDRV_PCM_IOCTL_UNLINK:
return snd_pcm_unlink(substream);
case SNDRV_PCM_IOCTL_RESUME:
case SNDRV_PCM_IOCTL_HWSYNC:
return snd_pcm_hwsync(substream);
case SNDRV_PCM_IOCTL_DELAY:
- return snd_pcm_delay(substream, (snd_pcm_sframes_t *) arg);
+ return snd_pcm_delay(substream, arg);
case SNDRV_PCM_IOCTL_SYNC_PTR:
- return snd_pcm_sync_ptr(substream, (struct sndrv_pcm_sync_ptr *) arg);
+ return snd_pcm_sync_ptr(substream, arg);
case SNDRV_PCM_IOCTL_HW_REFINE_OLD:
- return snd_pcm_hw_refine_old_user(substream, (struct sndrv_pcm_hw_params_old *) arg);
+ return snd_pcm_hw_refine_old_user(substream, arg);
case SNDRV_PCM_IOCTL_HW_PARAMS_OLD:
- return snd_pcm_hw_params_old_user(substream, (struct sndrv_pcm_hw_params_old *) arg);
+ return snd_pcm_hw_params_old_user(substream, arg);
}
snd_printd("unknown ioctl = 0x%x\n", cmd);
return -ENOTTY;
}
static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream,
- unsigned int cmd, void *arg)
+ unsigned int cmd, void __user *arg)
{
snd_assert(substream != NULL, return -ENXIO);
snd_assert(substream->stream == SNDRV_PCM_STREAM_PLAYBACK, return -EINVAL);
switch (cmd) {
case SNDRV_PCM_IOCTL_WRITEI_FRAMES:
{
- snd_xferi_t xferi, *_xferi = arg;
+ snd_xferi_t xferi;
+ snd_xferi_t __user *_xferi = arg;
snd_pcm_runtime_t *runtime = substream->runtime;
snd_pcm_sframes_t result;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
}
case SNDRV_PCM_IOCTL_WRITEN_FRAMES:
{
- snd_xfern_t xfern, *_xfern = arg;
+ snd_xfern_t xfern;
+ snd_xfern_t __user *_xfern = arg;
snd_pcm_runtime_t *runtime = substream->runtime;
- void *bufs;
+ void __user **bufs;
snd_pcm_sframes_t result;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
return -EBADFD;
}
case SNDRV_PCM_IOCTL_REWIND:
{
- snd_pcm_uframes_t frames, *_frames = arg;
+ snd_pcm_uframes_t frames;
+ snd_pcm_uframes_t __user *_frames = arg;
snd_pcm_sframes_t result;
if (get_user(frames, _frames))
return -EFAULT;
}
case SNDRV_PCM_IOCTL_FORWARD:
{
- snd_pcm_uframes_t frames, *_frames = arg;
+ snd_pcm_uframes_t frames;
+ snd_pcm_uframes_t __user *_frames = arg;
snd_pcm_sframes_t result;
if (get_user(frames, _frames))
return -EFAULT;
{
int res;
snd_pcm_stream_lock_irq(substream);
- res = snd_pcm_pause(substream, (long) arg);
+ res = snd_pcm_pause(substream, (int)(unsigned long)arg);
snd_pcm_stream_unlock_irq(substream);
return res;
}
}
static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream,
- unsigned int cmd, void *arg)
+ unsigned int cmd, void __user *arg)
{
snd_assert(substream != NULL, return -ENXIO);
snd_assert(substream->stream == SNDRV_PCM_STREAM_CAPTURE, return -EINVAL);
switch (cmd) {
case SNDRV_PCM_IOCTL_READI_FRAMES:
{
- snd_xferi_t xferi, *_xferi = arg;
+ snd_xferi_t xferi;
+ snd_xferi_t __user *_xferi = arg;
snd_pcm_runtime_t *runtime = substream->runtime;
snd_pcm_sframes_t result;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
}
case SNDRV_PCM_IOCTL_READN_FRAMES:
{
- snd_xfern_t xfern, *_xfern = arg;
+ snd_xfern_t xfern;
+ snd_xfern_t __user *_xfern = arg;
snd_pcm_runtime_t *runtime = substream->runtime;
void *bufs;
snd_pcm_sframes_t result;
}
case SNDRV_PCM_IOCTL_REWIND:
{
- snd_pcm_uframes_t frames, *_frames = arg;
+ snd_pcm_uframes_t frames;
+ snd_pcm_uframes_t __user *_frames = arg;
snd_pcm_sframes_t result;
if (get_user(frames, _frames))
return -EFAULT;
}
case SNDRV_PCM_IOCTL_FORWARD:
{
- snd_pcm_uframes_t frames, *_frames = arg;
+ snd_pcm_uframes_t frames;
+ snd_pcm_uframes_t __user *_frames = arg;
snd_pcm_sframes_t result;
if (get_user(frames, _frames))
return -EFAULT;
if (((cmd >> 8) & 0xff) != 'A')
return -ENOTTY;
- return snd_pcm_playback_ioctl1(pcm_file->substream, cmd, (void *) arg);
+ return snd_pcm_playback_ioctl1(pcm_file->substream, cmd, (void __user *)arg);
}
static int snd_pcm_capture_ioctl(struct inode *inode, struct file *file,
if (((cmd >> 8) & 0xff) != 'A')
return -ENOTTY;
- return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void *) arg);
+ return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void __user *)arg);
}
int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream,
}
}
-static ssize_t snd_pcm_read(struct file *file, char *buf, size_t count, loff_t * offset)
+static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count, loff_t * offset)
{
snd_pcm_file_t *pcm_file;
snd_pcm_substream_t *substream;
return result;
}
-static ssize_t snd_pcm_write(struct file *file, const char *buf, size_t count, loff_t * offset)
+static ssize_t snd_pcm_write(struct file *file, const char __user *buf, size_t count, loff_t * offset)
{
snd_pcm_file_t *pcm_file;
snd_pcm_substream_t *substream;
snd_pcm_runtime_t *runtime;
snd_pcm_sframes_t result;
unsigned long i;
- void **bufs;
+ void __user **bufs;
snd_pcm_uframes_t frames;
pcm_file = snd_magic_cast(snd_pcm_file_t, file->private_data, return -ENXIO);
snd_pcm_runtime_t *runtime;
snd_pcm_sframes_t result;
unsigned long i;
- void **bufs;
+ void __user **bufs;
snd_pcm_uframes_t frames;
pcm_file = snd_magic_cast(snd_pcm_file_t, file->private_data, result = -ENXIO; goto end);
oparams->fifo_size = params->fifo_size;
}
-static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams)
+static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams)
{
snd_pcm_hw_params_t params;
struct sndrv_pcm_hw_params_old oparams;
return err;
}
-static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams)
+static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams)
{
snd_pcm_hw_params_t params;
struct sndrv_pcm_hw_params_old oparams;