#define ATEN_CTRL_TIMEOUT 500
#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
char *function);
int i;
int bytes_sent = 0;
int transfer_size;
- int from_user = 0;
int minor;
struct ATENINTL_port *ATEN2011_port;
}
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);
/* fill urb with data and submit */
static int get_lsr_info(struct tty_struct *tty,
struct ATENINTL_port *ATEN2011_port,
- unsigned int *value)
+ unsigned int __user *value)
{
int count;
unsigned int result = 0;
static int get_number_bytes_avail(struct tty_struct *tty,
struct ATENINTL_port *ATEN2011_port,
- unsigned int *value)
+ unsigned int __user *value)
{
unsigned int result = 0;
}
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 arg;
}
static int get_modem_info(struct ATENINTL_port *ATEN2011_port,
- unsigned int *value)
+ unsigned int __user *value)
{
unsigned int result = 0;
__u16 msr;
}
static int get_serial_info(struct ATENINTL_port *ATEN2011_port,
- struct serial_struct *retinfo)
+ struct serial_struct __user *retinfo)
{
struct serial_struct tmp;
struct async_icount cprev;
struct serial_icounter_struct icount;
int ATENret = 0;
- //int retval;
- //struct tty_ldisc *ld;
+ unsigned int __user *user_arg = (unsigned int __user *)arg;
//printk("%s - port %d, cmd = 0x%x\n", __FUNCTION__, port->number, cmd);
if (ATEN2011_port_paranoia_check(port, __FUNCTION__)) {
case TIOCINQ:
dbg("%s (%d) TIOCINQ", __FUNCTION__, port->number);
- return get_number_bytes_avail(tty, ATEN2011_port,
- (unsigned int *)arg);
+ return get_number_bytes_avail(tty, ATEN2011_port, user_arg);
break;
case TIOCOUTQ:
dbg("%s (%d) TIOCOUTQ", __FUNCTION__, port->number);
- return put_user(ATEN2011_chars_in_buffer(tty),
- (int __user *)arg);
+ return put_user(ATEN2011_chars_in_buffer(tty), user_arg);
break;
case TIOCSERGETLSR:
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;
case TIOCMBIS:
port->number);
// printk("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __FUNCTION__, port->number);
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);
return ATENret;
case TIOCMGET:
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:
dbg("%s (%d) TIOCGSERIAL", __FUNCTION__, port->number);
return get_serial_info(ATEN2011_port,
- (struct serial_struct *)arg);
+ (struct serial_struct __user *)arg);
case TIOCSSERIAL:
dbg("%s (%d) TIOCSSERIAL", __FUNCTION__, port->number);
dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __FUNCTION__,
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 0;
/* setting configuration feature to one */
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;
}