Commit ec7dea48 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: cyclades annotation

parent c5465a54
...@@ -676,8 +676,6 @@ static char rcsid[] = ...@@ -676,8 +676,6 @@ static char rcsid[] =
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#define cy_put_user put_user
static void cy_throttle (struct tty_struct *tty); static void cy_throttle (struct tty_struct *tty);
static void cy_send_xchar (struct tty_struct *tty, char ch); static void cy_send_xchar (struct tty_struct *tty, char ch);
...@@ -3536,7 +3534,7 @@ set_line_char(struct cyclades_port * info) ...@@ -3536,7 +3534,7 @@ set_line_char(struct cyclades_port * info)
static int static int
get_serial_info(struct cyclades_port * info, get_serial_info(struct cyclades_port * info,
struct serial_struct * retinfo) struct serial_struct __user * retinfo)
{ {
struct serial_struct tmp; struct serial_struct tmp;
struct cyclades_card *cinfo = &cy_card[info->card]; struct cyclades_card *cinfo = &cy_card[info->card];
...@@ -3559,7 +3557,7 @@ get_serial_info(struct cyclades_port * info, ...@@ -3559,7 +3557,7 @@ get_serial_info(struct cyclades_port * info,
static int static int
set_serial_info(struct cyclades_port * info, set_serial_info(struct cyclades_port * info,
struct serial_struct * new_info) struct serial_struct __user * new_info)
{ {
struct serial_struct new_serial; struct serial_struct new_serial;
struct cyclades_port old_info; struct cyclades_port old_info;
...@@ -3613,7 +3611,7 @@ set_serial_info(struct cyclades_port * info, ...@@ -3613,7 +3611,7 @@ set_serial_info(struct cyclades_port * info,
* transmit holding register is empty. This functionality * transmit holding register is empty. This functionality
* allows an RS485 driver to be written in user space. * allows an RS485 driver to be written in user space.
*/ */
static int get_lsr_info(struct cyclades_port *info, unsigned int *value) static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
{ {
int card, chip, channel, index; int card, chip, channel, index;
unsigned char status; unsigned char status;
...@@ -3638,7 +3636,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int *value) ...@@ -3638,7 +3636,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int *value)
/* Not supported yet */ /* Not supported yet */
return -EINVAL; return -EINVAL;
} }
return cy_put_user(result, (unsigned long *) value); return put_user(result, (unsigned long __user *) value);
} }
static int static int
...@@ -3916,7 +3914,7 @@ cy_break(struct tty_struct *tty, int break_state) ...@@ -3916,7 +3914,7 @@ cy_break(struct tty_struct *tty, int break_state)
} /* cy_break */ } /* cy_break */
static int static int
get_mon_info(struct cyclades_port * info, struct cyclades_monitor * mon) get_mon_info(struct cyclades_port * info, struct cyclades_monitor __user * mon)
{ {
if(copy_to_user(mon, &info->mon, sizeof(struct cyclades_monitor))) if(copy_to_user(mon, &info->mon, sizeof(struct cyclades_monitor)))
...@@ -3961,7 +3959,7 @@ set_threshold(struct cyclades_port * info, unsigned long value) ...@@ -3961,7 +3959,7 @@ set_threshold(struct cyclades_port * info, unsigned long value)
static int static int
get_threshold(struct cyclades_port * info, unsigned long *value) get_threshold(struct cyclades_port * info, unsigned long __user *value)
{ {
unsigned char *base_addr; unsigned char *base_addr;
int card,channel,chip,index; int card,channel,chip,index;
...@@ -3978,7 +3976,7 @@ get_threshold(struct cyclades_port * info, unsigned long *value) ...@@ -3978,7 +3976,7 @@ get_threshold(struct cyclades_port * info, unsigned long *value)
+ (cy_chip_offset[chip]<<index)); + (cy_chip_offset[chip]<<index));
tmp = cy_readb(base_addr+(CyCOR3<<index)) & CyREC_FIFO; tmp = cy_readb(base_addr+(CyCOR3<<index)) & CyREC_FIFO;
return cy_put_user(tmp,value); return put_user(tmp,value);
} else { } else {
// Nothing to do! // Nothing to do!
return 0; return 0;
...@@ -3995,9 +3993,9 @@ set_default_threshold(struct cyclades_port * info, unsigned long value) ...@@ -3995,9 +3993,9 @@ set_default_threshold(struct cyclades_port * info, unsigned long value)
static int static int
get_default_threshold(struct cyclades_port * info, unsigned long *value) get_default_threshold(struct cyclades_port * info, unsigned long __user *value)
{ {
return cy_put_user(info->default_threshold,value); return put_user(info->default_threshold,value);
}/* get_default_threshold */ }/* get_default_threshold */
...@@ -4029,7 +4027,7 @@ set_timeout(struct cyclades_port * info, unsigned long value) ...@@ -4029,7 +4027,7 @@ set_timeout(struct cyclades_port * info, unsigned long value)
static int static int
get_timeout(struct cyclades_port * info, unsigned long *value) get_timeout(struct cyclades_port * info, unsigned long __user *value)
{ {
unsigned char *base_addr; unsigned char *base_addr;
int card,channel,chip,index; int card,channel,chip,index;
...@@ -4046,7 +4044,7 @@ get_timeout(struct cyclades_port * info, unsigned long *value) ...@@ -4046,7 +4044,7 @@ get_timeout(struct cyclades_port * info, unsigned long *value)
+ (cy_chip_offset[chip]<<index)); + (cy_chip_offset[chip]<<index));
tmp = cy_readb(base_addr+(CyRTPR<<index)); tmp = cy_readb(base_addr+(CyRTPR<<index));
return cy_put_user(tmp,value); return put_user(tmp,value);
} else { } else {
// Nothing to do! // Nothing to do!
return 0; return 0;
...@@ -4063,9 +4061,9 @@ set_default_timeout(struct cyclades_port * info, unsigned long value) ...@@ -4063,9 +4061,9 @@ set_default_timeout(struct cyclades_port * info, unsigned long value)
static int static int
get_default_timeout(struct cyclades_port * info, unsigned long *value) get_default_timeout(struct cyclades_port * info, unsigned long __user *value)
{ {
return cy_put_user(info->default_timeout,value); return put_user(info->default_timeout,value);
}/* get_default_timeout */ }/* get_default_timeout */
/* /*
...@@ -4079,9 +4077,10 @@ cy_ioctl(struct tty_struct *tty, struct file * file, ...@@ -4079,9 +4077,10 @@ cy_ioctl(struct tty_struct *tty, struct file * file,
{ {
struct cyclades_port * info = (struct cyclades_port *)tty->driver_data; struct cyclades_port * info = (struct cyclades_port *)tty->driver_data;
struct cyclades_icount cprev, cnow; /* kernel counter temps */ struct cyclades_icount cprev, cnow; /* kernel counter temps */
struct serial_icounter_struct *p_cuser; /* user space */ struct serial_icounter_struct __user *p_cuser; /* user space */
int ret_val = 0; int ret_val = 0;
unsigned long flags; unsigned long flags;
void __user *argp = (void __user *)arg;
if (serial_paranoia_check(info, tty->name, "cy_ioctl")) if (serial_paranoia_check(info, tty->name, "cy_ioctl"))
return -ENODEV; return -ENODEV;
...@@ -4093,31 +4092,31 @@ cy_ioctl(struct tty_struct *tty, struct file * file, ...@@ -4093,31 +4092,31 @@ cy_ioctl(struct tty_struct *tty, struct file * file,
switch (cmd) { switch (cmd) {
case CYGETMON: case CYGETMON:
ret_val = get_mon_info(info, (struct cyclades_monitor *)arg); ret_val = get_mon_info(info, argp);
break; break;
case CYGETTHRESH: case CYGETTHRESH:
ret_val = get_threshold(info, (unsigned long *)arg); ret_val = get_threshold(info, argp);
break; break;
case CYSETTHRESH: case CYSETTHRESH:
ret_val = set_threshold(info, (unsigned long)arg); ret_val = set_threshold(info, arg);
break; break;
case CYGETDEFTHRESH: case CYGETDEFTHRESH:
ret_val = get_default_threshold(info, (unsigned long *)arg); ret_val = get_default_threshold(info, argp);
break; break;
case CYSETDEFTHRESH: case CYSETDEFTHRESH:
ret_val = set_default_threshold(info, (unsigned long)arg); ret_val = set_default_threshold(info, arg);
break; break;
case CYGETTIMEOUT: case CYGETTIMEOUT:
ret_val = get_timeout(info, (unsigned long *)arg); ret_val = get_timeout(info, argp);
break; break;
case CYSETTIMEOUT: case CYSETTIMEOUT:
ret_val = set_timeout(info, (unsigned long)arg); ret_val = set_timeout(info, arg);
break; break;
case CYGETDEFTIMEOUT: case CYGETDEFTIMEOUT:
ret_val = get_default_timeout(info, (unsigned long *)arg); ret_val = get_default_timeout(info, argp);
break; break;
case CYSETDEFTIMEOUT: case CYSETDEFTIMEOUT:
ret_val = set_default_timeout(info, (unsigned long)arg); ret_val = set_default_timeout(info, arg);
break; break;
case CYSETRFLOW: case CYSETRFLOW:
info->rflow = (int)arg; info->rflow = (int)arg;
...@@ -4134,7 +4133,7 @@ cy_ioctl(struct tty_struct *tty, struct file * file, ...@@ -4134,7 +4133,7 @@ cy_ioctl(struct tty_struct *tty, struct file * file,
ret_val = info->rtsdtr_inv; ret_val = info->rtsdtr_inv;
break; break;
case CYGETCARDINFO: case CYGETCARDINFO:
if (copy_to_user((void *)arg, (void *)&cy_card[info->card], if (copy_to_user(argp, &cy_card[info->card],
sizeof (struct cyclades_card))) { sizeof (struct cyclades_card))) {
ret_val = -EFAULT; ret_val = -EFAULT;
break; break;
...@@ -4161,13 +4160,13 @@ cy_ioctl(struct tty_struct *tty, struct file * file, ...@@ -4161,13 +4160,13 @@ cy_ioctl(struct tty_struct *tty, struct file * file,
ret_val = info->closing_wait / (HZ/100); ret_val = info->closing_wait / (HZ/100);
break; break;
case TIOCGSERIAL: case TIOCGSERIAL:
ret_val = get_serial_info(info, (struct serial_struct *) arg); ret_val = get_serial_info(info, argp);
break; break;
case TIOCSSERIAL: case TIOCSSERIAL:
ret_val = set_serial_info(info, (struct serial_struct *) arg); ret_val = set_serial_info(info, argp);
break; break;
case TIOCSERGETLSR: /* Get line status register */ case TIOCSERGETLSR: /* Get line status register */
ret_val = get_lsr_info(info, (unsigned int *) arg); ret_val = get_lsr_info(info, argp);
break; break;
/* /*
* Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change
...@@ -4215,7 +4214,7 @@ cy_ioctl(struct tty_struct *tty, struct file * file, ...@@ -4215,7 +4214,7 @@ cy_ioctl(struct tty_struct *tty, struct file * file,
CY_LOCK(info, flags); CY_LOCK(info, flags);
cnow = info->icount; cnow = info->icount;
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
p_cuser = (struct serial_icounter_struct *) arg; p_cuser = argp;
ret_val = put_user(cnow.cts, &p_cuser->cts); ret_val = put_user(cnow.cts, &p_cuser->cts);
if (ret_val) return ret_val; if (ret_val) return ret_val;
ret_val = put_user(cnow.dsr, &p_cuser->dsr); ret_val = put_user(cnow.dsr, &p_cuser->dsr);
......
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