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 @@ ...@@ -44,12 +44,12 @@
#define le2be16dbl(x) (((x)<<8 & 0xff00ff00) | ((x)>>8 & 0x00ff00ff)) #define le2be16dbl(x) (((x)<<8 & 0xff00ff00) | ((x)>>8 & 0x00ff00ff))
#define IOCTL_IN(arg, ret) \ #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; \ if (error) return error; \
} while (0) } 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); return value < 0 ? value : put_user(value, addr);
} }
...@@ -153,14 +153,14 @@ typedef struct { ...@@ -153,14 +153,14 @@ typedef struct {
*/ */
typedef struct { typedef struct {
ssize_t (*ct_ulaw)(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 *, 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 *, 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 *, 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 *, 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 *, 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 *, 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 *, 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; } TRANS;
struct sound_settings { struct sound_settings {
......
...@@ -326,12 +326,12 @@ extern int daca_leave_sleep(void); ...@@ -326,12 +326,12 @@ extern int daca_leave_sleep(void);
#undef IOCTL_OUT #undef IOCTL_OUT
#define IOCTL_IN(arg, ret) \ #define IOCTL_IN(arg, ret) \
rc = get_user(ret, (int *)(arg)); \ rc = get_user(ret, (int __user *)(arg)); \
if (rc) break; if (rc) break;
#define IOCTL_OUT(arg, ret) \ #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); return value < 0 ? value : put_user(value, addr);
} }
...@@ -514,6 +514,7 @@ tas_set_frame_rate(void) ...@@ -514,6 +514,7 @@ tas_set_frame_rate(void)
static int static int
tas_mixer_ioctl(u_int cmd, u_long arg) tas_mixer_ioctl(u_int cmd, u_long arg)
{ {
int __user *argp = (int __user *)arg;
int data; int data;
int rc; int rc;
...@@ -524,16 +525,16 @@ tas_mixer_ioctl(u_int cmd, u_long arg) ...@@ -524,16 +525,16 @@ tas_mixer_ioctl(u_int cmd, u_long arg)
if ((cmd & ~0xff) == MIXER_WRITE(0) && if ((cmd & ~0xff) == MIXER_WRITE(0) &&
tas_supported_mixers() & (1<<(cmd & 0xff))) { tas_supported_mixers() & (1<<(cmd & 0xff))) {
rc = get_user(data, (int *)(arg)); rc = get_user(data, argp);
if (rc<0) return rc; if (rc<0) return rc;
tas_set_mixer_level(cmd & 0xff, data); tas_set_mixer_level(cmd & 0xff, data);
tas_get_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) && if ((cmd & ~0xff) == MIXER_READ(0) &&
tas_supported_mixers() & (1<<(cmd & 0xff))) { tas_supported_mixers() & (1<<(cmd & 0xff))) {
tas_get_mixer_level(cmd & 0xff, &data); tas_get_mixer_level(cmd & 0xff, &data);
return ioctl_return2((int *)(arg), data); return ioctl_return2(argp, data);
} }
switch(cmd) { switch(cmd) {
......
...@@ -279,11 +279,11 @@ static int sound_set_stereo(int stereo) ...@@ -279,11 +279,11 @@ static int sound_set_stereo(int stereo)
return 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[], size_t userCount, u_char frame[],
ssize_t *frameUsed, ssize_t frameLeft) 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) { switch (dmasound.soft.format) {
case AFMT_MU_LAW: case AFMT_MU_LAW:
...@@ -361,7 +361,7 @@ static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd, ...@@ -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.id, dmasound.mach.name2, sizeof(info.id));
strlcpy(info.name, dmasound.mach.name2, sizeof(info.name)); strlcpy(info.name, dmasound.mach.name2, sizeof(info.name));
info.modify_counter = mixer.modify_counter; 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 -EFAULT;
return 0; return 0;
} }
...@@ -546,7 +546,7 @@ static inline void sq_play(void) ...@@ -546,7 +546,7 @@ static inline void sq_play(void)
dmasound.mach.play(); 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) loff_t *ppos)
{ {
ssize_t uWritten = 0; ssize_t uWritten = 0;
...@@ -703,7 +703,7 @@ static unsigned int sq_poll(struct file *file, struct poll_table_struct *wait) ...@@ -703,7 +703,7 @@ static unsigned int sq_poll(struct file *file, struct poll_table_struct *wait)
* it and restart the DMA. * 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) loff_t *ppos)
{ {
...@@ -1321,7 +1321,7 @@ static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd, ...@@ -1321,7 +1321,7 @@ static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
info.fragstotal = write_sq.max_active; info.fragstotal = write_sq.max_active;
info.fragsize = write_sq.user_frag_size; info.fragsize = write_sq.user_frag_size;
info.bytes = info.fragments * info.fragsize; 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 -EFAULT;
return 0; return 0;
} else } else
...@@ -1547,7 +1547,7 @@ static int state_release(struct inode *inode, struct file *file) ...@@ -1547,7 +1547,7 @@ static int state_release(struct inode *inode, struct file *file)
return 0; 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) loff_t *ppos)
{ {
int n = state.len - state.ptr; int n = state.len - state.ptr;
......
...@@ -452,8 +452,9 @@ tas3001c_eq_rw( struct tas3001c_data_t *self, ...@@ -452,8 +452,9 @@ tas3001c_eq_rw( struct tas3001c_data_t *self,
{ {
int rc; int rc;
struct tas_biquad_ctrl_t biquad; 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; return -EFAULT;
} }
...@@ -466,7 +467,7 @@ tas3001c_eq_rw( struct tas3001c_data_t *self, ...@@ -466,7 +467,7 @@ tas3001c_eq_rw( struct tas3001c_data_t *self,
rc=tas3001c_read_biquad(self, biquad.channel, biquad.filter, &biquad.data); rc=tas3001c_read_biquad(self, biquad.channel, biquad.filter, &biquad.data);
if (rc != 0) return rc; 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; return -EFAULT;
} }
...@@ -485,27 +486,21 @@ tas3001c_eq_list_rw( struct tas3001c_data_t *self, ...@@ -485,27 +486,21 @@ tas3001c_eq_list_rw( struct tas3001c_data_t *self,
int i,j; int i,j;
char sync_required[2][6]; char sync_required[2][6];
struct tas_biquad_ctrl_t biquad; struct tas_biquad_ctrl_t biquad;
struct tas_biquad_ctrl_list_t __user *argp = (void __user *)arg;
memset(sync_required,0,sizeof(sync_required)); memset(sync_required,0,sizeof(sync_required));
if (copy_from_user((void *)&filter_count, if (copy_from_user(&filter_count, &argp->filter_count, sizeof(int)))
(const void *)arg + offsetof(struct tas_biquad_ctrl_list_t,filter_count),
sizeof(int))) {
return -EFAULT; return -EFAULT;
}
if (copy_from_user((void *)&flags, if (copy_from_user(&flags, &argp->flags, sizeof(int)))
(const void *)arg + offsetof(struct tas_biquad_ctrl_list_t,flags),
sizeof(int))) {
return -EFAULT; return -EFAULT;
}
if (cmd & SIOC_IN) { if (cmd & SIOC_IN) {
} }
for (i=0; i < filter_count; i++) { for (i=0; i < filter_count; i++) {
if (copy_from_user((void *)&biquad, if (copy_from_user(&biquad, &argp->biquads[i],
(const void *)arg + offsetof(struct tas_biquad_ctrl_list_t, biquads[i]),
sizeof(struct tas_biquad_ctrl_t))) { sizeof(struct tas_biquad_ctrl_t))) {
return -EFAULT; return -EFAULT;
} }
...@@ -520,8 +515,7 @@ tas3001c_eq_list_rw( struct tas3001c_data_t *self, ...@@ -520,8 +515,7 @@ tas3001c_eq_list_rw( struct tas3001c_data_t *self,
rc=tas3001c_read_biquad(self, biquad.channel, biquad.filter, &biquad.data); rc=tas3001c_read_biquad(self, biquad.channel, biquad.filter, &biquad.data);
if (rc != 0) return rc; if (rc != 0) return rc;
if (copy_to_user((void *)arg + offsetof(struct tas_biquad_ctrl_list_t, biquads[i]), if (copy_to_user(&argp->biquads[i], &biquad,
(const void *)&biquad,
sizeof(struct tas_biquad_ctrl_t))) { sizeof(struct tas_biquad_ctrl_t))) {
return -EFAULT; return -EFAULT;
} }
...@@ -596,12 +590,10 @@ tas3001c_drce_rw( struct tas3001c_data_t *self, ...@@ -596,12 +590,10 @@ tas3001c_drce_rw( struct tas3001c_data_t *self,
{ {
int rc; int rc;
struct tas_drce_ctrl_t drce_ctrl; struct tas_drce_ctrl_t drce_ctrl;
void __user *argp = (void __user *)arg;
if (copy_from_user((void *)&drce_ctrl, if (copy_from_user(&drce_ctrl, argp, sizeof(struct tas_drce_ctrl_t)))
(const void *)arg,
sizeof(struct tas_drce_ctrl_t))) {
return -EFAULT; return -EFAULT;
}
#ifdef DEBUG_DRCE #ifdef DEBUG_DRCE
printk("DRCE IOCTL: input [ FLAGS:%x ENABLE:%x THRESH:%x\n", printk("DRCE IOCTL: input [ FLAGS:%x ENABLE:%x THRESH:%x\n",
...@@ -623,8 +615,7 @@ tas3001c_drce_rw( struct tas3001c_data_t *self, ...@@ -623,8 +615,7 @@ tas3001c_drce_rw( struct tas3001c_data_t *self,
if (drce_ctrl.flags & TAS_DRCE_THRESHOLD) if (drce_ctrl.flags & TAS_DRCE_THRESHOLD)
drce_ctrl.data.threshold = self->drce_state.threshold; drce_ctrl.data.threshold = self->drce_state.threshold;
if (copy_to_user((void *)arg, if (copy_to_user(argp, &drce_ctrl,
(const void *)&drce_ctrl,
sizeof(struct tas_drce_ctrl_t))) { sizeof(struct tas_drce_ctrl_t))) {
return -EFAULT; return -EFAULT;
} }
...@@ -703,6 +694,7 @@ tas3001c_device_ioctl( struct tas3001c_data_t *self, ...@@ -703,6 +694,7 @@ tas3001c_device_ioctl( struct tas3001c_data_t *self,
u_int cmd, u_int cmd,
u_long arg) u_long arg)
{ {
uint __user *argp = (void __user *)arg;
switch (cmd) { switch (cmd) {
case TAS_READ_EQ: case TAS_READ_EQ:
case TAS_WRITE_EQ: case TAS_WRITE_EQ:
...@@ -713,11 +705,11 @@ tas3001c_device_ioctl( struct tas3001c_data_t *self, ...@@ -713,11 +705,11 @@ tas3001c_device_ioctl( struct tas3001c_data_t *self,
return tas3001c_eq_list_rw(self, cmd, arg); return tas3001c_eq_list_rw(self, cmd, arg);
case TAS_READ_EQ_FILTER_COUNT: case TAS_READ_EQ_FILTER_COUNT:
put_user(TAS3001C_BIQUAD_FILTER_COUNT, (uint *)(arg)); put_user(TAS3001C_BIQUAD_FILTER_COUNT, argp);
return 0; return 0;
case TAS_READ_EQ_CHANNEL_COUNT: case TAS_READ_EQ_CHANNEL_COUNT:
put_user(TAS3001C_BIQUAD_CHANNEL_COUNT, (uint *)(arg)); put_user(TAS3001C_BIQUAD_CHANNEL_COUNT, argp);
return 0; return 0;
case TAS_READ_DRCE: case TAS_READ_DRCE:
...@@ -725,15 +717,14 @@ tas3001c_device_ioctl( struct tas3001c_data_t *self, ...@@ -725,15 +717,14 @@ tas3001c_device_ioctl( struct tas3001c_data_t *self,
return tas3001c_drce_rw(self, cmd, arg); return tas3001c_drce_rw(self, cmd, arg);
case TAS_READ_DRCE_CAPS: 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; return 0;
case TAS_READ_DRCE_MIN: case TAS_READ_DRCE_MIN:
case TAS_READ_DRCE_MAX: { case TAS_READ_DRCE_MAX: {
struct tas_drce_ctrl_t drce_ctrl; struct tas_drce_ctrl_t drce_ctrl;
if (copy_from_user((void *)&drce_ctrl, if (copy_from_user(&drce_ctrl, argp,
(const void *)arg,
sizeof(struct tas_drce_ctrl_t))) { sizeof(struct tas_drce_ctrl_t))) {
return -EFAULT; return -EFAULT;
} }
...@@ -746,8 +737,7 @@ tas3001c_device_ioctl( struct tas3001c_data_t *self, ...@@ -746,8 +737,7 @@ tas3001c_device_ioctl( struct tas3001c_data_t *self,
} }
} }
if (copy_to_user((void *)arg, if (copy_to_user(argp, &drce_ctrl,
(const void *)&drce_ctrl,
sizeof(struct tas_drce_ctrl_t))) { sizeof(struct tas_drce_ctrl_t))) {
return -EFAULT; return -EFAULT;
} }
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
static struct tas_drce_t eqp_0e_2_1_drce = { static struct tas_drce_t eqp_0e_2_1_drce = {
.enable = 1, .enable = 1,
.above { .val = 3.0 * (1<<8), .expand = 0 }, .above = { .val = 3.0 * (1<<8), .expand = 0 },
.below { .val = 1.0 * (1<<8), .expand = 0 }, .below = { .val = 1.0 * (1<<8), .expand = 0 },
.threshold -15.33 * (1<<8), .threshold = -15.33 * (1<<8),
.energy 2.4 * (1<<12), .energy = 2.4 * (1<<12),
.attack 0.013 * (1<<12), .attack = 0.013 * (1<<12),
.decay 0.212 * (1<<12), .decay = 0.212 * (1<<12),
}; };
static struct tas_biquad_ctrl_t eqp_0e_2_1_biquads[]={ static struct tas_biquad_ctrl_t eqp_0e_2_1_biquads[]={
......
...@@ -635,10 +635,11 @@ tas3004_eq_rw( struct tas3004_data_t *self, ...@@ -635,10 +635,11 @@ tas3004_eq_rw( struct tas3004_data_t *self,
u_int cmd, u_int cmd,
u_long arg) u_long arg)
{ {
void __user *argp = (void __user *)arg;
int rc; int rc;
struct tas_biquad_ctrl_t biquad; 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; return -EFAULT;
} }
...@@ -651,7 +652,7 @@ tas3004_eq_rw( struct tas3004_data_t *self, ...@@ -651,7 +652,7 @@ tas3004_eq_rw( struct tas3004_data_t *self,
rc=tas3004_read_biquad(self, biquad.channel, biquad.filter, &biquad.data); rc=tas3004_read_biquad(self, biquad.channel, biquad.filter, &biquad.data);
if (rc != 0) return rc; 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; return -EFAULT;
} }
...@@ -670,27 +671,21 @@ tas3004_eq_list_rw( struct tas3004_data_t *self, ...@@ -670,27 +671,21 @@ tas3004_eq_list_rw( struct tas3004_data_t *self,
int i,j; int i,j;
char sync_required[TAS3004_BIQUAD_CHANNEL_COUNT][TAS3004_BIQUAD_FILTER_COUNT]; char sync_required[TAS3004_BIQUAD_CHANNEL_COUNT][TAS3004_BIQUAD_FILTER_COUNT];
struct tas_biquad_ctrl_t biquad; struct tas_biquad_ctrl_t biquad;
struct tas_biquad_ctrl_list_t __user *argp = (void __user *)arg;
memset(sync_required,0,sizeof(sync_required)); memset(sync_required,0,sizeof(sync_required));
if (copy_from_user((void *)&filter_count, if (copy_from_user(&filter_count, &argp->filter_count, sizeof(int)))
(const void *)arg + offsetof(struct tas_biquad_ctrl_list_t,filter_count),
sizeof(int))) {
return -EFAULT; return -EFAULT;
}
if (copy_from_user((void *)&flags, if (copy_from_user(&flags, &argp->flags, sizeof(int)))
(const void *)arg + offsetof(struct tas_biquad_ctrl_list_t,flags),
sizeof(int))) {
return -EFAULT; return -EFAULT;
}
if (cmd & SIOC_IN) { if (cmd & SIOC_IN) {
} }
for (i=0; i < filter_count; i++) { for (i=0; i < filter_count; i++) {
if (copy_from_user((void *)&biquad, if (copy_from_user(&biquad, &argp->biquads[i],
(const void *)arg + offsetof(struct tas_biquad_ctrl_list_t, biquads[i]),
sizeof(struct tas_biquad_ctrl_t))) { sizeof(struct tas_biquad_ctrl_t))) {
return -EFAULT; return -EFAULT;
} }
...@@ -705,8 +700,7 @@ tas3004_eq_list_rw( struct tas3004_data_t *self, ...@@ -705,8 +700,7 @@ tas3004_eq_list_rw( struct tas3004_data_t *self,
rc=tas3004_read_biquad(self, biquad.channel, biquad.filter, &biquad.data); rc=tas3004_read_biquad(self, biquad.channel, biquad.filter, &biquad.data);
if (rc != 0) return rc; if (rc != 0) return rc;
if (copy_to_user((void *)arg + offsetof(struct tas_biquad_ctrl_list_t, biquads[i]), if (copy_to_user(&argp->biquads[i], &biquad,
(const void *)&biquad,
sizeof(struct tas_biquad_ctrl_t))) { sizeof(struct tas_biquad_ctrl_t))) {
return -EFAULT; return -EFAULT;
} }
...@@ -840,12 +834,10 @@ tas3004_drce_rw( struct tas3004_data_t *self, ...@@ -840,12 +834,10 @@ tas3004_drce_rw( struct tas3004_data_t *self,
{ {
int rc; int rc;
struct tas_drce_ctrl_t drce_ctrl; struct tas_drce_ctrl_t drce_ctrl;
void __user *argp = (void __user *)arg;
if (copy_from_user((void *)&drce_ctrl, if (copy_from_user(&drce_ctrl, argp, sizeof(struct tas_drce_ctrl_t)))
(const void *)arg,
sizeof(struct tas_drce_ctrl_t))) {
return -EFAULT; return -EFAULT;
}
#ifdef DEBUG_DRCE #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", 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, ...@@ -880,8 +872,7 @@ tas3004_drce_rw( struct tas3004_data_t *self,
if (drce_ctrl.flags & TAS_DRCE_DECAY) if (drce_ctrl.flags & TAS_DRCE_DECAY)
drce_ctrl.data.decay = self->drce_state.decay; drce_ctrl.data.decay = self->drce_state.decay;
if (copy_to_user((void *)arg, if (copy_to_user(argp, &drce_ctrl,
(const void *)&drce_ctrl,
sizeof(struct tas_drce_ctrl_t))) { sizeof(struct tas_drce_ctrl_t))) {
return -EFAULT; return -EFAULT;
} }
...@@ -952,6 +943,7 @@ tas3004_device_ioctl( struct tas3004_data_t *self, ...@@ -952,6 +943,7 @@ tas3004_device_ioctl( struct tas3004_data_t *self,
u_int cmd, u_int cmd,
u_long arg) u_long arg)
{ {
uint __user *argp = (void __user *)arg;
switch (cmd) { switch (cmd) {
case TAS_READ_EQ: case TAS_READ_EQ:
case TAS_WRITE_EQ: case TAS_WRITE_EQ:
...@@ -962,11 +954,11 @@ tas3004_device_ioctl( struct tas3004_data_t *self, ...@@ -962,11 +954,11 @@ tas3004_device_ioctl( struct tas3004_data_t *self,
return tas3004_eq_list_rw(self, cmd, arg); return tas3004_eq_list_rw(self, cmd, arg);
case TAS_READ_EQ_FILTER_COUNT: case TAS_READ_EQ_FILTER_COUNT:
put_user(TAS3004_BIQUAD_FILTER_COUNT, (uint *)(arg)); put_user(TAS3004_BIQUAD_FILTER_COUNT, argp);
return 0; return 0;
case TAS_READ_EQ_CHANNEL_COUNT: case TAS_READ_EQ_CHANNEL_COUNT:
put_user(TAS3004_BIQUAD_CHANNEL_COUNT, (uint *)(arg)); put_user(TAS3004_BIQUAD_CHANNEL_COUNT, argp);
return 0; return 0;
case TAS_READ_DRCE: case TAS_READ_DRCE:
...@@ -981,7 +973,7 @@ tas3004_device_ioctl( struct tas3004_data_t *self, ...@@ -981,7 +973,7 @@ tas3004_device_ioctl( struct tas3004_data_t *self,
TAS_DRCE_ENERGY | TAS_DRCE_ENERGY |
TAS_DRCE_ATTACK | TAS_DRCE_ATTACK |
TAS_DRCE_DECAY, TAS_DRCE_DECAY,
(uint *)(arg)); argp);
return 0; return 0;
case TAS_READ_DRCE_MIN: case TAS_READ_DRCE_MIN:
...@@ -989,8 +981,7 @@ tas3004_device_ioctl( struct tas3004_data_t *self, ...@@ -989,8 +981,7 @@ tas3004_device_ioctl( struct tas3004_data_t *self,
struct tas_drce_ctrl_t drce_ctrl; struct tas_drce_ctrl_t drce_ctrl;
const struct tas_drce_t *drce_copy; const struct tas_drce_t *drce_copy;
if (copy_from_user((void *)&drce_ctrl, if (copy_from_user(&drce_ctrl, argp,
(const void *)arg,
sizeof(struct tas_drce_ctrl_t))) { sizeof(struct tas_drce_ctrl_t))) {
return -EFAULT; return -EFAULT;
} }
...@@ -1020,8 +1011,7 @@ tas3004_device_ioctl( struct tas3004_data_t *self, ...@@ -1020,8 +1011,7 @@ tas3004_device_ioctl( struct tas3004_data_t *self,
drce_ctrl.data.decay=drce_copy->decay; drce_ctrl.data.decay=drce_copy->decay;
} }
if (copy_to_user((void *)arg, if (copy_to_user(argp, &drce_ctrl,
(const void *)&drce_ctrl,
sizeof(struct tas_drce_ctrl_t))) { sizeof(struct tas_drce_ctrl_t))) {
return -EFAULT; return -EFAULT;
} }
......
This diff is collapsed.
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