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[] =
#include <linux/stat.h>
#include <linux/proc_fs.h>
#define cy_put_user put_user
static void cy_throttle (struct tty_struct *tty);
static void cy_send_xchar (struct tty_struct *tty, char ch);
......@@ -3536,7 +3534,7 @@ set_line_char(struct cyclades_port * info)
static int
get_serial_info(struct cyclades_port * info,
struct serial_struct * retinfo)
struct serial_struct __user * retinfo)
{
struct serial_struct tmp;
struct cyclades_card *cinfo = &cy_card[info->card];
......@@ -3559,7 +3557,7 @@ get_serial_info(struct cyclades_port * info,
static int
set_serial_info(struct cyclades_port * info,
struct serial_struct * new_info)
struct serial_struct __user * new_info)
{
struct serial_struct new_serial;
struct cyclades_port old_info;
......@@ -3613,7 +3611,7 @@ set_serial_info(struct cyclades_port * info,
* transmit holding register is empty. This functionality
* 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;
unsigned char status;
......@@ -3638,7 +3636,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int *value)
/* Not supported yet */
return -EINVAL;
}
return cy_put_user(result, (unsigned long *) value);
return put_user(result, (unsigned long __user *) value);
}
static int
......@@ -3916,7 +3914,7 @@ cy_break(struct tty_struct *tty, int break_state)
} /* cy_break */
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)))
......@@ -3961,7 +3959,7 @@ set_threshold(struct cyclades_port * info, unsigned long value)
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;
int card,channel,chip,index;
......@@ -3978,7 +3976,7 @@ get_threshold(struct cyclades_port * info, unsigned long *value)
+ (cy_chip_offset[chip]<<index));
tmp = cy_readb(base_addr+(CyCOR3<<index)) & CyREC_FIFO;
return cy_put_user(tmp,value);
return put_user(tmp,value);
} else {
// Nothing to do!
return 0;
......@@ -3995,9 +3993,9 @@ set_default_threshold(struct cyclades_port * info, unsigned long value)
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 */
......@@ -4029,7 +4027,7 @@ set_timeout(struct cyclades_port * info, unsigned long value)
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;
int card,channel,chip,index;
......@@ -4046,7 +4044,7 @@ get_timeout(struct cyclades_port * info, unsigned long *value)
+ (cy_chip_offset[chip]<<index));
tmp = cy_readb(base_addr+(CyRTPR<<index));
return cy_put_user(tmp,value);
return put_user(tmp,value);
} else {
// Nothing to do!
return 0;
......@@ -4063,9 +4061,9 @@ set_default_timeout(struct cyclades_port * info, unsigned long value)
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 */
/*
......@@ -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_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;
unsigned long flags;
void __user *argp = (void __user *)arg;
if (serial_paranoia_check(info, tty->name, "cy_ioctl"))
return -ENODEV;
......@@ -4093,31 +4092,31 @@ cy_ioctl(struct tty_struct *tty, struct file * file,
switch (cmd) {
case CYGETMON:
ret_val = get_mon_info(info, (struct cyclades_monitor *)arg);
ret_val = get_mon_info(info, argp);
break;
case CYGETTHRESH:
ret_val = get_threshold(info, (unsigned long *)arg);
ret_val = get_threshold(info, argp);
break;
case CYSETTHRESH:
ret_val = set_threshold(info, (unsigned long)arg);
ret_val = set_threshold(info, arg);
break;
case CYGETDEFTHRESH:
ret_val = get_default_threshold(info, (unsigned long *)arg);
ret_val = get_default_threshold(info, argp);
break;
case CYSETDEFTHRESH:
ret_val = set_default_threshold(info, (unsigned long)arg);
ret_val = set_default_threshold(info, arg);
break;
case CYGETTIMEOUT:
ret_val = get_timeout(info, (unsigned long *)arg);
ret_val = get_timeout(info, argp);
break;
case CYSETTIMEOUT:
ret_val = set_timeout(info, (unsigned long)arg);
ret_val = set_timeout(info, arg);
break;
case CYGETDEFTIMEOUT:
ret_val = get_default_timeout(info, (unsigned long *)arg);
ret_val = get_default_timeout(info, argp);
break;
case CYSETDEFTIMEOUT:
ret_val = set_default_timeout(info, (unsigned long)arg);
ret_val = set_default_timeout(info, arg);
break;
case CYSETRFLOW:
info->rflow = (int)arg;
......@@ -4134,7 +4133,7 @@ cy_ioctl(struct tty_struct *tty, struct file * file,
ret_val = info->rtsdtr_inv;
break;
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))) {
ret_val = -EFAULT;
break;
......@@ -4161,13 +4160,13 @@ cy_ioctl(struct tty_struct *tty, struct file * file,
ret_val = info->closing_wait / (HZ/100);
break;
case TIOCGSERIAL:
ret_val = get_serial_info(info, (struct serial_struct *) arg);
ret_val = get_serial_info(info, argp);
break;
case TIOCSSERIAL:
ret_val = set_serial_info(info, (struct serial_struct *) arg);
ret_val = set_serial_info(info, argp);
break;
case TIOCSERGETLSR: /* Get line status register */
ret_val = get_lsr_info(info, (unsigned int *) arg);
ret_val = get_lsr_info(info, argp);
break;
/*
* 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,
CY_LOCK(info, flags);
cnow = info->icount;
CY_UNLOCK(info, flags);
p_cuser = (struct serial_icounter_struct *) arg;
p_cuser = argp;
ret_val = put_user(cnow.cts, &p_cuser->cts);
if (ret_val) return ret_val;
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