aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ti_usb_3410_5052.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/ti_usb_3410_5052.c')
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c211
1 files changed, 107 insertions, 104 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 3a3776677339..a1c8aef01417 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -264,9 +264,6 @@ static struct usb_serial_driver ti_1port_device = {
264 .description = "TI USB 3410 1 port adapter", 264 .description = "TI USB 3410 1 port adapter",
265 .usb_driver = &ti_usb_driver, 265 .usb_driver = &ti_usb_driver,
266 .id_table = ti_id_table_3410, 266 .id_table = ti_id_table_3410,
267 .num_interrupt_in = NUM_DONT_CARE,
268 .num_bulk_in = NUM_DONT_CARE,
269 .num_bulk_out = 1,
270 .num_ports = 1, 267 .num_ports = 1,
271 .attach = ti_startup, 268 .attach = ti_startup,
272 .shutdown = ti_shutdown, 269 .shutdown = ti_shutdown,
@@ -295,9 +292,6 @@ static struct usb_serial_driver ti_2port_device = {
295 .description = "TI USB 5052 2 port adapter", 292 .description = "TI USB 5052 2 port adapter",
296 .usb_driver = &ti_usb_driver, 293 .usb_driver = &ti_usb_driver,
297 .id_table = ti_id_table_5052, 294 .id_table = ti_id_table_5052,
298 .num_interrupt_in = 1,
299 .num_bulk_in = 2,
300 .num_bulk_out = 2,
301 .num_ports = 2, 295 .num_ports = 2,
302 .attach = ti_startup, 296 .attach = ti_startup,
303 .shutdown = ti_shutdown, 297 .shutdown = ti_shutdown,
@@ -414,14 +408,14 @@ static int ti_startup(struct usb_serial *serial)
414 408
415 409
416 dbg("%s - product 0x%4X, num configurations %d, configuration value %d", 410 dbg("%s - product 0x%4X, num configurations %d, configuration value %d",
417 __FUNCTION__, le16_to_cpu(dev->descriptor.idProduct), 411 __func__, le16_to_cpu(dev->descriptor.idProduct),
418 dev->descriptor.bNumConfigurations, 412 dev->descriptor.bNumConfigurations,
419 dev->actconfig->desc.bConfigurationValue); 413 dev->actconfig->desc.bConfigurationValue);
420 414
421 /* create device structure */ 415 /* create device structure */
422 tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL); 416 tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL);
423 if (tdev == NULL) { 417 if (tdev == NULL) {
424 dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); 418 dev_err(&dev->dev, "%s - out of memory\n", __func__);
425 return -ENOMEM; 419 return -ENOMEM;
426 } 420 }
427 mutex_init(&tdev->td_open_close_lock); 421 mutex_init(&tdev->td_open_close_lock);
@@ -431,7 +425,7 @@ static int ti_startup(struct usb_serial *serial)
431 /* determine device type */ 425 /* determine device type */
432 if (usb_match_id(serial->interface, ti_id_table_3410)) 426 if (usb_match_id(serial->interface, ti_id_table_3410))
433 tdev->td_is_3410 = 1; 427 tdev->td_is_3410 = 1;
434 dbg("%s - device type is %s", __FUNCTION__, tdev->td_is_3410 ? "3410" : "5052"); 428 dbg("%s - device type is %s", __func__, tdev->td_is_3410 ? "3410" : "5052");
435 429
436 /* if we have only 1 configuration, download firmware */ 430 /* if we have only 1 configuration, download firmware */
437 if (dev->descriptor.bNumConfigurations == 1) { 431 if (dev->descriptor.bNumConfigurations == 1) {
@@ -465,7 +459,7 @@ static int ti_startup(struct usb_serial *serial)
465 for (i = 0; i < serial->num_ports; ++i) { 459 for (i = 0; i < serial->num_ports; ++i) {
466 tport = kzalloc(sizeof(struct ti_port), GFP_KERNEL); 460 tport = kzalloc(sizeof(struct ti_port), GFP_KERNEL);
467 if (tport == NULL) { 461 if (tport == NULL) {
468 dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); 462 dev_err(&dev->dev, "%s - out of memory\n", __func__);
469 status = -ENOMEM; 463 status = -ENOMEM;
470 goto free_tports; 464 goto free_tports;
471 } 465 }
@@ -477,7 +471,7 @@ static int ti_startup(struct usb_serial *serial)
477 init_waitqueue_head(&tport->tp_write_wait); 471 init_waitqueue_head(&tport->tp_write_wait);
478 tport->tp_write_buf = ti_buf_alloc(); 472 tport->tp_write_buf = ti_buf_alloc();
479 if (tport->tp_write_buf == NULL) { 473 if (tport->tp_write_buf == NULL) {
480 dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); 474 dev_err(&dev->dev, "%s - out of memory\n", __func__);
481 kfree(tport); 475 kfree(tport);
482 status = -ENOMEM; 476 status = -ENOMEM;
483 goto free_tports; 477 goto free_tports;
@@ -510,7 +504,7 @@ static void ti_shutdown(struct usb_serial *serial)
510 struct ti_device *tdev = usb_get_serial_data(serial); 504 struct ti_device *tdev = usb_get_serial_data(serial);
511 struct ti_port *tport; 505 struct ti_port *tport;
512 506
513 dbg("%s", __FUNCTION__); 507 dbg("%s", __func__);
514 508
515 for (i=0; i < serial->num_ports; ++i) { 509 for (i=0; i < serial->num_ports; ++i) {
516 tport = usb_get_serial_port_data(serial->port[i]); 510 tport = usb_get_serial_port_data(serial->port[i]);
@@ -538,7 +532,7 @@ static int ti_open(struct usb_serial_port *port, struct file *file)
538 TI_PIPE_TIMEOUT_ENABLE | 532 TI_PIPE_TIMEOUT_ENABLE |
539 (TI_TRANSFER_TIMEOUT << 2)); 533 (TI_TRANSFER_TIMEOUT << 2));
540 534
541 dbg("%s - port %d", __FUNCTION__, port->number); 535 dbg("%s - port %d", __func__, port->number);
542 536
543 if (tport == NULL) 537 if (tport == NULL)
544 return -ENODEV; 538 return -ENODEV;
@@ -563,10 +557,10 @@ static int ti_open(struct usb_serial_port *port, struct file *file)
563 557
564 /* start interrupt urb the first time a port is opened on this device */ 558 /* start interrupt urb the first time a port is opened on this device */
565 if (tdev->td_open_port_count == 0) { 559 if (tdev->td_open_port_count == 0) {
566 dbg("%s - start interrupt in urb", __FUNCTION__); 560 dbg("%s - start interrupt in urb", __func__);
567 urb = tdev->td_serial->port[0]->interrupt_in_urb; 561 urb = tdev->td_serial->port[0]->interrupt_in_urb;
568 if (!urb) { 562 if (!urb) {
569 dev_err(&port->dev, "%s - no interrupt urb\n", __FUNCTION__); 563 dev_err(&port->dev, "%s - no interrupt urb\n", __func__);
570 status = -EINVAL; 564 status = -EINVAL;
571 goto release_lock; 565 goto release_lock;
572 } 566 }
@@ -575,40 +569,40 @@ static int ti_open(struct usb_serial_port *port, struct file *file)
575 urb->dev = dev; 569 urb->dev = dev;
576 status = usb_submit_urb(urb, GFP_KERNEL); 570 status = usb_submit_urb(urb, GFP_KERNEL);
577 if (status) { 571 if (status) {
578 dev_err(&port->dev, "%s - submit interrupt urb failed, %d\n", __FUNCTION__, status); 572 dev_err(&port->dev, "%s - submit interrupt urb failed, %d\n", __func__, status);
579 goto release_lock; 573 goto release_lock;
580 } 574 }
581 } 575 }
582 576
583 ti_set_termios(port, port->tty->termios); 577 ti_set_termios(port, port->tty->termios);
584 578
585 dbg("%s - sending TI_OPEN_PORT", __FUNCTION__); 579 dbg("%s - sending TI_OPEN_PORT", __func__);
586 status = ti_command_out_sync(tdev, TI_OPEN_PORT, 580 status = ti_command_out_sync(tdev, TI_OPEN_PORT,
587 (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0); 581 (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0);
588 if (status) { 582 if (status) {
589 dev_err(&port->dev, "%s - cannot send open command, %d\n", __FUNCTION__, status); 583 dev_err(&port->dev, "%s - cannot send open command, %d\n", __func__, status);
590 goto unlink_int_urb; 584 goto unlink_int_urb;
591 } 585 }
592 586
593 dbg("%s - sending TI_START_PORT", __FUNCTION__); 587 dbg("%s - sending TI_START_PORT", __func__);
594 status = ti_command_out_sync(tdev, TI_START_PORT, 588 status = ti_command_out_sync(tdev, TI_START_PORT,
595 (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); 589 (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0);
596 if (status) { 590 if (status) {
597 dev_err(&port->dev, "%s - cannot send start command, %d\n", __FUNCTION__, status); 591 dev_err(&port->dev, "%s - cannot send start command, %d\n", __func__, status);
598 goto unlink_int_urb; 592 goto unlink_int_urb;
599 } 593 }
600 594
601 dbg("%s - sending TI_PURGE_PORT", __FUNCTION__); 595 dbg("%s - sending TI_PURGE_PORT", __func__);
602 status = ti_command_out_sync(tdev, TI_PURGE_PORT, 596 status = ti_command_out_sync(tdev, TI_PURGE_PORT,
603 (__u8)(TI_UART1_PORT + port_number), TI_PURGE_INPUT, NULL, 0); 597 (__u8)(TI_UART1_PORT + port_number), TI_PURGE_INPUT, NULL, 0);
604 if (status) { 598 if (status) {
605 dev_err(&port->dev, "%s - cannot clear input buffers, %d\n", __FUNCTION__, status); 599 dev_err(&port->dev, "%s - cannot clear input buffers, %d\n", __func__, status);
606 goto unlink_int_urb; 600 goto unlink_int_urb;
607 } 601 }
608 status = ti_command_out_sync(tdev, TI_PURGE_PORT, 602 status = ti_command_out_sync(tdev, TI_PURGE_PORT,
609 (__u8)(TI_UART1_PORT + port_number), TI_PURGE_OUTPUT, NULL, 0); 603 (__u8)(TI_UART1_PORT + port_number), TI_PURGE_OUTPUT, NULL, 0);
610 if (status) { 604 if (status) {
611 dev_err(&port->dev, "%s - cannot clear output buffers, %d\n", __FUNCTION__, status); 605 dev_err(&port->dev, "%s - cannot clear output buffers, %d\n", __func__, status);
612 goto unlink_int_urb; 606 goto unlink_int_urb;
613 } 607 }
614 608
@@ -619,27 +613,27 @@ static int ti_open(struct usb_serial_port *port, struct file *file)
619 613
620 ti_set_termios(port, port->tty->termios); 614 ti_set_termios(port, port->tty->termios);
621 615
622 dbg("%s - sending TI_OPEN_PORT (2)", __FUNCTION__); 616 dbg("%s - sending TI_OPEN_PORT (2)", __func__);
623 status = ti_command_out_sync(tdev, TI_OPEN_PORT, 617 status = ti_command_out_sync(tdev, TI_OPEN_PORT,
624 (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0); 618 (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0);
625 if (status) { 619 if (status) {
626 dev_err(&port->dev, "%s - cannot send open command (2), %d\n", __FUNCTION__, status); 620 dev_err(&port->dev, "%s - cannot send open command (2), %d\n", __func__, status);
627 goto unlink_int_urb; 621 goto unlink_int_urb;
628 } 622 }
629 623
630 dbg("%s - sending TI_START_PORT (2)", __FUNCTION__); 624 dbg("%s - sending TI_START_PORT (2)", __func__);
631 status = ti_command_out_sync(tdev, TI_START_PORT, 625 status = ti_command_out_sync(tdev, TI_START_PORT,
632 (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); 626 (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0);
633 if (status) { 627 if (status) {
634 dev_err(&port->dev, "%s - cannot send start command (2), %d\n", __FUNCTION__, status); 628 dev_err(&port->dev, "%s - cannot send start command (2), %d\n", __func__, status);
635 goto unlink_int_urb; 629 goto unlink_int_urb;
636 } 630 }
637 631
638 /* start read urb */ 632 /* start read urb */
639 dbg("%s - start read urb", __FUNCTION__); 633 dbg("%s - start read urb", __func__);
640 urb = port->read_urb; 634 urb = port->read_urb;
641 if (!urb) { 635 if (!urb) {
642 dev_err(&port->dev, "%s - no read urb\n", __FUNCTION__); 636 dev_err(&port->dev, "%s - no read urb\n", __func__);
643 status = -EINVAL; 637 status = -EINVAL;
644 goto unlink_int_urb; 638 goto unlink_int_urb;
645 } 639 }
@@ -649,7 +643,7 @@ static int ti_open(struct usb_serial_port *port, struct file *file)
649 urb->dev = dev; 643 urb->dev = dev;
650 status = usb_submit_urb(urb, GFP_KERNEL); 644 status = usb_submit_urb(urb, GFP_KERNEL);
651 if (status) { 645 if (status) {
652 dev_err(&port->dev, "%s - submit read urb failed, %d\n", __FUNCTION__, status); 646 dev_err(&port->dev, "%s - submit read urb failed, %d\n", __func__, status);
653 goto unlink_int_urb; 647 goto unlink_int_urb;
654 } 648 }
655 649
@@ -663,7 +657,7 @@ unlink_int_urb:
663 usb_kill_urb(port->serial->port[0]->interrupt_in_urb); 657 usb_kill_urb(port->serial->port[0]->interrupt_in_urb);
664release_lock: 658release_lock:
665 mutex_unlock(&tdev->td_open_close_lock); 659 mutex_unlock(&tdev->td_open_close_lock);
666 dbg("%s - exit %d", __FUNCTION__, status); 660 dbg("%s - exit %d", __func__, status);
667 return status; 661 return status;
668} 662}
669 663
@@ -676,7 +670,7 @@ static void ti_close(struct usb_serial_port *port, struct file *file)
676 int status; 670 int status;
677 int do_unlock; 671 int do_unlock;
678 672
679 dbg("%s - port %d", __FUNCTION__, port->number); 673 dbg("%s - port %d", __func__, port->number);
680 674
681 tdev = usb_get_serial_data(port->serial); 675 tdev = usb_get_serial_data(port->serial);
682 tport = usb_get_serial_port_data(port); 676 tport = usb_get_serial_port_data(port);
@@ -693,11 +687,11 @@ static void ti_close(struct usb_serial_port *port, struct file *file)
693 687
694 port_number = port->number - port->serial->minor; 688 port_number = port->number - port->serial->minor;
695 689
696 dbg("%s - sending TI_CLOSE_PORT", __FUNCTION__); 690 dbg("%s - sending TI_CLOSE_PORT", __func__);
697 status = ti_command_out_sync(tdev, TI_CLOSE_PORT, 691 status = ti_command_out_sync(tdev, TI_CLOSE_PORT,
698 (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); 692 (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0);
699 if (status) 693 if (status)
700 dev_err(&port->dev, "%s - cannot send close port command, %d\n" , __FUNCTION__, status); 694 dev_err(&port->dev, "%s - cannot send close port command, %d\n" , __func__, status);
701 695
702 /* if mutex_lock is interrupted, continue anyway */ 696 /* if mutex_lock is interrupted, continue anyway */
703 do_unlock = !mutex_lock_interruptible(&tdev->td_open_close_lock); 697 do_unlock = !mutex_lock_interruptible(&tdev->td_open_close_lock);
@@ -710,7 +704,7 @@ static void ti_close(struct usb_serial_port *port, struct file *file)
710 if (do_unlock) 704 if (do_unlock)
711 mutex_unlock(&tdev->td_open_close_lock); 705 mutex_unlock(&tdev->td_open_close_lock);
712 706
713 dbg("%s - exit", __FUNCTION__); 707 dbg("%s - exit", __func__);
714} 708}
715 709
716 710
@@ -720,10 +714,10 @@ static int ti_write(struct usb_serial_port *port, const unsigned char *data,
720 struct ti_port *tport = usb_get_serial_port_data(port); 714 struct ti_port *tport = usb_get_serial_port_data(port);
721 unsigned long flags; 715 unsigned long flags;
722 716
723 dbg("%s - port %d", __FUNCTION__, port->number); 717 dbg("%s - port %d", __func__, port->number);
724 718
725 if (count == 0) { 719 if (count == 0) {
726 dbg("%s - write request of 0 bytes", __FUNCTION__); 720 dbg("%s - write request of 0 bytes", __func__);
727 return 0; 721 return 0;
728 } 722 }
729 723
@@ -746,7 +740,7 @@ static int ti_write_room(struct usb_serial_port *port)
746 int room = 0; 740 int room = 0;
747 unsigned long flags; 741 unsigned long flags;
748 742
749 dbg("%s - port %d", __FUNCTION__, port->number); 743 dbg("%s - port %d", __func__, port->number);
750 744
751 if (tport == NULL) 745 if (tport == NULL)
752 return -ENODEV; 746 return -ENODEV;
@@ -755,7 +749,7 @@ static int ti_write_room(struct usb_serial_port *port)
755 room = ti_buf_space_avail(tport->tp_write_buf); 749 room = ti_buf_space_avail(tport->tp_write_buf);
756 spin_unlock_irqrestore(&tport->tp_lock, flags); 750 spin_unlock_irqrestore(&tport->tp_lock, flags);
757 751
758 dbg("%s - returns %d", __FUNCTION__, room); 752 dbg("%s - returns %d", __func__, room);
759 return room; 753 return room;
760} 754}
761 755
@@ -766,7 +760,7 @@ static int ti_chars_in_buffer(struct usb_serial_port *port)
766 int chars = 0; 760 int chars = 0;
767 unsigned long flags; 761 unsigned long flags;
768 762
769 dbg("%s - port %d", __FUNCTION__, port->number); 763 dbg("%s - port %d", __func__, port->number);
770 764
771 if (tport == NULL) 765 if (tport == NULL)
772 return -ENODEV; 766 return -ENODEV;
@@ -775,7 +769,7 @@ static int ti_chars_in_buffer(struct usb_serial_port *port)
775 chars = ti_buf_data_avail(tport->tp_write_buf); 769 chars = ti_buf_data_avail(tport->tp_write_buf);
776 spin_unlock_irqrestore(&tport->tp_lock, flags); 770 spin_unlock_irqrestore(&tport->tp_lock, flags);
777 771
778 dbg("%s - returns %d", __FUNCTION__, chars); 772 dbg("%s - returns %d", __func__, chars);
779 return chars; 773 return chars;
780} 774}
781 775
@@ -785,14 +779,14 @@ static void ti_throttle(struct usb_serial_port *port)
785 struct ti_port *tport = usb_get_serial_port_data(port); 779 struct ti_port *tport = usb_get_serial_port_data(port);
786 struct tty_struct *tty; 780 struct tty_struct *tty;
787 781
788 dbg("%s - port %d", __FUNCTION__, port->number); 782 dbg("%s - port %d", __func__, port->number);
789 783
790 if (tport == NULL) 784 if (tport == NULL)
791 return; 785 return;
792 786
793 tty = port->tty; 787 tty = port->tty;
794 if (!tty) { 788 if (!tty) {
795 dbg("%s - no tty", __FUNCTION__); 789 dbg("%s - no tty", __func__);
796 return; 790 return;
797 } 791 }
798 792
@@ -808,21 +802,21 @@ static void ti_unthrottle(struct usb_serial_port *port)
808 struct tty_struct *tty; 802 struct tty_struct *tty;
809 int status; 803 int status;
810 804
811 dbg("%s - port %d", __FUNCTION__, port->number); 805 dbg("%s - port %d", __func__, port->number);
812 806
813 if (tport == NULL) 807 if (tport == NULL)
814 return; 808 return;
815 809
816 tty = port->tty; 810 tty = port->tty;
817 if (!tty) { 811 if (!tty) {
818 dbg("%s - no tty", __FUNCTION__); 812 dbg("%s - no tty", __func__);
819 return; 813 return;
820 } 814 }
821 815
822 if (I_IXOFF(tty) || C_CRTSCTS(tty)) { 816 if (I_IXOFF(tty) || C_CRTSCTS(tty)) {
823 status = ti_restart_read(tport, tty); 817 status = ti_restart_read(tport, tty);
824 if (status) 818 if (status)
825 dev_err(&port->dev, "%s - cannot restart read, %d\n", __FUNCTION__, status); 819 dev_err(&port->dev, "%s - cannot restart read, %d\n", __func__, status);
826 } 820 }
827} 821}
828 822
@@ -834,24 +828,24 @@ static int ti_ioctl(struct usb_serial_port *port, struct file *file,
834 struct async_icount cnow; 828 struct async_icount cnow;
835 struct async_icount cprev; 829 struct async_icount cprev;
836 830
837 dbg("%s - port %d, cmd = 0x%04X", __FUNCTION__, port->number, cmd); 831 dbg("%s - port %d, cmd = 0x%04X", __func__, port->number, cmd);
838 832
839 if (tport == NULL) 833 if (tport == NULL)
840 return -ENODEV; 834 return -ENODEV;
841 835
842 switch (cmd) { 836 switch (cmd) {
843 case TIOCGSERIAL: 837 case TIOCGSERIAL:
844 dbg("%s - (%d) TIOCGSERIAL", __FUNCTION__, port->number); 838 dbg("%s - (%d) TIOCGSERIAL", __func__, port->number);
845 return ti_get_serial_info(tport, (struct serial_struct __user *)arg); 839 return ti_get_serial_info(tport, (struct serial_struct __user *)arg);
846 break; 840 break;
847 841
848 case TIOCSSERIAL: 842 case TIOCSSERIAL:
849 dbg("%s - (%d) TIOCSSERIAL", __FUNCTION__, port->number); 843 dbg("%s - (%d) TIOCSSERIAL", __func__, port->number);
850 return ti_set_serial_info(tport, (struct serial_struct __user *)arg); 844 return ti_set_serial_info(tport, (struct serial_struct __user *)arg);
851 break; 845 break;
852 846
853 case TIOCMIWAIT: 847 case TIOCMIWAIT:
854 dbg("%s - (%d) TIOCMIWAIT", __FUNCTION__, port->number); 848 dbg("%s - (%d) TIOCMIWAIT", __func__, port->number);
855 cprev = tport->tp_icount; 849 cprev = tport->tp_icount;
856 while (1) { 850 while (1) {
857 interruptible_sleep_on(&tport->tp_msr_wait); 851 interruptible_sleep_on(&tport->tp_msr_wait);
@@ -872,7 +866,7 @@ static int ti_ioctl(struct usb_serial_port *port, struct file *file,
872 break; 866 break;
873 867
874 case TIOCGICOUNT: 868 case TIOCGICOUNT:
875 dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", __FUNCTION__, port->number, tport->tp_icount.rx, tport->tp_icount.tx); 869 dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, port->number, tport->tp_icount.rx, tport->tp_icount.tx);
876 if (copy_to_user((void __user *)arg, &tport->tp_icount, sizeof(tport->tp_icount))) 870 if (copy_to_user((void __user *)arg, &tport->tp_icount, sizeof(tport->tp_icount)))
877 return -EFAULT; 871 return -EFAULT;
878 return 0; 872 return 0;
@@ -894,20 +888,20 @@ static void ti_set_termios(struct usb_serial_port *port,
894 int port_number = port->number - port->serial->minor; 888 int port_number = port->number - port->serial->minor;
895 unsigned int mcr; 889 unsigned int mcr;
896 890
897 dbg("%s - port %d", __FUNCTION__, port->number); 891 dbg("%s - port %d", __func__, port->number);
898 892
899 cflag = tty->termios->c_cflag; 893 cflag = tty->termios->c_cflag;
900 iflag = tty->termios->c_iflag; 894 iflag = tty->termios->c_iflag;
901 895
902 dbg("%s - cflag %08x, iflag %08x", __FUNCTION__, cflag, iflag); 896 dbg("%s - cflag %08x, iflag %08x", __func__, cflag, iflag);
903 dbg("%s - old clfag %08x, old iflag %08x", __FUNCTION__, old_termios->c_cflag, old_termios->c_iflag); 897 dbg("%s - old clfag %08x, old iflag %08x", __func__, old_termios->c_cflag, old_termios->c_iflag);
904 898
905 if (tport == NULL) 899 if (tport == NULL)
906 return; 900 return;
907 901
908 config = kmalloc(sizeof(*config), GFP_KERNEL); 902 config = kmalloc(sizeof(*config), GFP_KERNEL);
909 if (!config) { 903 if (!config) {
910 dev_err(&port->dev, "%s - out of memory\n", __FUNCTION__); 904 dev_err(&port->dev, "%s - out of memory\n", __func__);
911 return; 905 return;
912 } 906 }
913 907
@@ -991,7 +985,7 @@ static void ti_set_termios(struct usb_serial_port *port,
991 tty_encode_baud_rate(tty, baud, baud); 985 tty_encode_baud_rate(tty, baud, baud);
992 986
993 dbg("%s - BaudRate=%d, wBaudRate=%d, wFlags=0x%04X, bDataBits=%d, bParity=%d, bStopBits=%d, cXon=%d, cXoff=%d, bUartMode=%d", 987 dbg("%s - BaudRate=%d, wBaudRate=%d, wFlags=0x%04X, bDataBits=%d, bParity=%d, bStopBits=%d, cXon=%d, cXoff=%d, bUartMode=%d",
994 __FUNCTION__, baud, config->wBaudRate, config->wFlags, config->bDataBits, config->bParity, config->bStopBits, config->cXon, config->cXoff, config->bUartMode); 988 __func__, baud, config->wBaudRate, config->wFlags, config->bDataBits, config->bParity, config->bStopBits, config->cXon, config->cXoff, config->bUartMode);
995 989
996 cpu_to_be16s(&config->wBaudRate); 990 cpu_to_be16s(&config->wBaudRate);
997 cpu_to_be16s(&config->wFlags); 991 cpu_to_be16s(&config->wFlags);
@@ -1000,7 +994,7 @@ static void ti_set_termios(struct usb_serial_port *port,
1000 (__u8)(TI_UART1_PORT + port_number), 0, (__u8 *)config, 994 (__u8)(TI_UART1_PORT + port_number), 0, (__u8 *)config,
1001 sizeof(*config)); 995 sizeof(*config));
1002 if (status) 996 if (status)
1003 dev_err(&port->dev, "%s - cannot set config on port %d, %d\n", __FUNCTION__, port_number, status); 997 dev_err(&port->dev, "%s - cannot set config on port %d, %d\n", __func__, port_number, status);
1004 998
1005 /* SET_CONFIG asserts RTS and DTR, reset them correctly */ 999 /* SET_CONFIG asserts RTS and DTR, reset them correctly */
1006 mcr = tport->tp_shadow_mcr; 1000 mcr = tport->tp_shadow_mcr;
@@ -1009,7 +1003,7 @@ static void ti_set_termios(struct usb_serial_port *port,
1009 mcr &= ~(TI_MCR_DTR | TI_MCR_RTS); 1003 mcr &= ~(TI_MCR_DTR | TI_MCR_RTS);
1010 status = ti_set_mcr(tport, mcr); 1004 status = ti_set_mcr(tport, mcr);
1011 if (status) 1005 if (status)
1012 dev_err(&port->dev, "%s - cannot set modem control on port %d, %d\n", __FUNCTION__, port_number, status); 1006 dev_err(&port->dev, "%s - cannot set modem control on port %d, %d\n", __func__, port_number, status);
1013 1007
1014 kfree(config); 1008 kfree(config);
1015} 1009}
@@ -1021,14 +1015,17 @@ static int ti_tiocmget(struct usb_serial_port *port, struct file *file)
1021 unsigned int result; 1015 unsigned int result;
1022 unsigned int msr; 1016 unsigned int msr;
1023 unsigned int mcr; 1017 unsigned int mcr;
1018 unsigned long flags;
1024 1019
1025 dbg("%s - port %d", __FUNCTION__, port->number); 1020 dbg("%s - port %d", __func__, port->number);
1026 1021
1027 if (tport == NULL) 1022 if (tport == NULL)
1028 return -ENODEV; 1023 return -ENODEV;
1029 1024
1025 spin_lock_irqsave(&tport->tp_lock, flags);
1030 msr = tport->tp_msr; 1026 msr = tport->tp_msr;
1031 mcr = tport->tp_shadow_mcr; 1027 mcr = tport->tp_shadow_mcr;
1028 spin_unlock_irqrestore(&tport->tp_lock, flags);
1032 1029
1033 result = ((mcr & TI_MCR_DTR) ? TIOCM_DTR : 0) 1030 result = ((mcr & TI_MCR_DTR) ? TIOCM_DTR : 0)
1034 | ((mcr & TI_MCR_RTS) ? TIOCM_RTS : 0) 1031 | ((mcr & TI_MCR_RTS) ? TIOCM_RTS : 0)
@@ -1038,7 +1035,7 @@ static int ti_tiocmget(struct usb_serial_port *port, struct file *file)
1038 | ((msr & TI_MSR_RI) ? TIOCM_RI : 0) 1035 | ((msr & TI_MSR_RI) ? TIOCM_RI : 0)
1039 | ((msr & TI_MSR_DSR) ? TIOCM_DSR : 0); 1036 | ((msr & TI_MSR_DSR) ? TIOCM_DSR : 0);
1040 1037
1041 dbg("%s - 0x%04X", __FUNCTION__, result); 1038 dbg("%s - 0x%04X", __func__, result);
1042 1039
1043 return result; 1040 return result;
1044} 1041}
@@ -1049,12 +1046,14 @@ static int ti_tiocmset(struct usb_serial_port *port, struct file *file,
1049{ 1046{
1050 struct ti_port *tport = usb_get_serial_port_data(port); 1047 struct ti_port *tport = usb_get_serial_port_data(port);
1051 unsigned int mcr; 1048 unsigned int mcr;
1049 unsigned long flags;
1052 1050
1053 dbg("%s - port %d", __FUNCTION__, port->number); 1051 dbg("%s - port %d", __func__, port->number);
1054 1052
1055 if (tport == NULL) 1053 if (tport == NULL)
1056 return -ENODEV; 1054 return -ENODEV;
1057 1055
1056 spin_lock_irqsave(&tport->tp_lock, flags);
1058 mcr = tport->tp_shadow_mcr; 1057 mcr = tport->tp_shadow_mcr;
1059 1058
1060 if (set & TIOCM_RTS) 1059 if (set & TIOCM_RTS)
@@ -1070,6 +1069,7 @@ static int ti_tiocmset(struct usb_serial_port *port, struct file *file,
1070 mcr &= ~TI_MCR_DTR; 1069 mcr &= ~TI_MCR_DTR;
1071 if (clear & TIOCM_LOOP) 1070 if (clear & TIOCM_LOOP)
1072 mcr &= ~TI_MCR_LOOP; 1071 mcr &= ~TI_MCR_LOOP;
1072 spin_unlock_irqrestore(&tport->tp_lock, flags);
1073 1073
1074 return ti_set_mcr(tport, mcr); 1074 return ti_set_mcr(tport, mcr);
1075} 1075}
@@ -1080,7 +1080,7 @@ static void ti_break(struct usb_serial_port *port, int break_state)
1080 struct ti_port *tport = usb_get_serial_port_data(port); 1080 struct ti_port *tport = usb_get_serial_port_data(port);
1081 int status; 1081 int status;
1082 1082
1083 dbg("%s - state = %d", __FUNCTION__, break_state); 1083 dbg("%s - state = %d", __func__, break_state);
1084 1084
1085 if (tport == NULL) 1085 if (tport == NULL)
1086 return; 1086 return;
@@ -1092,13 +1092,13 @@ static void ti_break(struct usb_serial_port *port, int break_state)
1092 TI_LCR_BREAK, break_state == -1 ? TI_LCR_BREAK : 0); 1092 TI_LCR_BREAK, break_state == -1 ? TI_LCR_BREAK : 0);
1093 1093
1094 if (status) 1094 if (status)
1095 dbg("%s - error setting break, %d", __FUNCTION__, status); 1095 dbg("%s - error setting break, %d", __func__, status);
1096} 1096}
1097 1097
1098 1098
1099static void ti_interrupt_callback(struct urb *urb) 1099static void ti_interrupt_callback(struct urb *urb)
1100{ 1100{
1101 struct ti_device *tdev = (struct ti_device *)urb->context; 1101 struct ti_device *tdev = urb->context;
1102 struct usb_serial_port *port; 1102 struct usb_serial_port *port;
1103 struct usb_serial *serial = tdev->td_serial; 1103 struct usb_serial *serial = tdev->td_serial;
1104 struct ti_port *tport; 1104 struct ti_port *tport;
@@ -1111,7 +1111,7 @@ static void ti_interrupt_callback(struct urb *urb)
1111 int retval; 1111 int retval;
1112 __u8 msr; 1112 __u8 msr;
1113 1113
1114 dbg("%s", __FUNCTION__); 1114 dbg("%s", __func__);
1115 1115
1116 switch (status) { 1116 switch (status) {
1117 case 0: 1117 case 0:
@@ -1119,33 +1119,33 @@ static void ti_interrupt_callback(struct urb *urb)
1119 case -ECONNRESET: 1119 case -ECONNRESET:
1120 case -ENOENT: 1120 case -ENOENT:
1121 case -ESHUTDOWN: 1121 case -ESHUTDOWN:
1122 dbg("%s - urb shutting down, %d", __FUNCTION__, status); 1122 dbg("%s - urb shutting down, %d", __func__, status);
1123 tdev->td_urb_error = 1; 1123 tdev->td_urb_error = 1;
1124 return; 1124 return;
1125 default: 1125 default:
1126 dev_err(dev, "%s - nonzero urb status, %d\n", 1126 dev_err(dev, "%s - nonzero urb status, %d\n",
1127 __FUNCTION__, status); 1127 __func__, status);
1128 tdev->td_urb_error = 1; 1128 tdev->td_urb_error = 1;
1129 goto exit; 1129 goto exit;
1130 } 1130 }
1131 1131
1132 if (length != 2) { 1132 if (length != 2) {
1133 dbg("%s - bad packet size, %d", __FUNCTION__, length); 1133 dbg("%s - bad packet size, %d", __func__, length);
1134 goto exit; 1134 goto exit;
1135 } 1135 }
1136 1136
1137 if (data[0] == TI_CODE_HARDWARE_ERROR) { 1137 if (data[0] == TI_CODE_HARDWARE_ERROR) {
1138 dev_err(dev, "%s - hardware error, %d\n", __FUNCTION__, data[1]); 1138 dev_err(dev, "%s - hardware error, %d\n", __func__, data[1]);
1139 goto exit; 1139 goto exit;
1140 } 1140 }
1141 1141
1142 port_number = TI_GET_PORT_FROM_CODE(data[0]); 1142 port_number = TI_GET_PORT_FROM_CODE(data[0]);
1143 function = TI_GET_FUNC_FROM_CODE(data[0]); 1143 function = TI_GET_FUNC_FROM_CODE(data[0]);
1144 1144
1145 dbg("%s - port_number %d, function %d, data 0x%02X", __FUNCTION__, port_number, function, data[1]); 1145 dbg("%s - port_number %d, function %d, data 0x%02X", __func__, port_number, function, data[1]);
1146 1146
1147 if (port_number >= serial->num_ports) { 1147 if (port_number >= serial->num_ports) {
1148 dev_err(dev, "%s - bad port number, %d\n", __FUNCTION__, port_number); 1148 dev_err(dev, "%s - bad port number, %d\n", __func__, port_number);
1149 goto exit; 1149 goto exit;
1150 } 1150 }
1151 1151
@@ -1157,17 +1157,17 @@ static void ti_interrupt_callback(struct urb *urb)
1157 1157
1158 switch (function) { 1158 switch (function) {
1159 case TI_CODE_DATA_ERROR: 1159 case TI_CODE_DATA_ERROR:
1160 dev_err(dev, "%s - DATA ERROR, port %d, data 0x%02X\n", __FUNCTION__, port_number, data[1]); 1160 dev_err(dev, "%s - DATA ERROR, port %d, data 0x%02X\n", __func__, port_number, data[1]);
1161 break; 1161 break;
1162 1162
1163 case TI_CODE_MODEM_STATUS: 1163 case TI_CODE_MODEM_STATUS:
1164 msr = data[1]; 1164 msr = data[1];
1165 dbg("%s - port %d, msr 0x%02X", __FUNCTION__, port_number, msr); 1165 dbg("%s - port %d, msr 0x%02X", __func__, port_number, msr);
1166 ti_handle_new_msr(tport, msr); 1166 ti_handle_new_msr(tport, msr);
1167 break; 1167 break;
1168 1168
1169 default: 1169 default:
1170 dev_err(dev, "%s - unknown interrupt code, 0x%02X\n", __FUNCTION__, data[1]); 1170 dev_err(dev, "%s - unknown interrupt code, 0x%02X\n", __func__, data[1]);
1171 break; 1171 break;
1172 } 1172 }
1173 1173
@@ -1175,19 +1175,19 @@ exit:
1175 retval = usb_submit_urb(urb, GFP_ATOMIC); 1175 retval = usb_submit_urb(urb, GFP_ATOMIC);
1176 if (retval) 1176 if (retval)
1177 dev_err(dev, "%s - resubmit interrupt urb failed, %d\n", 1177 dev_err(dev, "%s - resubmit interrupt urb failed, %d\n",
1178 __FUNCTION__, retval); 1178 __func__, retval);
1179} 1179}
1180 1180
1181 1181
1182static void ti_bulk_in_callback(struct urb *urb) 1182static void ti_bulk_in_callback(struct urb *urb)
1183{ 1183{
1184 struct ti_port *tport = (struct ti_port *)urb->context; 1184 struct ti_port *tport = urb->context;
1185 struct usb_serial_port *port = tport->tp_port; 1185 struct usb_serial_port *port = tport->tp_port;
1186 struct device *dev = &urb->dev->dev; 1186 struct device *dev = &urb->dev->dev;
1187 int status = urb->status; 1187 int status = urb->status;
1188 int retval = 0; 1188 int retval = 0;
1189 1189
1190 dbg("%s", __FUNCTION__); 1190 dbg("%s", __func__);
1191 1191
1192 switch (status) { 1192 switch (status) {
1193 case 0: 1193 case 0:
@@ -1195,13 +1195,13 @@ static void ti_bulk_in_callback(struct urb *urb)
1195 case -ECONNRESET: 1195 case -ECONNRESET:
1196 case -ENOENT: 1196 case -ENOENT:
1197 case -ESHUTDOWN: 1197 case -ESHUTDOWN:
1198 dbg("%s - urb shutting down, %d", __FUNCTION__, status); 1198 dbg("%s - urb shutting down, %d", __func__, status);
1199 tport->tp_tdev->td_urb_error = 1; 1199 tport->tp_tdev->td_urb_error = 1;
1200 wake_up_interruptible(&tport->tp_write_wait); 1200 wake_up_interruptible(&tport->tp_write_wait);
1201 return; 1201 return;
1202 default: 1202 default:
1203 dev_err(dev, "%s - nonzero urb status, %d\n", 1203 dev_err(dev, "%s - nonzero urb status, %d\n",
1204 __FUNCTION__, status ); 1204 __func__, status );
1205 tport->tp_tdev->td_urb_error = 1; 1205 tport->tp_tdev->td_urb_error = 1;
1206 wake_up_interruptible(&tport->tp_write_wait); 1206 wake_up_interruptible(&tport->tp_write_wait);
1207 } 1207 }
@@ -1210,16 +1210,16 @@ static void ti_bulk_in_callback(struct urb *urb)
1210 goto exit; 1210 goto exit;
1211 1211
1212 if (status) { 1212 if (status) {
1213 dev_err(dev, "%s - stopping read!\n", __FUNCTION__); 1213 dev_err(dev, "%s - stopping read!\n", __func__);
1214 return; 1214 return;
1215 } 1215 }
1216 1216
1217 if (port->tty && urb->actual_length) { 1217 if (port->tty && urb->actual_length) {
1218 usb_serial_debug_data(debug, dev, __FUNCTION__, 1218 usb_serial_debug_data(debug, dev, __func__,
1219 urb->actual_length, urb->transfer_buffer); 1219 urb->actual_length, urb->transfer_buffer);
1220 1220
1221 if (!tport->tp_is_open) 1221 if (!tport->tp_is_open)
1222 dbg("%s - port closed, dropping data", __FUNCTION__); 1222 dbg("%s - port closed, dropping data", __func__);
1223 else 1223 else
1224 ti_recv(&urb->dev->dev, port->tty, urb->transfer_buffer, 1224 ti_recv(&urb->dev->dev, port->tty, urb->transfer_buffer,
1225 urb->actual_length); 1225 urb->actual_length);
@@ -1241,18 +1241,18 @@ exit:
1241 spin_unlock(&tport->tp_lock); 1241 spin_unlock(&tport->tp_lock);
1242 if (retval) 1242 if (retval)
1243 dev_err(dev, "%s - resubmit read urb failed, %d\n", 1243 dev_err(dev, "%s - resubmit read urb failed, %d\n",
1244 __FUNCTION__, retval); 1244 __func__, retval);
1245} 1245}
1246 1246
1247 1247
1248static void ti_bulk_out_callback(struct urb *urb) 1248static void ti_bulk_out_callback(struct urb *urb)
1249{ 1249{
1250 struct ti_port *tport = (struct ti_port *)urb->context; 1250 struct ti_port *tport = urb->context;
1251 struct usb_serial_port *port = tport->tp_port; 1251 struct usb_serial_port *port = tport->tp_port;
1252 struct device *dev = &urb->dev->dev; 1252 struct device *dev = &urb->dev->dev;
1253 int status = urb->status; 1253 int status = urb->status;
1254 1254
1255 dbg("%s - port %d", __FUNCTION__, port->number); 1255 dbg("%s - port %d", __func__, port->number);
1256 1256
1257 tport->tp_write_urb_in_use = 0; 1257 tport->tp_write_urb_in_use = 0;
1258 1258
@@ -1262,13 +1262,13 @@ static void ti_bulk_out_callback(struct urb *urb)
1262 case -ECONNRESET: 1262 case -ECONNRESET:
1263 case -ENOENT: 1263 case -ENOENT:
1264 case -ESHUTDOWN: 1264 case -ESHUTDOWN:
1265 dbg("%s - urb shutting down, %d", __FUNCTION__, status); 1265 dbg("%s - urb shutting down, %d", __func__, status);
1266 tport->tp_tdev->td_urb_error = 1; 1266 tport->tp_tdev->td_urb_error = 1;
1267 wake_up_interruptible(&tport->tp_write_wait); 1267 wake_up_interruptible(&tport->tp_write_wait);
1268 return; 1268 return;
1269 default: 1269 default:
1270 dev_err(dev, "%s - nonzero urb status, %d\n", 1270 dev_err(dev, "%s - nonzero urb status, %d\n",
1271 __FUNCTION__, status); 1271 __func__, status);
1272 tport->tp_tdev->td_urb_error = 1; 1272 tport->tp_tdev->td_urb_error = 1;
1273 wake_up_interruptible(&tport->tp_write_wait); 1273 wake_up_interruptible(&tport->tp_write_wait);
1274 } 1274 }
@@ -1286,7 +1286,7 @@ static void ti_recv(struct device *dev, struct tty_struct *tty,
1286 do { 1286 do {
1287 cnt = tty_buffer_request_room(tty, length); 1287 cnt = tty_buffer_request_room(tty, length);
1288 if (cnt < length) { 1288 if (cnt < length) {
1289 dev_err(dev, "%s - dropping data, %d bytes lost\n", __FUNCTION__, length - cnt); 1289 dev_err(dev, "%s - dropping data, %d bytes lost\n", __func__, length - cnt);
1290 if(cnt == 0) 1290 if(cnt == 0)
1291 break; 1291 break;
1292 } 1292 }
@@ -1307,7 +1307,7 @@ static void ti_send(struct ti_port *tport)
1307 unsigned long flags; 1307 unsigned long flags;
1308 1308
1309 1309
1310 dbg("%s - port %d", __FUNCTION__, port->number); 1310 dbg("%s - port %d", __func__, port->number);
1311 1311
1312 spin_lock_irqsave(&tport->tp_lock, flags); 1312 spin_lock_irqsave(&tport->tp_lock, flags);
1313 1313
@@ -1329,7 +1329,7 @@ static void ti_send(struct ti_port *tport)
1329 1329
1330 spin_unlock_irqrestore(&tport->tp_lock, flags); 1330 spin_unlock_irqrestore(&tport->tp_lock, flags);
1331 1331
1332 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, port->write_urb->transfer_buffer); 1332 usb_serial_debug_data(debug, &port->dev, __func__, count, port->write_urb->transfer_buffer);
1333 1333
1334 usb_fill_bulk_urb(port->write_urb, port->serial->dev, 1334 usb_fill_bulk_urb(port->write_urb, port->serial->dev,
1335 usb_sndbulkpipe(port->serial->dev, 1335 usb_sndbulkpipe(port->serial->dev,
@@ -1339,7 +1339,7 @@ static void ti_send(struct ti_port *tport)
1339 1339
1340 result = usb_submit_urb(port->write_urb, GFP_ATOMIC); 1340 result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
1341 if (result) { 1341 if (result) {
1342 dev_err(&port->dev, "%s - submit write urb failed, %d\n", __FUNCTION__, result); 1342 dev_err(&port->dev, "%s - submit write urb failed, %d\n", __func__, result);
1343 tport->tp_write_urb_in_use = 0; 1343 tport->tp_write_urb_in_use = 0;
1344 /* TODO: reschedule ti_send */ 1344 /* TODO: reschedule ti_send */
1345 } else { 1345 } else {
@@ -1357,14 +1357,17 @@ static void ti_send(struct ti_port *tport)
1357 1357
1358static int ti_set_mcr(struct ti_port *tport, unsigned int mcr) 1358static int ti_set_mcr(struct ti_port *tport, unsigned int mcr)
1359{ 1359{
1360 unsigned long flags;
1360 int status; 1361 int status;
1361 1362
1362 status = ti_write_byte(tport->tp_tdev, 1363 status = ti_write_byte(tport->tp_tdev,
1363 tport->tp_uart_base_addr + TI_UART_OFFSET_MCR, 1364 tport->tp_uart_base_addr + TI_UART_OFFSET_MCR,
1364 TI_MCR_RTS | TI_MCR_DTR | TI_MCR_LOOP, mcr); 1365 TI_MCR_RTS | TI_MCR_DTR | TI_MCR_LOOP, mcr);
1365 1366
1367 spin_lock_irqsave(&tport->tp_lock, flags);
1366 if (!status) 1368 if (!status)
1367 tport->tp_shadow_mcr = mcr; 1369 tport->tp_shadow_mcr = mcr;
1370 spin_unlock_irqrestore(&tport->tp_lock, flags);
1368 1371
1369 return status; 1372 return status;
1370} 1373}
@@ -1378,23 +1381,23 @@ static int ti_get_lsr(struct ti_port *tport)
1378 int port_number = port->number - port->serial->minor; 1381 int port_number = port->number - port->serial->minor;
1379 struct ti_port_status *data; 1382 struct ti_port_status *data;
1380 1383
1381 dbg("%s - port %d", __FUNCTION__, port->number); 1384 dbg("%s - port %d", __func__, port->number);
1382 1385
1383 size = sizeof(struct ti_port_status); 1386 size = sizeof(struct ti_port_status);
1384 data = kmalloc(size, GFP_KERNEL); 1387 data = kmalloc(size, GFP_KERNEL);
1385 if (!data) { 1388 if (!data) {
1386 dev_err(&port->dev, "%s - out of memory\n", __FUNCTION__); 1389 dev_err(&port->dev, "%s - out of memory\n", __func__);
1387 return -ENOMEM; 1390 return -ENOMEM;
1388 } 1391 }
1389 1392
1390 status = ti_command_in_sync(tdev, TI_GET_PORT_STATUS, 1393 status = ti_command_in_sync(tdev, TI_GET_PORT_STATUS,
1391 (__u8)(TI_UART1_PORT+port_number), 0, (__u8 *)data, size); 1394 (__u8)(TI_UART1_PORT+port_number), 0, (__u8 *)data, size);
1392 if (status) { 1395 if (status) {
1393 dev_err(&port->dev, "%s - get port status command failed, %d\n", __FUNCTION__, status); 1396 dev_err(&port->dev, "%s - get port status command failed, %d\n", __func__, status);
1394 goto free_data; 1397 goto free_data;
1395 } 1398 }
1396 1399
1397 dbg("%s - lsr 0x%02X", __FUNCTION__, data->bLSR); 1400 dbg("%s - lsr 0x%02X", __func__, data->bLSR);
1398 1401
1399 tport->tp_lsr = data->bLSR; 1402 tport->tp_lsr = data->bLSR;
1400 1403
@@ -1455,7 +1458,7 @@ static void ti_handle_new_msr(struct ti_port *tport, __u8 msr)
1455 struct tty_struct *tty; 1458 struct tty_struct *tty;
1456 unsigned long flags; 1459 unsigned long flags;
1457 1460
1458 dbg("%s - msr 0x%02X", __FUNCTION__, msr); 1461 dbg("%s - msr 0x%02X", __func__, msr);
1459 1462
1460 if (msr & TI_MSR_DELTA_MASK) { 1463 if (msr & TI_MSR_DELTA_MASK) {
1461 spin_lock_irqsave(&tport->tp_lock, flags); 1464 spin_lock_irqsave(&tport->tp_lock, flags);
@@ -1493,7 +1496,7 @@ static void ti_drain(struct ti_port *tport, unsigned long timeout, int flush)
1493 struct usb_serial_port *port = tport->tp_port; 1496 struct usb_serial_port *port = tport->tp_port;
1494 wait_queue_t wait; 1497 wait_queue_t wait;
1495 1498
1496 dbg("%s - port %d", __FUNCTION__, port->number); 1499 dbg("%s - port %d", __func__, port->number);
1497 1500
1498 spin_lock_irq(&tport->tp_lock); 1501 spin_lock_irq(&tport->tp_lock);
1499 1502
@@ -1625,12 +1628,12 @@ static int ti_write_byte(struct ti_device *tdev, unsigned long addr,
1625 struct ti_write_data_bytes *data; 1628 struct ti_write_data_bytes *data;
1626 struct device *dev = &tdev->td_serial->dev->dev; 1629 struct device *dev = &tdev->td_serial->dev->dev;
1627 1630
1628 dbg("%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X", __FUNCTION__, addr, mask, byte); 1631 dbg("%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X", __func__, addr, mask, byte);
1629 1632
1630 size = sizeof(struct ti_write_data_bytes) + 2; 1633 size = sizeof(struct ti_write_data_bytes) + 2;
1631 data = kmalloc(size, GFP_KERNEL); 1634 data = kmalloc(size, GFP_KERNEL);
1632 if (!data) { 1635 if (!data) {
1633 dev_err(dev, "%s - out of memory\n", __FUNCTION__); 1636 dev_err(dev, "%s - out of memory\n", __func__);
1634 return -ENOMEM; 1637 return -ENOMEM;
1635 } 1638 }
1636 1639
@@ -1646,7 +1649,7 @@ static int ti_write_byte(struct ti_device *tdev, unsigned long addr,
1646 (__u8 *)data, size); 1649 (__u8 *)data, size);
1647 1650
1648 if (status < 0) 1651 if (status < 0)
1649 dev_err(dev, "%s - failed, %d\n", __FUNCTION__, status); 1652 dev_err(dev, "%s - failed, %d\n", __func__, status);
1650 1653
1651 kfree(data); 1654 kfree(data);
1652 1655
@@ -1673,7 +1676,7 @@ static int ti_download_firmware(struct ti_device *tdev,
1673 buffer_size = TI_FIRMWARE_BUF_SIZE + sizeof(struct ti_firmware_header); 1676 buffer_size = TI_FIRMWARE_BUF_SIZE + sizeof(struct ti_firmware_header);
1674 buffer = kmalloc(buffer_size, GFP_KERNEL); 1677 buffer = kmalloc(buffer_size, GFP_KERNEL);
1675 if (!buffer) { 1678 if (!buffer) {
1676 dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); 1679 dev_err(&dev->dev, "%s - out of memory\n", __func__);
1677 return -ENOMEM; 1680 return -ENOMEM;
1678 } 1681 }
1679 1682
@@ -1687,7 +1690,7 @@ static int ti_download_firmware(struct ti_device *tdev,
1687 header->wLength = cpu_to_le16((__u16)(buffer_size - sizeof(struct ti_firmware_header))); 1690 header->wLength = cpu_to_le16((__u16)(buffer_size - sizeof(struct ti_firmware_header)));
1688 header->bCheckSum = cs; 1691 header->bCheckSum = cs;
1689 1692
1690 dbg("%s - downloading firmware", __FUNCTION__); 1693 dbg("%s - downloading firmware", __func__);
1691 for (pos = 0; pos < buffer_size; pos += done) { 1694 for (pos = 0; pos < buffer_size; pos += done) {
1692 len = min(buffer_size - pos, TI_DOWNLOAD_MAX_PACKET_SIZE); 1695 len = min(buffer_size - pos, TI_DOWNLOAD_MAX_PACKET_SIZE);
1693 status = usb_bulk_msg(dev, pipe, buffer+pos, len, &done, 1000); 1696 status = usb_bulk_msg(dev, pipe, buffer+pos, len, &done, 1000);
@@ -1698,11 +1701,11 @@ static int ti_download_firmware(struct ti_device *tdev,
1698 kfree(buffer); 1701 kfree(buffer);
1699 1702
1700 if (status) { 1703 if (status) {
1701 dev_err(&dev->dev, "%s - error downloading firmware, %d\n", __FUNCTION__, status); 1704 dev_err(&dev->dev, "%s - error downloading firmware, %d\n", __func__, status);
1702 return status; 1705 return status;
1703 } 1706 }
1704 1707
1705 dbg("%s - download successful", __FUNCTION__); 1708 dbg("%s - download successful", __func__);
1706 1709
1707 return 0; 1710 return 0;
1708} 1711}