diff options
Diffstat (limited to 'drivers/usb/serial/pl2303.c')
-rw-r--r-- | drivers/usb/serial/pl2303.c | 140 |
1 files changed, 77 insertions, 63 deletions
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 2a0dd1b50dc4..2c9c446ad625 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -10,7 +10,8 @@ | |||
10 | * modify it under the terms of the GNU General Public License version | 10 | * modify it under the terms of the GNU General Public License version |
11 | * 2 as published by the Free Software Foundation. | 11 | * 2 as published by the Free Software Foundation. |
12 | * | 12 | * |
13 | * See Documentation/usb/usb-serial.txt for more information on using this driver | 13 | * See Documentation/usb/usb-serial.txt for more information on using this |
14 | * driver | ||
14 | * | 15 | * |
15 | */ | 16 | */ |
16 | 17 | ||
@@ -25,7 +26,7 @@ | |||
25 | #include <linux/module.h> | 26 | #include <linux/module.h> |
26 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
27 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
28 | #include <asm/uaccess.h> | 29 | #include <linux/uaccess.h> |
29 | #include <linux/usb.h> | 30 | #include <linux/usb.h> |
30 | #include <linux/usb/serial.h> | 31 | #include <linux/usb/serial.h> |
31 | #include "pl2303.h" | 32 | #include "pl2303.h" |
@@ -116,7 +117,7 @@ static struct usb_driver pl2303_driver = { | |||
116 | #define CONTROL_RTS 0x02 | 117 | #define CONTROL_RTS 0x02 |
117 | 118 | ||
118 | #define BREAK_REQUEST_TYPE 0x21 | 119 | #define BREAK_REQUEST_TYPE 0x21 |
119 | #define BREAK_REQUEST 0x23 | 120 | #define BREAK_REQUEST 0x23 |
120 | #define BREAK_ON 0xffff | 121 | #define BREAK_ON 0xffff |
121 | #define BREAK_OFF 0x0000 | 122 | #define BREAK_OFF 0x0000 |
122 | 123 | ||
@@ -222,7 +223,7 @@ static unsigned int pl2303_buf_data_avail(struct pl2303_buf *pb) | |||
222 | if (pb == NULL) | 223 | if (pb == NULL) |
223 | return 0; | 224 | return 0; |
224 | 225 | ||
225 | return ((pb->buf_size + pb->buf_put - pb->buf_get) % pb->buf_size); | 226 | return (pb->buf_size + pb->buf_put - pb->buf_get) % pb->buf_size; |
226 | } | 227 | } |
227 | 228 | ||
228 | /* | 229 | /* |
@@ -236,7 +237,7 @@ static unsigned int pl2303_buf_space_avail(struct pl2303_buf *pb) | |||
236 | if (pb == NULL) | 237 | if (pb == NULL) |
237 | return 0; | 238 | return 0; |
238 | 239 | ||
239 | return ((pb->buf_size + pb->buf_get - pb->buf_put - 1) % pb->buf_size); | 240 | return (pb->buf_size + pb->buf_get - pb->buf_put - 1) % pb->buf_size; |
240 | } | 241 | } |
241 | 242 | ||
242 | /* | 243 | /* |
@@ -395,7 +396,7 @@ static int pl2303_startup(struct usb_serial *serial) | |||
395 | 396 | ||
396 | cleanup: | 397 | cleanup: |
397 | kfree(buf); | 398 | kfree(buf); |
398 | for (--i; i>=0; --i) { | 399 | for (--i; i >= 0; --i) { |
399 | priv = usb_get_serial_port_data(serial->port[i]); | 400 | priv = usb_get_serial_port_data(serial->port[i]); |
400 | pl2303_buf_free(priv->buf); | 401 | pl2303_buf_free(priv->buf); |
401 | kfree(priv); | 402 | kfree(priv); |
@@ -407,7 +408,7 @@ cleanup: | |||
407 | static int set_control_lines(struct usb_device *dev, u8 value) | 408 | static int set_control_lines(struct usb_device *dev, u8 value) |
408 | { | 409 | { |
409 | int retval; | 410 | int retval; |
410 | 411 | ||
411 | retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 412 | retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
412 | SET_CONTROL_REQUEST, SET_CONTROL_REQUEST_TYPE, | 413 | SET_CONTROL_REQUEST, SET_CONTROL_REQUEST_TYPE, |
413 | value, 0, NULL, 0, 100); | 414 | value, 0, NULL, 0, 100); |
@@ -452,14 +453,14 @@ static void pl2303_send(struct usb_serial_port *port) | |||
452 | dev_err(&port->dev, "%s - failed submitting write urb," | 453 | dev_err(&port->dev, "%s - failed submitting write urb," |
453 | " error %d\n", __func__, result); | 454 | " error %d\n", __func__, result); |
454 | priv->write_urb_in_use = 0; | 455 | priv->write_urb_in_use = 0; |
455 | // TODO: reschedule pl2303_send | 456 | /* TODO: reschedule pl2303_send */ |
456 | } | 457 | } |
457 | 458 | ||
458 | usb_serial_port_softint(port); | 459 | usb_serial_port_softint(port); |
459 | } | 460 | } |
460 | 461 | ||
461 | static int pl2303_write(struct usb_serial_port *port, const unsigned char *buf, | 462 | static int pl2303_write(struct tty_struct *tty, struct usb_serial_port *port, |
462 | int count) | 463 | const unsigned char *buf, int count) |
463 | { | 464 | { |
464 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 465 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
465 | unsigned long flags; | 466 | unsigned long flags; |
@@ -478,8 +479,9 @@ static int pl2303_write(struct usb_serial_port *port, const unsigned char *buf, | |||
478 | return count; | 479 | return count; |
479 | } | 480 | } |
480 | 481 | ||
481 | static int pl2303_write_room(struct usb_serial_port *port) | 482 | static int pl2303_write_room(struct tty_struct *tty) |
482 | { | 483 | { |
484 | struct usb_serial_port *port = tty->driver_data; | ||
483 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 485 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
484 | int room = 0; | 486 | int room = 0; |
485 | unsigned long flags; | 487 | unsigned long flags; |
@@ -494,8 +496,9 @@ static int pl2303_write_room(struct usb_serial_port *port) | |||
494 | return room; | 496 | return room; |
495 | } | 497 | } |
496 | 498 | ||
497 | static int pl2303_chars_in_buffer(struct usb_serial_port *port) | 499 | static int pl2303_chars_in_buffer(struct tty_struct *tty) |
498 | { | 500 | { |
501 | struct usb_serial_port *port = tty->driver_data; | ||
499 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 502 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
500 | int chars = 0; | 503 | int chars = 0; |
501 | unsigned long flags; | 504 | unsigned long flags; |
@@ -510,8 +513,8 @@ static int pl2303_chars_in_buffer(struct usb_serial_port *port) | |||
510 | return chars; | 513 | return chars; |
511 | } | 514 | } |
512 | 515 | ||
513 | static void pl2303_set_termios(struct usb_serial_port *port, | 516 | static void pl2303_set_termios(struct tty_struct *tty, |
514 | struct ktermios *old_termios) | 517 | struct usb_serial_port *port, struct ktermios *old_termios) |
515 | { | 518 | { |
516 | struct usb_serial *serial = port->serial; | 519 | struct usb_serial *serial = port->serial; |
517 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 520 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
@@ -526,11 +529,10 @@ static void pl2303_set_termios(struct usb_serial_port *port, | |||
526 | 529 | ||
527 | spin_lock_irqsave(&priv->lock, flags); | 530 | spin_lock_irqsave(&priv->lock, flags); |
528 | if (!priv->termios_initialized) { | 531 | if (!priv->termios_initialized) { |
529 | *(port->tty->termios) = tty_std_termios; | 532 | *(tty->termios) = tty_std_termios; |
530 | port->tty->termios->c_cflag = B9600 | CS8 | CREAD | | 533 | tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; |
531 | HUPCL | CLOCAL; | 534 | tty->termios->c_ispeed = 9600; |
532 | port->tty->termios->c_ispeed = 9600; | 535 | tty->termios->c_ospeed = 9600; |
533 | port->tty->termios->c_ospeed = 9600; | ||
534 | priv->termios_initialized = 1; | 536 | priv->termios_initialized = 1; |
535 | } | 537 | } |
536 | spin_unlock_irqrestore(&priv->lock, flags); | 538 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -539,16 +541,16 @@ static void pl2303_set_termios(struct usb_serial_port *port, | |||
539 | serial settings even to the same values as before. Thus | 541 | serial settings even to the same values as before. Thus |
540 | we actually need to filter in this specific case */ | 542 | we actually need to filter in this specific case */ |
541 | 543 | ||
542 | if (!tty_termios_hw_change(port->tty->termios, old_termios)) | 544 | if (!tty_termios_hw_change(tty->termios, old_termios)) |
543 | return; | 545 | return; |
544 | 546 | ||
545 | cflag = port->tty->termios->c_cflag; | 547 | cflag = tty->termios->c_cflag; |
546 | 548 | ||
547 | buf = kzalloc(7, GFP_KERNEL); | 549 | buf = kzalloc(7, GFP_KERNEL); |
548 | if (!buf) { | 550 | if (!buf) { |
549 | dev_err(&port->dev, "%s - out of memory.\n", __func__); | 551 | dev_err(&port->dev, "%s - out of memory.\n", __func__); |
550 | /* Report back no change occurred */ | 552 | /* Report back no change occurred */ |
551 | *port->tty->termios = *old_termios; | 553 | *tty->termios = *old_termios; |
552 | return; | 554 | return; |
553 | } | 555 | } |
554 | 556 | ||
@@ -560,16 +562,24 @@ static void pl2303_set_termios(struct usb_serial_port *port, | |||
560 | 562 | ||
561 | if (cflag & CSIZE) { | 563 | if (cflag & CSIZE) { |
562 | switch (cflag & CSIZE) { | 564 | switch (cflag & CSIZE) { |
563 | case CS5: buf[6] = 5; break; | 565 | case CS5: |
564 | case CS6: buf[6] = 6; break; | 566 | buf[6] = 5; |
565 | case CS7: buf[6] = 7; break; | 567 | break; |
566 | default: | 568 | case CS6: |
567 | case CS8: buf[6] = 8; break; | 569 | buf[6] = 6; |
570 | break; | ||
571 | case CS7: | ||
572 | buf[6] = 7; | ||
573 | break; | ||
574 | default: | ||
575 | case CS8: | ||
576 | buf[6] = 8; | ||
577 | break; | ||
568 | } | 578 | } |
569 | dbg("%s - data bits = %d", __func__, buf[6]); | 579 | dbg("%s - data bits = %d", __func__, buf[6]); |
570 | } | 580 | } |
571 | 581 | ||
572 | baud = tty_get_baud_rate(port->tty);; | 582 | baud = tty_get_baud_rate(tty); |
573 | dbg("%s - baud = %d", __func__, baud); | 583 | dbg("%s - baud = %d", __func__, baud); |
574 | if (baud) { | 584 | if (baud) { |
575 | buf[0] = baud & 0xff; | 585 | buf[0] = baud & 0xff; |
@@ -646,12 +656,13 @@ static void pl2303_set_termios(struct usb_serial_port *port, | |||
646 | 656 | ||
647 | /* FIXME: Need to read back resulting baud rate */ | 657 | /* FIXME: Need to read back resulting baud rate */ |
648 | if (baud) | 658 | if (baud) |
649 | tty_encode_baud_rate(port->tty, baud, baud); | 659 | tty_encode_baud_rate(tty, baud, baud); |
650 | 660 | ||
651 | kfree(buf); | 661 | kfree(buf); |
652 | } | 662 | } |
653 | 663 | ||
654 | static void pl2303_close(struct usb_serial_port *port, struct file *filp) | 664 | static void pl2303_close(struct tty_struct *tty, |
665 | struct usb_serial_port *port, struct file *filp) | ||
655 | { | 666 | { |
656 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 667 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
657 | unsigned long flags; | 668 | unsigned long flags; |
@@ -666,7 +677,7 @@ static void pl2303_close(struct usb_serial_port *port, struct file *filp) | |||
666 | spin_lock_irqsave(&priv->lock, flags); | 677 | spin_lock_irqsave(&priv->lock, flags); |
667 | timeout = PL2303_CLOSING_WAIT; | 678 | timeout = PL2303_CLOSING_WAIT; |
668 | init_waitqueue_entry(&wait, current); | 679 | init_waitqueue_entry(&wait, current); |
669 | add_wait_queue(&port->tty->write_wait, &wait); | 680 | add_wait_queue(&tty->write_wait, &wait); |
670 | for (;;) { | 681 | for (;;) { |
671 | set_current_state(TASK_INTERRUPTIBLE); | 682 | set_current_state(TASK_INTERRUPTIBLE); |
672 | if (pl2303_buf_data_avail(priv->buf) == 0 || | 683 | if (pl2303_buf_data_avail(priv->buf) == 0 || |
@@ -678,7 +689,7 @@ static void pl2303_close(struct usb_serial_port *port, struct file *filp) | |||
678 | spin_lock_irqsave(&priv->lock, flags); | 689 | spin_lock_irqsave(&priv->lock, flags); |
679 | } | 690 | } |
680 | set_current_state(TASK_RUNNING); | 691 | set_current_state(TASK_RUNNING); |
681 | remove_wait_queue(&port->tty->write_wait, &wait); | 692 | remove_wait_queue(&tty->write_wait, &wait); |
682 | /* clear out any remaining data in the buffer */ | 693 | /* clear out any remaining data in the buffer */ |
683 | pl2303_buf_clear(priv->buf); | 694 | pl2303_buf_clear(priv->buf); |
684 | spin_unlock_irqrestore(&priv->lock, flags); | 695 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -690,9 +701,9 @@ static void pl2303_close(struct usb_serial_port *port, struct file *filp) | |||
690 | /* for lower rates we should really know how much */ | 701 | /* for lower rates we should really know how much */ |
691 | /* data is in the buffer to compute a delay */ | 702 | /* data is in the buffer to compute a delay */ |
692 | /* that is not unnecessarily long) */ | 703 | /* that is not unnecessarily long) */ |
693 | bps = tty_get_baud_rate(port->tty); | 704 | bps = tty_get_baud_rate(tty); |
694 | if (bps > 1200) | 705 | if (bps > 1200) |
695 | timeout = max((HZ*2560)/bps,HZ/10); | 706 | timeout = max((HZ*2560)/bps, HZ/10); |
696 | else | 707 | else |
697 | timeout = 2*HZ; | 708 | timeout = 2*HZ; |
698 | schedule_timeout_interruptible(timeout); | 709 | schedule_timeout_interruptible(timeout); |
@@ -703,8 +714,8 @@ static void pl2303_close(struct usb_serial_port *port, struct file *filp) | |||
703 | usb_kill_urb(port->read_urb); | 714 | usb_kill_urb(port->read_urb); |
704 | usb_kill_urb(port->interrupt_in_urb); | 715 | usb_kill_urb(port->interrupt_in_urb); |
705 | 716 | ||
706 | if (port->tty) { | 717 | if (tty) { |
707 | c_cflag = port->tty->termios->c_cflag; | 718 | c_cflag = tty->termios->c_cflag; |
708 | if (c_cflag & HUPCL) { | 719 | if (c_cflag & HUPCL) { |
709 | /* drop DTR and RTS */ | 720 | /* drop DTR and RTS */ |
710 | spin_lock_irqsave(&priv->lock, flags); | 721 | spin_lock_irqsave(&priv->lock, flags); |
@@ -715,7 +726,8 @@ static void pl2303_close(struct usb_serial_port *port, struct file *filp) | |||
715 | } | 726 | } |
716 | } | 727 | } |
717 | 728 | ||
718 | static int pl2303_open(struct usb_serial_port *port, struct file *filp) | 729 | static int pl2303_open(struct tty_struct *tty, |
730 | struct usb_serial_port *port, struct file *filp) | ||
719 | { | 731 | { |
720 | struct ktermios tmp_termios; | 732 | struct ktermios tmp_termios; |
721 | struct usb_serial *serial = port->serial; | 733 | struct usb_serial *serial = port->serial; |
@@ -734,11 +746,10 @@ static int pl2303_open(struct usb_serial_port *port, struct file *filp) | |||
734 | } | 746 | } |
735 | 747 | ||
736 | /* Setup termios */ | 748 | /* Setup termios */ |
737 | if (port->tty) { | 749 | if (tty) |
738 | pl2303_set_termios(port, &tmp_termios); | 750 | pl2303_set_termios(tty, port, &tmp_termios); |
739 | } | ||
740 | 751 | ||
741 | //FIXME: need to assert RTS and DTR if CRTSCTS off | 752 | /* FIXME: need to assert RTS and DTR if CRTSCTS off */ |
742 | 753 | ||
743 | dbg("%s - submitting read urb", __func__); | 754 | dbg("%s - submitting read urb", __func__); |
744 | port->read_urb->dev = serial->dev; | 755 | port->read_urb->dev = serial->dev; |
@@ -746,7 +757,7 @@ static int pl2303_open(struct usb_serial_port *port, struct file *filp) | |||
746 | if (result) { | 757 | if (result) { |
747 | dev_err(&port->dev, "%s - failed submitting read urb," | 758 | dev_err(&port->dev, "%s - failed submitting read urb," |
748 | " error %d\n", __func__, result); | 759 | " error %d\n", __func__, result); |
749 | pl2303_close(port, NULL); | 760 | pl2303_close(tty, port, NULL); |
750 | return -EPROTO; | 761 | return -EPROTO; |
751 | } | 762 | } |
752 | 763 | ||
@@ -756,15 +767,16 @@ static int pl2303_open(struct usb_serial_port *port, struct file *filp) | |||
756 | if (result) { | 767 | if (result) { |
757 | dev_err(&port->dev, "%s - failed submitting interrupt urb," | 768 | dev_err(&port->dev, "%s - failed submitting interrupt urb," |
758 | " error %d\n", __func__, result); | 769 | " error %d\n", __func__, result); |
759 | pl2303_close(port, NULL); | 770 | pl2303_close(tty, port, NULL); |
760 | return -EPROTO; | 771 | return -EPROTO; |
761 | } | 772 | } |
762 | return 0; | 773 | return 0; |
763 | } | 774 | } |
764 | 775 | ||
765 | static int pl2303_tiocmset(struct usb_serial_port *port, struct file *file, | 776 | static int pl2303_tiocmset(struct tty_struct *tty, struct file *file, |
766 | unsigned int set, unsigned int clear) | 777 | unsigned int set, unsigned int clear) |
767 | { | 778 | { |
779 | struct usb_serial_port *port = tty->driver_data; | ||
768 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 780 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
769 | unsigned long flags; | 781 | unsigned long flags; |
770 | u8 control; | 782 | u8 control; |
@@ -787,8 +799,9 @@ static int pl2303_tiocmset(struct usb_serial_port *port, struct file *file, | |||
787 | return set_control_lines(port->serial->dev, control); | 799 | return set_control_lines(port->serial->dev, control); |
788 | } | 800 | } |
789 | 801 | ||
790 | static int pl2303_tiocmget(struct usb_serial_port *port, struct file *file) | 802 | static int pl2303_tiocmget(struct tty_struct *tty, struct file *file) |
791 | { | 803 | { |
804 | struct usb_serial_port *port = tty->driver_data; | ||
792 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 805 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
793 | unsigned long flags; | 806 | unsigned long flags; |
794 | unsigned int mcr; | 807 | unsigned int mcr; |
@@ -839,12 +852,12 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
839 | status = priv->line_status; | 852 | status = priv->line_status; |
840 | spin_unlock_irqrestore(&priv->lock, flags); | 853 | spin_unlock_irqrestore(&priv->lock, flags); |
841 | 854 | ||
842 | changed=prevstatus^status; | 855 | changed = prevstatus ^ status; |
843 | 856 | ||
844 | if (((arg & TIOCM_RNG) && (changed & UART_RING)) || | 857 | if (((arg & TIOCM_RNG) && (changed & UART_RING)) || |
845 | ((arg & TIOCM_DSR) && (changed & UART_DSR)) || | 858 | ((arg & TIOCM_DSR) && (changed & UART_DSR)) || |
846 | ((arg & TIOCM_CD) && (changed & UART_DCD)) || | 859 | ((arg & TIOCM_CD) && (changed & UART_DCD)) || |
847 | ((arg & TIOCM_CTS) && (changed & UART_CTS)) ) { | 860 | ((arg & TIOCM_CTS) && (changed & UART_CTS))) { |
848 | return 0; | 861 | return 0; |
849 | } | 862 | } |
850 | prevstatus = status; | 863 | prevstatus = status; |
@@ -853,26 +866,26 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
853 | return 0; | 866 | return 0; |
854 | } | 867 | } |
855 | 868 | ||
856 | static int pl2303_ioctl(struct usb_serial_port *port, struct file *file, | 869 | static int pl2303_ioctl(struct tty_struct *tty, struct file *file, |
857 | unsigned int cmd, unsigned long arg) | 870 | unsigned int cmd, unsigned long arg) |
858 | { | 871 | { |
872 | struct usb_serial_port *port = tty->driver_data; | ||
859 | dbg("%s (%d) cmd = 0x%04x", __func__, port->number, cmd); | 873 | dbg("%s (%d) cmd = 0x%04x", __func__, port->number, cmd); |
860 | 874 | ||
861 | switch (cmd) { | 875 | switch (cmd) { |
862 | case TIOCMIWAIT: | 876 | case TIOCMIWAIT: |
863 | dbg("%s (%d) TIOCMIWAIT", __func__, port->number); | 877 | dbg("%s (%d) TIOCMIWAIT", __func__, port->number); |
864 | return wait_modem_info(port, arg); | 878 | return wait_modem_info(port, arg); |
865 | 879 | default: | |
866 | default: | 880 | dbg("%s not supported = 0x%04x", __func__, cmd); |
867 | dbg("%s not supported = 0x%04x", __func__, cmd); | 881 | break; |
868 | break; | ||
869 | } | 882 | } |
870 | |||
871 | return -ENOIOCTLCMD; | 883 | return -ENOIOCTLCMD; |
872 | } | 884 | } |
873 | 885 | ||
874 | static void pl2303_break_ctl(struct usb_serial_port *port, int break_state) | 886 | static void pl2303_break_ctl(struct tty_struct *tty, int break_state) |
875 | { | 887 | { |
888 | struct usb_serial_port *port = tty->driver_data; | ||
876 | struct usb_serial *serial = port->serial; | 889 | struct usb_serial *serial = port->serial; |
877 | u16 state; | 890 | u16 state; |
878 | int result; | 891 | int result; |
@@ -883,7 +896,8 @@ static void pl2303_break_ctl(struct usb_serial_port *port, int break_state) | |||
883 | state = BREAK_OFF; | 896 | state = BREAK_OFF; |
884 | else | 897 | else |
885 | state = BREAK_ON; | 898 | state = BREAK_ON; |
886 | dbg("%s - turning break %s", __func__, state==BREAK_OFF ? "off" : "on"); | 899 | dbg("%s - turning break %s", __func__, |
900 | state == BREAK_OFF ? "off" : "on"); | ||
887 | 901 | ||
888 | result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | 902 | result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
889 | BREAK_REQUEST, BREAK_REQUEST_TYPE, state, | 903 | BREAK_REQUEST, BREAK_REQUEST_TYPE, state, |
@@ -937,7 +951,7 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
937 | if (actual_length < length) | 951 | if (actual_length < length) |
938 | return; | 952 | return; |
939 | 953 | ||
940 | /* Save off the uart status for others to look at */ | 954 | /* Save off the uart status for others to look at */ |
941 | spin_lock_irqsave(&priv->lock, flags); | 955 | spin_lock_irqsave(&priv->lock, flags); |
942 | priv->line_status = data[status_idx]; | 956 | priv->line_status = data[status_idx]; |
943 | spin_unlock_irqrestore(&priv->lock, flags); | 957 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -1001,7 +1015,7 @@ static void pl2303_read_bulk_callback(struct urb *urb) | |||
1001 | 1015 | ||
1002 | if (status) { | 1016 | if (status) { |
1003 | dbg("%s - urb status = %d", __func__, status); | 1017 | dbg("%s - urb status = %d", __func__, status); |
1004 | if (!port->open_count) { | 1018 | if (!port->port.count) { |
1005 | dbg("%s - port is closed, exiting.", __func__); | 1019 | dbg("%s - port is closed, exiting.", __func__); |
1006 | return; | 1020 | return; |
1007 | } | 1021 | } |
@@ -1036,7 +1050,7 @@ static void pl2303_read_bulk_callback(struct urb *urb) | |||
1036 | 1050 | ||
1037 | /* break takes precedence over parity, */ | 1051 | /* break takes precedence over parity, */ |
1038 | /* which takes precedence over framing errors */ | 1052 | /* which takes precedence over framing errors */ |
1039 | if (line_status & UART_BREAK_ERROR ) | 1053 | if (line_status & UART_BREAK_ERROR) |
1040 | tty_flag = TTY_BREAK; | 1054 | tty_flag = TTY_BREAK; |
1041 | else if (line_status & UART_PARITY_ERROR) | 1055 | else if (line_status & UART_PARITY_ERROR) |
1042 | tty_flag = TTY_PARITY; | 1056 | tty_flag = TTY_PARITY; |
@@ -1044,7 +1058,7 @@ static void pl2303_read_bulk_callback(struct urb *urb) | |||
1044 | tty_flag = TTY_FRAME; | 1058 | tty_flag = TTY_FRAME; |
1045 | dbg("%s - tty_flag = %d", __func__, tty_flag); | 1059 | dbg("%s - tty_flag = %d", __func__, tty_flag); |
1046 | 1060 | ||
1047 | tty = port->tty; | 1061 | tty = port->port.tty; |
1048 | if (tty && urb->actual_length) { | 1062 | if (tty && urb->actual_length) { |
1049 | tty_buffer_request_room(tty, urb->actual_length + 1); | 1063 | tty_buffer_request_room(tty, urb->actual_length + 1); |
1050 | /* overrun is special, not associated with a char */ | 1064 | /* overrun is special, not associated with a char */ |
@@ -1056,7 +1070,7 @@ static void pl2303_read_bulk_callback(struct urb *urb) | |||
1056 | } | 1070 | } |
1057 | 1071 | ||
1058 | /* Schedule the next read _if_ we are still open */ | 1072 | /* Schedule the next read _if_ we are still open */ |
1059 | if (port->open_count) { | 1073 | if (port->port.count) { |
1060 | urb->dev = port->serial->dev; | 1074 | urb->dev = port->serial->dev; |
1061 | result = usb_submit_urb(urb, GFP_ATOMIC); | 1075 | result = usb_submit_urb(urb, GFP_ATOMIC); |
1062 | if (result) | 1076 | if (result) |