Commit 487db1c7 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] dmasound annotation

dmasound (core + ppc-specific parts) annotated
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0a333133
......@@ -44,12 +44,12 @@
#define le2be16dbl(x) (((x)<<8 & 0xff00ff00) | ((x)>>8 & 0x00ff00ff))
#define IOCTL_IN(arg, ret) \
do { int error = get_user(ret, (int *)(arg)); \
do { int error = get_user(ret, (int __user *)(arg)); \
if (error) return error; \
} while (0)
#define IOCTL_OUT(arg, ret) ioctl_return((int *)(arg), ret)
#define IOCTL_OUT(arg, ret) ioctl_return((int __user *)(arg), ret)
static inline int ioctl_return(int *addr, int value)
static inline int ioctl_return(int __user *addr, int value)
{
return value < 0 ? value : put_user(value, addr);
}
......@@ -153,14 +153,14 @@ typedef struct {
*/
typedef struct {
ssize_t (*ct_ulaw)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_alaw)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_s8)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_u8)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_s16be)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_u16be)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_s16le)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_u16le)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_ulaw)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_alaw)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_s8)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_u8)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_s16be)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_u16be)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_s16le)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_u16le)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
} TRANS;
struct sound_settings {
......
......@@ -326,12 +326,12 @@ extern int daca_leave_sleep(void);
#undef IOCTL_OUT
#define IOCTL_IN(arg, ret) \
rc = get_user(ret, (int *)(arg)); \
rc = get_user(ret, (int __user *)(arg)); \
if (rc) break;
#define IOCTL_OUT(arg, ret) \
ioctl_return2((int *)(arg), ret)
ioctl_return2((int __user *)(arg), ret)
static inline int ioctl_return2(int *addr, int value)
static inline int ioctl_return2(int __user *addr, int value)
{
return value < 0 ? value : put_user(value, addr);
}
......@@ -514,6 +514,7 @@ tas_set_frame_rate(void)
static int
tas_mixer_ioctl(u_int cmd, u_long arg)
{
int __user *argp = (int __user *)arg;
int data;
int rc;
......@@ -524,16 +525,16 @@ tas_mixer_ioctl(u_int cmd, u_long arg)
if ((cmd & ~0xff) == MIXER_WRITE(0) &&
tas_supported_mixers() & (1<<(cmd & 0xff))) {
rc = get_user(data, (int *)(arg));
rc = get_user(data, argp);
if (rc<0) return rc;
tas_set_mixer_level(cmd & 0xff, data);
tas_get_mixer_level(cmd & 0xff, &data);
return ioctl_return2((int *)(arg), data);
return ioctl_return2(argp, data);
}
if ((cmd & ~0xff) == MIXER_READ(0) &&
tas_supported_mixers() & (1<<(cmd & 0xff))) {
tas_get_mixer_level(cmd & 0xff, &data);
return ioctl_return2((int *)(arg), data);
return ioctl_return2(argp, data);
}
switch(cmd) {
......
......@@ -279,11 +279,11 @@ static int sound_set_stereo(int stereo)
return stereo;
}
static ssize_t sound_copy_translate(TRANS *trans, const u_char *userPtr,
static ssize_t sound_copy_translate(TRANS *trans, const u_char __user *userPtr,
size_t userCount, u_char frame[],
ssize_t *frameUsed, ssize_t frameLeft)
{
ssize_t (*ct_func)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_func)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
switch (dmasound.soft.format) {
case AFMT_MU_LAW:
......@@ -361,7 +361,7 @@ static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd,
strlcpy(info.id, dmasound.mach.name2, sizeof(info.id));
strlcpy(info.name, dmasound.mach.name2, sizeof(info.name));
info.modify_counter = mixer.modify_counter;
if (copy_to_user((int *)arg, &info, sizeof(info)))
if (copy_to_user((void __user *)arg, &info, sizeof(info)))
return -EFAULT;
return 0;
}
......@@ -546,7 +546,7 @@ static inline void sq_play(void)
dmasound.mach.play();
}
static ssize_t sq_write(struct file *file, const char *src, size_t uLeft,
static ssize_t sq_write(struct file *file, const char __user *src, size_t uLeft,
loff_t *ppos)
{
ssize_t uWritten = 0;
......@@ -703,7 +703,7 @@ static unsigned int sq_poll(struct file *file, struct poll_table_struct *wait)
* it and restart the DMA.
*/
static ssize_t sq_read(struct file *file, char *dst, size_t uLeft,
static ssize_t sq_read(struct file *file, char __user *dst, size_t uLeft,
loff_t *ppos)
{
......@@ -1321,7 +1321,7 @@ static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
info.fragstotal = write_sq.max_active;
info.fragsize = write_sq.user_frag_size;
info.bytes = info.fragments * info.fragsize;
if (copy_to_user((void *)arg, &info, sizeof(info)))
if (copy_to_user((void __user *)arg, &info, sizeof(info)))
return -EFAULT;
return 0;
} else
......@@ -1547,7 +1547,7 @@ static int state_release(struct inode *inode, struct file *file)
return 0;
}
static ssize_t state_read(struct file *file, char *buf, size_t count,
static ssize_t state_read(struct file *file, char __user *buf, size_t count,
loff_t *ppos)
{
int n = state.len - state.ptr;
......
......@@ -452,8 +452,9 @@ tas3001c_eq_rw( struct tas3001c_data_t *self,
{
int rc;
struct tas_biquad_ctrl_t biquad;
void __user *argp = (void __user *)arg;
if (copy_from_user((void *)&biquad, (const void *)arg, sizeof(struct tas_biquad_ctrl_t))) {
if (copy_from_user(&biquad, argp, sizeof(struct tas_biquad_ctrl_t))) {
return -EFAULT;
}
......@@ -466,7 +467,7 @@ tas3001c_eq_rw( struct tas3001c_data_t *self,
rc=tas3001c_read_biquad(self, biquad.channel, biquad.filter, &biquad.data);
if (rc != 0) return rc;
if (copy_to_user((void *)arg, (const void *)&biquad, sizeof(struct tas_biquad_ctrl_t))) {
if (copy_to_user(argp, &biquad, sizeof(struct tas_biquad_ctrl_t))) {
return -EFAULT;
}
......@@ -485,27 +486,21 @@ tas3001c_eq_list_rw( struct tas3001c_data_t *self,
int i,j;
char sync_required[2][6];
struct tas_biquad_ctrl_t biquad;
struct tas_biquad_ctrl_list_t __user *argp = (void __user *)arg;
memset(sync_required,0,sizeof(sync_required));
if (copy_from_user((void *)&filter_count,
(const void *)arg + offsetof(struct tas_biquad_ctrl_list_t,filter_count),
sizeof(int))) {
if (copy_from_user(&filter_count, &argp->filter_count, sizeof(int)))
return -EFAULT;
}
if (copy_from_user((void *)&flags,
(const void *)arg + offsetof(struct tas_biquad_ctrl_list_t,flags),
sizeof(int))) {
if (copy_from_user(&flags, &argp->flags, sizeof(int)))
return -EFAULT;
}
if (cmd & SIOC_IN) {
}
for (i=0; i < filter_count; i++) {
if (copy_from_user((void *)&biquad,
(const void *)arg + offsetof(struct tas_biquad_ctrl_list_t, biquads[i]),
if (copy_from_user(&biquad, &argp->biquads[i],
sizeof(struct tas_biquad_ctrl_t))) {
return -EFAULT;
}
......@@ -520,8 +515,7 @@ tas3001c_eq_list_rw( struct tas3001c_data_t *self,
rc=tas3001c_read_biquad(self, biquad.channel, biquad.filter, &biquad.data);
if (rc != 0) return rc;
if (copy_to_user((void *)arg + offsetof(struct tas_biquad_ctrl_list_t, biquads[i]),
(const void *)&biquad,
if (copy_to_user(&argp->biquads[i], &biquad,
sizeof(struct tas_biquad_ctrl_t))) {
return -EFAULT;
}
......@@ -596,12 +590,10 @@ tas3001c_drce_rw( struct tas3001c_data_t *self,
{
int rc;
struct tas_drce_ctrl_t drce_ctrl;
void __user *argp = (void __user *)arg;
if (copy_from_user((void *)&drce_ctrl,
(const void *)arg,
sizeof(struct tas_drce_ctrl_t))) {
if (copy_from_user(&drce_ctrl, argp, sizeof(struct tas_drce_ctrl_t)))
return -EFAULT;
}
#ifdef DEBUG_DRCE
printk("DRCE IOCTL: input [ FLAGS:%x ENABLE:%x THRESH:%x\n",
......@@ -623,8 +615,7 @@ tas3001c_drce_rw( struct tas3001c_data_t *self,
if (drce_ctrl.flags & TAS_DRCE_THRESHOLD)
drce_ctrl.data.threshold = self->drce_state.threshold;
if (copy_to_user((void *)arg,
(const void *)&drce_ctrl,
if (copy_to_user(argp, &drce_ctrl,
sizeof(struct tas_drce_ctrl_t))) {
return -EFAULT;
}
......@@ -703,6 +694,7 @@ tas3001c_device_ioctl( struct tas3001c_data_t *self,
u_int cmd,
u_long arg)
{
uint __user *argp = (void __user *)arg;
switch (cmd) {
case TAS_READ_EQ:
case TAS_WRITE_EQ:
......@@ -713,11 +705,11 @@ tas3001c_device_ioctl( struct tas3001c_data_t *self,
return tas3001c_eq_list_rw(self, cmd, arg);
case TAS_READ_EQ_FILTER_COUNT:
put_user(TAS3001C_BIQUAD_FILTER_COUNT, (uint *)(arg));
put_user(TAS3001C_BIQUAD_FILTER_COUNT, argp);
return 0;
case TAS_READ_EQ_CHANNEL_COUNT:
put_user(TAS3001C_BIQUAD_CHANNEL_COUNT, (uint *)(arg));
put_user(TAS3001C_BIQUAD_CHANNEL_COUNT, argp);
return 0;
case TAS_READ_DRCE:
......@@ -725,15 +717,14 @@ tas3001c_device_ioctl( struct tas3001c_data_t *self,
return tas3001c_drce_rw(self, cmd, arg);
case TAS_READ_DRCE_CAPS:
put_user(TAS_DRCE_ENABLE | TAS_DRCE_THRESHOLD, (uint *)(arg));
put_user(TAS_DRCE_ENABLE | TAS_DRCE_THRESHOLD, argp);
return 0;
case TAS_READ_DRCE_MIN:
case TAS_READ_DRCE_MAX: {
struct tas_drce_ctrl_t drce_ctrl;
if (copy_from_user((void *)&drce_ctrl,
(const void *)arg,
if (copy_from_user(&drce_ctrl, argp,
sizeof(struct tas_drce_ctrl_t))) {
return -EFAULT;
}
......@@ -746,8 +737,7 @@ tas3001c_device_ioctl( struct tas3001c_data_t *self,
}
}
if (copy_to_user((void *)arg,
(const void *)&drce_ctrl,
if (copy_to_user(argp, &drce_ctrl,
sizeof(struct tas_drce_ctrl_t))) {
return -EFAULT;
}
......
......@@ -3,12 +3,12 @@
static struct tas_drce_t eqp_0e_2_1_drce = {
.enable = 1,
.above { .val = 3.0 * (1<<8), .expand = 0 },
.below { .val = 1.0 * (1<<8), .expand = 0 },
.threshold -15.33 * (1<<8),
.energy 2.4 * (1<<12),
.attack 0.013 * (1<<12),
.decay 0.212 * (1<<12),
.above = { .val = 3.0 * (1<<8), .expand = 0 },
.below = { .val = 1.0 * (1<<8), .expand = 0 },
.threshold = -15.33 * (1<<8),
.energy = 2.4 * (1<<12),
.attack = 0.013 * (1<<12),
.decay = 0.212 * (1<<12),
};
static struct tas_biquad_ctrl_t eqp_0e_2_1_biquads[]={
......
......@@ -635,10 +635,11 @@ tas3004_eq_rw( struct tas3004_data_t *self,
u_int cmd,
u_long arg)
{
void __user *argp = (void __user *)arg;
int rc;
struct tas_biquad_ctrl_t biquad;
if (copy_from_user((void *)&biquad, (const void *)arg, sizeof(struct tas_biquad_ctrl_t))) {
if (copy_from_user((void *)&biquad, argp, sizeof(struct tas_biquad_ctrl_t))) {
return -EFAULT;
}
......@@ -651,7 +652,7 @@ tas3004_eq_rw( struct tas3004_data_t *self,
rc=tas3004_read_biquad(self, biquad.channel, biquad.filter, &biquad.data);
if (rc != 0) return rc;
if (copy_to_user((void *)arg, (const void *)&biquad, sizeof(struct tas_biquad_ctrl_t))) {
if (copy_to_user(argp, &biquad, sizeof(struct tas_biquad_ctrl_t))) {
return -EFAULT;
}
......@@ -670,27 +671,21 @@ tas3004_eq_list_rw( struct tas3004_data_t *self,
int i,j;
char sync_required[TAS3004_BIQUAD_CHANNEL_COUNT][TAS3004_BIQUAD_FILTER_COUNT];
struct tas_biquad_ctrl_t biquad;
struct tas_biquad_ctrl_list_t __user *argp = (void __user *)arg;
memset(sync_required,0,sizeof(sync_required));
if (copy_from_user((void *)&filter_count,
(const void *)arg + offsetof(struct tas_biquad_ctrl_list_t,filter_count),
sizeof(int))) {
if (copy_from_user(&filter_count, &argp->filter_count, sizeof(int)))
return -EFAULT;
}
if (copy_from_user((void *)&flags,
(const void *)arg + offsetof(struct tas_biquad_ctrl_list_t,flags),
sizeof(int))) {
if (copy_from_user(&flags, &argp->flags, sizeof(int)))
return -EFAULT;
}
if (cmd & SIOC_IN) {
}
for (i=0; i < filter_count; i++) {
if (copy_from_user((void *)&biquad,
(const void *)arg + offsetof(struct tas_biquad_ctrl_list_t, biquads[i]),
if (copy_from_user(&biquad, &argp->biquads[i],
sizeof(struct tas_biquad_ctrl_t))) {
return -EFAULT;
}
......@@ -705,8 +700,7 @@ tas3004_eq_list_rw( struct tas3004_data_t *self,
rc=tas3004_read_biquad(self, biquad.channel, biquad.filter, &biquad.data);
if (rc != 0) return rc;
if (copy_to_user((void *)arg + offsetof(struct tas_biquad_ctrl_list_t, biquads[i]),
(const void *)&biquad,
if (copy_to_user(&argp->biquads[i], &biquad,
sizeof(struct tas_biquad_ctrl_t))) {
return -EFAULT;
}
......@@ -840,12 +834,10 @@ tas3004_drce_rw( struct tas3004_data_t *self,
{
int rc;
struct tas_drce_ctrl_t drce_ctrl;
void __user *argp = (void __user *)arg;
if (copy_from_user((void *)&drce_ctrl,
(const void *)arg,
sizeof(struct tas_drce_ctrl_t))) {
if (copy_from_user(&drce_ctrl, argp, sizeof(struct tas_drce_ctrl_t)))
return -EFAULT;
}
#ifdef DEBUG_DRCE
printk("DRCE: input [ FLAGS:%x ENABLE:%x ABOVE:%x/%x BELOW:%x/%x THRESH:%x ENERGY:%x ATTACK:%x DECAY:%x\n",
......@@ -880,8 +872,7 @@ tas3004_drce_rw( struct tas3004_data_t *self,
if (drce_ctrl.flags & TAS_DRCE_DECAY)
drce_ctrl.data.decay = self->drce_state.decay;
if (copy_to_user((void *)arg,
(const void *)&drce_ctrl,
if (copy_to_user(argp, &drce_ctrl,
sizeof(struct tas_drce_ctrl_t))) {
return -EFAULT;
}
......@@ -952,6 +943,7 @@ tas3004_device_ioctl( struct tas3004_data_t *self,
u_int cmd,
u_long arg)
{
uint __user *argp = (void __user *)arg;
switch (cmd) {
case TAS_READ_EQ:
case TAS_WRITE_EQ:
......@@ -962,11 +954,11 @@ tas3004_device_ioctl( struct tas3004_data_t *self,
return tas3004_eq_list_rw(self, cmd, arg);
case TAS_READ_EQ_FILTER_COUNT:
put_user(TAS3004_BIQUAD_FILTER_COUNT, (uint *)(arg));
put_user(TAS3004_BIQUAD_FILTER_COUNT, argp);
return 0;
case TAS_READ_EQ_CHANNEL_COUNT:
put_user(TAS3004_BIQUAD_CHANNEL_COUNT, (uint *)(arg));
put_user(TAS3004_BIQUAD_CHANNEL_COUNT, argp);
return 0;
case TAS_READ_DRCE:
......@@ -981,7 +973,7 @@ tas3004_device_ioctl( struct tas3004_data_t *self,
TAS_DRCE_ENERGY |
TAS_DRCE_ATTACK |
TAS_DRCE_DECAY,
(uint *)(arg));
argp);
return 0;
case TAS_READ_DRCE_MIN:
......@@ -989,8 +981,7 @@ tas3004_device_ioctl( struct tas3004_data_t *self,
struct tas_drce_ctrl_t drce_ctrl;
const struct tas_drce_t *drce_copy;
if (copy_from_user((void *)&drce_ctrl,
(const void *)arg,
if (copy_from_user(&drce_ctrl, argp,
sizeof(struct tas_drce_ctrl_t))) {
return -EFAULT;
}
......@@ -1020,8 +1011,7 @@ tas3004_device_ioctl( struct tas3004_data_t *self,
drce_ctrl.data.decay=drce_copy->decay;
}
if (copy_to_user((void *)arg,
(const void *)&drce_ctrl,
if (copy_to_user(argp, &drce_ctrl,
sizeof(struct tas_drce_ctrl_t))) {
return -EFAULT;
}
......
......@@ -20,42 +20,42 @@
static short dmasound_alaw2dma16[] ;
static short dmasound_ulaw2dma16[] ;
static ssize_t pmac_ct_law(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_law(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft);
static ssize_t pmac_ct_s8(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_s8(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft);
static ssize_t pmac_ct_u8(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_u8(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft);
static ssize_t pmac_ct_s16(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_s16(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft);
static ssize_t pmac_ct_u16(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_u16(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft);
static ssize_t pmac_ctx_law(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ctx_law(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft);
static ssize_t pmac_ctx_s8(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ctx_s8(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft);
static ssize_t pmac_ctx_u8(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ctx_u8(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft);
static ssize_t pmac_ctx_s16(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ctx_s16(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft);
static ssize_t pmac_ctx_u16(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ctx_u16(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft);
static ssize_t pmac_ct_s16_read(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_s16_read(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft);
static ssize_t pmac_ct_u16_read(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_u16_read(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft);
......@@ -63,7 +63,7 @@ static ssize_t pmac_ct_u16_read(const u_char *userPtr, size_t userCount,
static int expand_data; /* Data for expanding */
static ssize_t pmac_ct_law(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_law(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
......@@ -96,7 +96,7 @@ static ssize_t pmac_ct_law(const u_char *userPtr, size_t userCount,
}
static ssize_t pmac_ct_s8(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_s8(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
......@@ -127,7 +127,7 @@ static ssize_t pmac_ct_s8(const u_char *userPtr, size_t userCount,
}
static ssize_t pmac_ct_u8(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_u8(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
......@@ -158,7 +158,7 @@ static ssize_t pmac_ct_u8(const u_char *userPtr, size_t userCount,
}
static ssize_t pmac_ct_s16(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_s16(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
......@@ -170,7 +170,7 @@ static ssize_t pmac_ct_s16(const u_char *userPtr, size_t userCount,
userCount >>= (stereo? 2: 1);
used = count = min_t(unsigned long, userCount, frameLeft);
if (!stereo) {
short *up = (short *) userPtr;
short __user *up = (short __user *) userPtr;
while (count > 0) {
short data;
if (get_user(data, up++))
......@@ -187,7 +187,7 @@ static ssize_t pmac_ct_s16(const u_char *userPtr, size_t userCount,
return stereo? used * 4: used * 2;
}
static ssize_t pmac_ct_u16(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_u16(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
......@@ -195,7 +195,7 @@ static ssize_t pmac_ct_u16(const u_char *userPtr, size_t userCount,
int mask = (dmasound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
int stereo = dmasound.soft.stereo;
short *fp = (short *) &frame[*frameUsed];
short *up = (short *) userPtr;
short __user *up = (short __user *) userPtr;
frameLeft >>= 2;
userCount >>= (stereo? 2: 1);
......@@ -219,7 +219,7 @@ static ssize_t pmac_ct_u16(const u_char *userPtr, size_t userCount,
}
static ssize_t pmac_ctx_law(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ctx_law(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
......@@ -266,7 +266,7 @@ static ssize_t pmac_ctx_law(const u_char *userPtr, size_t userCount,
return stereo? utotal * 2: utotal;
}
static ssize_t pmac_ctx_s8(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ctx_s8(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
......@@ -311,7 +311,7 @@ static ssize_t pmac_ctx_s8(const u_char *userPtr, size_t userCount,
}
static ssize_t pmac_ctx_u8(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ctx_u8(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
......@@ -356,13 +356,13 @@ static ssize_t pmac_ctx_u8(const u_char *userPtr, size_t userCount,
}
static ssize_t pmac_ctx_s16(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ctx_s16(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
unsigned int *p = (unsigned int *) &frame[*frameUsed];
unsigned int data = expand_data;
unsigned short *up = (unsigned short *) userPtr;
unsigned short __user *up = (unsigned short __user *) userPtr;
int bal = expand_bal;
int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
int stereo = dmasound.soft.stereo;
......@@ -400,14 +400,14 @@ static ssize_t pmac_ctx_s16(const u_char *userPtr, size_t userCount,
}
static ssize_t pmac_ctx_u16(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ctx_u16(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
int mask = (dmasound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
unsigned int *p = (unsigned int *) &frame[*frameUsed];
unsigned int data = expand_data;
unsigned short *up = (unsigned short *) userPtr;
unsigned short __user *up = (unsigned short __user *) userPtr;
int bal = expand_bal;
int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
int stereo = dmasound.soft.stereo;
......@@ -447,7 +447,7 @@ static ssize_t pmac_ctx_u16(const u_char *userPtr, size_t userCount,
/* data in routines... */
static ssize_t pmac_ct_s8_read(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_s8_read(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
......@@ -465,13 +465,13 @@ static ssize_t pmac_ct_s8_read(const u_char *userPtr, size_t userCount,
val = *p++;
val = (val * software_input_volume) >> 7;
data = val >> 8;
if (put_user(data, (u_char *)userPtr++))
if (put_user(data, (u_char __user *)userPtr++))
return -EFAULT;
if (stereo) {
val = *p;
val = (val * software_input_volume) >> 7;
data = val >> 8;
if (put_user(data, (u_char *)userPtr++))
if (put_user(data, (u_char __user *)userPtr++))
return -EFAULT;
}
p++;
......@@ -482,7 +482,7 @@ static ssize_t pmac_ct_s8_read(const u_char *userPtr, size_t userCount,
}
static ssize_t pmac_ct_u8_read(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_u8_read(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
......@@ -500,13 +500,13 @@ static ssize_t pmac_ct_u8_read(const u_char *userPtr, size_t userCount,
val = *p++;
val = (val * software_input_volume) >> 7;
data = (val >> 8) ^ 0x80;
if (put_user(data, (u_char *)userPtr++))
if (put_user(data, (u_char __user *)userPtr++))
return -EFAULT;
if (stereo) {
val = *p;
val = (val * software_input_volume) >> 7;
data = (val >> 8) ^ 0x80;
if (put_user(data, (u_char *)userPtr++))
if (put_user(data, (u_char __user *)userPtr++))
return -EFAULT;
}
p++;
......@@ -516,14 +516,14 @@ static ssize_t pmac_ct_u8_read(const u_char *userPtr, size_t userCount,
return stereo? used * 2: used;
}
static ssize_t pmac_ct_s16_read(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_s16_read(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
ssize_t count, used;
int stereo = dmasound.soft.stereo;
short *fp = (short *) &frame[*frameUsed];
short *up = (short *) userPtr;
short __user *up = (short __user *) userPtr;
frameLeft >>= 2;
userCount >>= (stereo? 2: 1);
......@@ -548,7 +548,7 @@ static ssize_t pmac_ct_s16_read(const u_char *userPtr, size_t userCount,
return stereo? used * 4: used * 2;
}
static ssize_t pmac_ct_u16_read(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ct_u16_read(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
......@@ -556,7 +556,7 @@ static ssize_t pmac_ct_u16_read(const u_char *userPtr, size_t userCount,
int mask = (dmasound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
int stereo = dmasound.soft.stereo;
short *fp = (short *) &frame[*frameUsed];
short *up = (short *) userPtr;
short __user *up = (short __user *) userPtr;
frameLeft >>= 2;
userCount >>= (stereo? 2: 1);
......@@ -585,7 +585,7 @@ static ssize_t pmac_ct_u16_read(const u_char *userPtr, size_t userCount,
/* data in routines (reducing speed)... */
static ssize_t pmac_ctx_s8_read(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ctx_s8_read(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
......@@ -614,11 +614,11 @@ static ssize_t pmac_ctx_s8_read(const u_char *userPtr, size_t userCount,
p++;
if (bal < 0) {
data = vall >> 8;
if (put_user(data, (u_char *)userPtr++))
if (put_user(data, (u_char __user *)userPtr++))
return -EFAULT;
if (stereo) {
data = valr >> 8;
if (put_user(data, (u_char *)userPtr++))
if (put_user(data, (u_char __user *)userPtr++))
return -EFAULT;
}
userCount--;
......@@ -634,7 +634,7 @@ static ssize_t pmac_ctx_s8_read(const u_char *userPtr, size_t userCount,
}
static ssize_t pmac_ctx_u8_read(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ctx_u8_read(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
......@@ -664,11 +664,11 @@ static ssize_t pmac_ctx_u8_read(const u_char *userPtr, size_t userCount,
p++;
if (bal < 0) {
data = (vall >> 8) ^ 0x80;
if (put_user(data, (u_char *)userPtr++))
if (put_user(data, (u_char __user *)userPtr++))
return -EFAULT;
if (stereo) {
data = (valr >> 8) ^ 0x80;
if (put_user(data, (u_char *)userPtr++))
if (put_user(data, (u_char __user *)userPtr++))
return -EFAULT;
}
userCount--;
......@@ -683,13 +683,13 @@ static ssize_t pmac_ctx_u8_read(const u_char *userPtr, size_t userCount,
return stereo? utotal * 2: utotal;
}
static ssize_t pmac_ctx_s16_read(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ctx_s16_read(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
int bal = expand_read_bal;
short *fp = (short *) &frame[*frameUsed];
short *up = (short *) userPtr;
short __user *up = (short __user *) userPtr;
int stereo = dmasound.soft.stereo;
int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
int utotal, ftotal;
......@@ -730,14 +730,14 @@ static ssize_t pmac_ctx_s16_read(const u_char *userPtr, size_t userCount,
return stereo? utotal * 4: utotal * 2;
}
static ssize_t pmac_ctx_u16_read(const u_char *userPtr, size_t userCount,
static ssize_t pmac_ctx_u16_read(const u_char __user *userPtr, size_t userCount,
u_char frame[], ssize_t *frameUsed,
ssize_t frameLeft)
{
int bal = expand_read_bal;
int mask = (dmasound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
short *fp = (short *) &frame[*frameUsed];
short *up = (short *) userPtr;
short __user *up = (short __user *) userPtr;
int stereo = dmasound.soft.stereo;
int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
int utotal, ftotal;
......
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