Commit 907aff4a authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: aten2011: fix up sparse warnings

This resolves all of the sparse warnings.


Cc: Russell Lang <gsview@ghostgum.com.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a7fefd10
TODO: TODO:
- checkpatch.pl cleanups - checkpatch.pl cleanups
- sparse cleanups
- remove dead and useless code (auditing the tty ioctls to - remove dead and useless code (auditing the tty ioctls to
verify that they really are correct and needed.) verify that they really are correct and needed.)
......
...@@ -246,7 +246,9 @@ static int debug = 0; ...@@ -246,7 +246,9 @@ static int debug = 0;
#define ATEN_CTRL_TIMEOUT 500 #define ATEN_CTRL_TIMEOUT 500
#define VENDOR_READ_LENGTH (0x01) #define VENDOR_READ_LENGTH (0x01)
int RS485mode = 0; //set to 1 for RS485 mode and 0 for RS232 mode /* set to 1 for RS485 mode and 0 for RS232 mode */
/* FIXME make this somehow dynamic and not build time specific */
static int RS485mode = 0;
static struct usb_serial *ATEN2011_get_usb_serial(struct usb_serial_port *port, const static struct usb_serial *ATEN2011_get_usb_serial(struct usb_serial_port *port, const
char *function); char *function);
...@@ -1519,7 +1521,6 @@ static int ATEN2011_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -1519,7 +1521,6 @@ static int ATEN2011_write(struct tty_struct *tty, struct usb_serial_port *port,
int i; int i;
int bytes_sent = 0; int bytes_sent = 0;
int transfer_size; int transfer_size;
int from_user = 0;
int minor; int minor;
struct ATENINTL_port *ATEN2011_port; struct ATENINTL_port *ATEN2011_port;
...@@ -1581,15 +1582,7 @@ static int ATEN2011_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -1581,15 +1582,7 @@ static int ATEN2011_write(struct tty_struct *tty, struct usb_serial_port *port,
} }
transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE); transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE);
if (from_user) {
if (copy_from_user
(urb->transfer_buffer, current_position, transfer_size)) {
bytes_sent = -EFAULT;
goto exit;
}
} else {
memcpy(urb->transfer_buffer, current_position, transfer_size); memcpy(urb->transfer_buffer, current_position, transfer_size);
}
//usb_serial_debug_data (__FILE__, __FUNCTION__, transfer_size, urb->transfer_buffer); //usb_serial_debug_data (__FILE__, __FUNCTION__, transfer_size, urb->transfer_buffer);
/* fill urb with data and submit */ /* fill urb with data and submit */
...@@ -1906,7 +1899,7 @@ static void ATEN2011_set_termios(struct tty_struct *tty, ...@@ -1906,7 +1899,7 @@ static void ATEN2011_set_termios(struct tty_struct *tty,
static int get_lsr_info(struct tty_struct *tty, static int get_lsr_info(struct tty_struct *tty,
struct ATENINTL_port *ATEN2011_port, struct ATENINTL_port *ATEN2011_port,
unsigned int *value) unsigned int __user *value)
{ {
int count; int count;
unsigned int result = 0; unsigned int result = 0;
...@@ -1924,7 +1917,7 @@ static int get_lsr_info(struct tty_struct *tty, ...@@ -1924,7 +1917,7 @@ static int get_lsr_info(struct tty_struct *tty,
static int get_number_bytes_avail(struct tty_struct *tty, static int get_number_bytes_avail(struct tty_struct *tty,
struct ATENINTL_port *ATEN2011_port, struct ATENINTL_port *ATEN2011_port,
unsigned int *value) unsigned int __user *value)
{ {
unsigned int result = 0; unsigned int result = 0;
...@@ -1941,7 +1934,7 @@ static int get_number_bytes_avail(struct tty_struct *tty, ...@@ -1941,7 +1934,7 @@ static int get_number_bytes_avail(struct tty_struct *tty,
} }
static int set_modem_info(struct ATENINTL_port *ATEN2011_port, unsigned int cmd, static int set_modem_info(struct ATENINTL_port *ATEN2011_port, unsigned int cmd,
unsigned int *value) unsigned int __user *value)
{ {
unsigned int mcr; unsigned int mcr;
unsigned int arg; unsigned int arg;
...@@ -2006,7 +1999,7 @@ static int set_modem_info(struct ATENINTL_port *ATEN2011_port, unsigned int cmd, ...@@ -2006,7 +1999,7 @@ static int set_modem_info(struct ATENINTL_port *ATEN2011_port, unsigned int cmd,
} }
static int get_modem_info(struct ATENINTL_port *ATEN2011_port, static int get_modem_info(struct ATENINTL_port *ATEN2011_port,
unsigned int *value) unsigned int __user *value)
{ {
unsigned int result = 0; unsigned int result = 0;
__u16 msr; __u16 msr;
...@@ -2030,7 +2023,7 @@ static int get_modem_info(struct ATENINTL_port *ATEN2011_port, ...@@ -2030,7 +2023,7 @@ static int get_modem_info(struct ATENINTL_port *ATEN2011_port,
} }
static int get_serial_info(struct ATENINTL_port *ATEN2011_port, static int get_serial_info(struct ATENINTL_port *ATEN2011_port,
struct serial_struct *retinfo) struct serial_struct __user *retinfo)
{ {
struct serial_struct tmp; struct serial_struct tmp;
...@@ -2068,8 +2061,7 @@ static int ATEN2011_ioctl(struct tty_struct *tty, struct file *file, ...@@ -2068,8 +2061,7 @@ static int ATEN2011_ioctl(struct tty_struct *tty, struct file *file,
struct async_icount cprev; struct async_icount cprev;
struct serial_icounter_struct icount; struct serial_icounter_struct icount;
int ATENret = 0; int ATENret = 0;
//int retval; unsigned int __user *user_arg = (unsigned int __user *)arg;
//struct tty_ldisc *ld;
//printk("%s - port %d, cmd = 0x%x\n", __FUNCTION__, port->number, cmd); //printk("%s - port %d, cmd = 0x%x\n", __FUNCTION__, port->number, cmd);
if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) { if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
...@@ -2089,19 +2081,17 @@ static int ATEN2011_ioctl(struct tty_struct *tty, struct file *file, ...@@ -2089,19 +2081,17 @@ static int ATEN2011_ioctl(struct tty_struct *tty, struct file *file,
case TIOCINQ: case TIOCINQ:
dbg("%s (%d) TIOCINQ", __FUNCTION__, port->number); dbg("%s (%d) TIOCINQ", __FUNCTION__, port->number);
return get_number_bytes_avail(tty, ATEN2011_port, return get_number_bytes_avail(tty, ATEN2011_port, user_arg);
(unsigned int *)arg);
break; break;
case TIOCOUTQ: case TIOCOUTQ:
dbg("%s (%d) TIOCOUTQ", __FUNCTION__, port->number); dbg("%s (%d) TIOCOUTQ", __FUNCTION__, port->number);
return put_user(ATEN2011_chars_in_buffer(tty), return put_user(ATEN2011_chars_in_buffer(tty), user_arg);
(int __user *)arg);
break; break;
case TIOCSERGETLSR: case TIOCSERGETLSR:
dbg("%s (%d) TIOCSERGETLSR", __FUNCTION__, port->number); dbg("%s (%d) TIOCSERGETLSR", __FUNCTION__, port->number);
return get_lsr_info(tty, ATEN2011_port, (unsigned int *)arg); return get_lsr_info(tty, ATEN2011_port, user_arg);
return 0; return 0;
case TIOCMBIS: case TIOCMBIS:
...@@ -2111,18 +2101,18 @@ static int ATEN2011_ioctl(struct tty_struct *tty, struct file *file, ...@@ -2111,18 +2101,18 @@ static int ATEN2011_ioctl(struct tty_struct *tty, struct file *file,
port->number); port->number);
// printk("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __FUNCTION__, port->number); // printk("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __FUNCTION__, port->number);
ATENret = ATENret =
set_modem_info(ATEN2011_port, cmd, (unsigned int *)arg); set_modem_info(ATEN2011_port, cmd, user_arg);
// printk(" %s: ret:%d\n",__FUNCTION__,ATENret); // printk(" %s: ret:%d\n",__FUNCTION__,ATENret);
return ATENret; return ATENret;
case TIOCMGET: case TIOCMGET:
dbg("%s (%d) TIOCMGET", __FUNCTION__, port->number); dbg("%s (%d) TIOCMGET", __FUNCTION__, port->number);
return get_modem_info(ATEN2011_port, (unsigned int *)arg); return get_modem_info(ATEN2011_port, user_arg);
case TIOCGSERIAL: case TIOCGSERIAL:
dbg("%s (%d) TIOCGSERIAL", __FUNCTION__, port->number); dbg("%s (%d) TIOCGSERIAL", __FUNCTION__, port->number);
return get_serial_info(ATEN2011_port, return get_serial_info(ATEN2011_port,
(struct serial_struct *)arg); (struct serial_struct __user *)arg);
case TIOCSSERIAL: case TIOCSSERIAL:
dbg("%s (%d) TIOCSSERIAL", __FUNCTION__, port->number); dbg("%s (%d) TIOCSSERIAL", __FUNCTION__, port->number);
...@@ -2170,7 +2160,7 @@ static int ATEN2011_ioctl(struct tty_struct *tty, struct file *file, ...@@ -2170,7 +2160,7 @@ static int ATEN2011_ioctl(struct tty_struct *tty, struct file *file,
dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __FUNCTION__, dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __FUNCTION__,
port->number, icount.rx, icount.tx); port->number, icount.rx, icount.tx);
if (copy_to_user((void *)arg, &icount, sizeof(icount))) if (copy_to_user((void __user *)arg, &icount, sizeof(icount)))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -2829,7 +2819,7 @@ static int ATEN2011_startup(struct usb_serial *serial) ...@@ -2829,7 +2819,7 @@ static int ATEN2011_startup(struct usb_serial *serial)
/* setting configuration feature to one */ /* setting configuration feature to one */
usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
(__u8) 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 5 * HZ); (__u8) 0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5 * HZ);
return 0; return 0;
} }
......
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