aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/iuu_phoenix.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/iuu_phoenix.c')
-rw-r--r--drivers/usb/serial/iuu_phoenix.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index a01e987c7d32..ddff37fa6339 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -144,9 +144,10 @@ static void iuu_shutdown(struct usb_serial *serial)
144 } 144 }
145} 145}
146 146
147static int iuu_tiocmset(struct usb_serial_port *port, struct file *file, 147static int iuu_tiocmset(struct tty_struct *tty, struct file *file,
148 unsigned int set, unsigned int clear) 148 unsigned int set, unsigned int clear)
149{ 149{
150 struct usb_serial_port *port = tty->driver_data;
150 struct iuu_private *priv = usb_get_serial_port_data(port); 151 struct iuu_private *priv = usb_get_serial_port_data(port);
151 unsigned long flags; 152 unsigned long flags;
152 153
@@ -171,8 +172,9 @@ static int iuu_tiocmset(struct usb_serial_port *port, struct file *file,
171 * When no card , the reader respond with TIOCM_CD 172 * When no card , the reader respond with TIOCM_CD
172 * This is known as CD autodetect mechanism 173 * This is known as CD autodetect mechanism
173 */ 174 */
174static int iuu_tiocmget(struct usb_serial_port *port, struct file *file) 175static int iuu_tiocmget(struct tty_struct *tty, struct file *file)
175{ 176{
177 struct usb_serial_port *port = tty->driver_data;
176 struct iuu_private *priv = usb_get_serial_port_data(port); 178 struct iuu_private *priv = usb_get_serial_port_data(port);
177 unsigned long flags; 179 unsigned long flags;
178 int rc; 180 int rc;
@@ -316,11 +318,10 @@ static int bulk_immediate(struct usb_serial_port *port, u8 *buf, u8 count)
316 port->bulk_out_endpointAddress), buf, 318 port->bulk_out_endpointAddress), buf,
317 count, &actual, HZ * 1); 319 count, &actual, HZ * 1);
318 320
319 if (status != IUU_OPERATION_OK) { 321 if (status != IUU_OPERATION_OK)
320 dbg("%s - error = %2x", __func__, status); 322 dbg("%s - error = %2x", __func__, status);
321 } else { 323 else
322 dbg("%s - write OK !", __func__); 324 dbg("%s - write OK !", __func__);
323 }
324 return status; 325 return status;
325} 326}
326 327
@@ -340,12 +341,10 @@ static int read_immediate(struct usb_serial_port *port, u8 *buf, u8 count)
340 port->bulk_in_endpointAddress), buf, 341 port->bulk_in_endpointAddress), buf,
341 count, &actual, HZ * 1); 342 count, &actual, HZ * 1);
342 343
343 if (status != IUU_OPERATION_OK) { 344 if (status != IUU_OPERATION_OK)
344 dbg("%s - error = %2x", __func__, status); 345 dbg("%s - error = %2x", __func__, status);
345 } else { 346 else
346 dbg("%s - read OK !", __func__); 347 dbg("%s - read OK !", __func__);
347 }
348
349 return status; 348 return status;
350} 349}
351 350
@@ -630,7 +629,7 @@ static void read_buf_callback(struct urb *urb)
630 } 629 }
631 630
632 dbg("%s - %i chars to write", __func__, urb->actual_length); 631 dbg("%s - %i chars to write", __func__, urb->actual_length);
633 tty = port->tty; 632 tty = port->port.tty;
634 if (data == NULL) 633 if (data == NULL)
635 dbg("%s - data is NULL !!!", __func__); 634 dbg("%s - data is NULL !!!", __func__);
636 if (tty && urb->actual_length && data) { 635 if (tty && urb->actual_length && data) {
@@ -752,11 +751,10 @@ static void iuu_uart_read_callback(struct urb *urb)
752 /* if nothing to write call again rxcmd */ 751 /* if nothing to write call again rxcmd */
753 dbg("%s - rxcmd recall", __func__); 752 dbg("%s - rxcmd recall", __func__);
754 iuu_led_activity_off(urb); 753 iuu_led_activity_off(urb);
755 return;
756} 754}
757 755
758static int iuu_uart_write(struct usb_serial_port *port, const u8 *buf, 756static int iuu_uart_write(struct tty_struct *tty, struct usb_serial_port *port,
759 int count) 757 const u8 *buf, int count)
760{ 758{
761 struct iuu_private *priv = usb_get_serial_port_data(port); 759 struct iuu_private *priv = usb_get_serial_port_data(port);
762 unsigned long flags; 760 unsigned long flags;
@@ -769,14 +767,14 @@ static int iuu_uart_write(struct usb_serial_port *port, const u8 *buf,
769 if (priv->writelen > 0) { 767 if (priv->writelen > 0) {
770 /* buffer already filled but not commited */ 768 /* buffer already filled but not commited */
771 spin_unlock_irqrestore(&priv->lock, flags); 769 spin_unlock_irqrestore(&priv->lock, flags);
772 return (0); 770 return 0;
773 } 771 }
774 /* fill the buffer */ 772 /* fill the buffer */
775 memcpy(priv->writebuf, buf, count); 773 memcpy(priv->writebuf, buf, count);
776 priv->writelen = count; 774 priv->writelen = count;
777 spin_unlock_irqrestore(&priv->lock, flags); 775 spin_unlock_irqrestore(&priv->lock, flags);
778 776
779 return (count); 777 return count;
780} 778}
781 779
782static void read_rxcmd_callback(struct urb *urb) 780static void read_rxcmd_callback(struct urb *urb)
@@ -948,7 +946,8 @@ static int set_control_lines(struct usb_device *dev, u8 value)
948 return 0; 946 return 0;
949} 947}
950 948
951static void iuu_close(struct usb_serial_port *port, struct file *filp) 949static void iuu_close(struct tty_struct *tty,
950 struct usb_serial_port *port, struct file *filp)
952{ 951{
953 /* iuu_led (port,255,0,0,0); */ 952 /* iuu_led (port,255,0,0,0); */
954 struct usb_serial *serial; 953 struct usb_serial *serial;
@@ -964,8 +963,8 @@ static void iuu_close(struct usb_serial_port *port, struct file *filp)
964 963
965 iuu_uart_off(port); 964 iuu_uart_off(port);
966 if (serial->dev) { 965 if (serial->dev) {
967 if (port->tty) { 966 if (tty) {
968 c_cflag = port->tty->termios->c_cflag; 967 c_cflag = tty->termios->c_cflag;
969 if (c_cflag & HUPCL) { 968 if (c_cflag & HUPCL) {
970 /* drop DTR and RTS */ 969 /* drop DTR and RTS */
971 priv = usb_get_serial_port_data(port); 970 priv = usb_get_serial_port_data(port);
@@ -989,7 +988,8 @@ static void iuu_close(struct usb_serial_port *port, struct file *filp)
989 } 988 }
990} 989}
991 990
992static int iuu_open(struct usb_serial_port *port, struct file *filp) 991static int iuu_open(struct tty_struct *tty,
992 struct usb_serial_port *port, struct file *filp)
993{ 993{
994 struct usb_serial *serial = port->serial; 994 struct usb_serial *serial = port->serial;
995 u8 *buf; 995 u8 *buf;
@@ -1036,15 +1036,17 @@ static int iuu_open(struct usb_serial_port *port, struct file *filp)
1036 1036
1037 /* set the termios structure */ 1037 /* set the termios structure */
1038 spin_lock_irqsave(&priv->lock, flags); 1038 spin_lock_irqsave(&priv->lock, flags);
1039 if (!priv->termios_initialized) { 1039 if (tty && !priv->termios_initialized) {
1040 *(port->tty->termios) = tty_std_termios; 1040 *(tty->termios) = tty_std_termios;
1041 port->tty->termios->c_cflag = CLOCAL | CREAD | CS8 | B9600 1041 tty->termios->c_cflag = CLOCAL | CREAD | CS8 | B9600
1042 | TIOCM_CTS | CSTOPB | PARENB; 1042 | TIOCM_CTS | CSTOPB | PARENB;
1043 port->tty->termios->c_lflag = 0; 1043 tty->termios->c_ispeed = 9600;
1044 port->tty->termios->c_oflag = 0; 1044 tty->termios->c_ospeed = 9600;
1045 port->tty->termios->c_iflag = 0; 1045 tty->termios->c_lflag = 0;
1046 tty->termios->c_oflag = 0;
1047 tty->termios->c_iflag = 0;
1046 priv->termios_initialized = 1; 1048 priv->termios_initialized = 1;
1047 port->tty->low_latency = 1; 1049 tty->low_latency = 1;
1048 priv->poll = 0; 1050 priv->poll = 0;
1049 } 1051 }
1050 spin_unlock_irqrestore(&priv->lock, flags); 1052 spin_unlock_irqrestore(&priv->lock, flags);
@@ -1148,7 +1150,7 @@ static int iuu_open(struct usb_serial_port *port, struct file *filp)
1148 if (result) { 1150 if (result) {
1149 dev_err(&port->dev, "%s - failed submitting read urb," 1151 dev_err(&port->dev, "%s - failed submitting read urb,"
1150 " error %d\n", __func__, result); 1152 " error %d\n", __func__, result);
1151 iuu_close(port, NULL); 1153 iuu_close(tty, port, NULL);
1152 return -EPROTO; 1154 return -EPROTO;
1153 } else { 1155 } else {
1154 dbg("%s - rxcmd OK", __func__); 1156 dbg("%s - rxcmd OK", __func__);