aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/oti6858.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/oti6858.c')
-rw-r--r--drivers/usb/serial/oti6858.c121
1 files changed, 57 insertions, 64 deletions
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index a3847d6c946e..d92bb6501c84 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -179,9 +179,6 @@ static struct usb_serial_driver oti6858_device = {
179 .name = "oti6858", 179 .name = "oti6858",
180 }, 180 },
181 .id_table = id_table, 181 .id_table = id_table,
182 .num_interrupt_in = 1,
183 .num_bulk_in = 1,
184 .num_bulk_out = 1,
185 .num_ports = 1, 182 .num_ports = 1,
186 .open = oti6858_open, 183 .open = oti6858_open,
187 .close = oti6858_close, 184 .close = oti6858_close,
@@ -238,10 +235,10 @@ static void setup_line(struct work_struct *work)
238 unsigned long flags; 235 unsigned long flags;
239 int result; 236 int result;
240 237
241 dbg("%s(port = %d)", __FUNCTION__, port->number); 238 dbg("%s(port = %d)", __func__, port->number);
242 239
243 if ((new_setup = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL)) == NULL) { 240 if ((new_setup = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL)) == NULL) {
244 dev_err(&port->dev, "%s(): out of memory!\n", __FUNCTION__); 241 dev_err(&port->dev, "%s(): out of memory!\n", __func__);
245 /* we will try again */ 242 /* we will try again */
246 schedule_delayed_work(&priv->delayed_setup_work, msecs_to_jiffies(2)); 243 schedule_delayed_work(&priv->delayed_setup_work, msecs_to_jiffies(2));
247 return; 244 return;
@@ -256,7 +253,7 @@ static void setup_line(struct work_struct *work)
256 100); 253 100);
257 254
258 if (result != OTI6858_CTRL_PKT_SIZE) { 255 if (result != OTI6858_CTRL_PKT_SIZE) {
259 dev_err(&port->dev, "%s(): error reading status\n", __FUNCTION__); 256 dev_err(&port->dev, "%s(): error reading status\n", __func__);
260 kfree(new_setup); 257 kfree(new_setup);
261 /* we will try again */ 258 /* we will try again */
262 schedule_delayed_work(&priv->delayed_setup_work, msecs_to_jiffies(2)); 259 schedule_delayed_work(&priv->delayed_setup_work, msecs_to_jiffies(2));
@@ -289,12 +286,12 @@ static void setup_line(struct work_struct *work)
289 priv->setup_done = 1; 286 priv->setup_done = 1;
290 spin_unlock_irqrestore(&priv->lock, flags); 287 spin_unlock_irqrestore(&priv->lock, flags);
291 288
292 dbg("%s(): submitting interrupt urb", __FUNCTION__); 289 dbg("%s(): submitting interrupt urb", __func__);
293 port->interrupt_in_urb->dev = port->serial->dev; 290 port->interrupt_in_urb->dev = port->serial->dev;
294 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); 291 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
295 if (result != 0) { 292 if (result != 0) {
296 dev_err(&port->dev, "%s(): usb_submit_urb() failed" 293 dev_err(&port->dev, "%s(): usb_submit_urb() failed"
297 " with error %d\n", __FUNCTION__, result); 294 " with error %d\n", __func__, result);
298 } 295 }
299} 296}
300 297
@@ -306,7 +303,7 @@ void send_data(struct work_struct *work)
306 unsigned long flags; 303 unsigned long flags;
307 unsigned char allow; 304 unsigned char allow;
308 305
309 dbg("%s(port = %d)", __FUNCTION__, port->number); 306 dbg("%s(port = %d)", __func__, port->number);
310 307
311 spin_lock_irqsave(&priv->lock, flags); 308 spin_lock_irqsave(&priv->lock, flags);
312 if (priv->flags.write_urb_in_use) { 309 if (priv->flags.write_urb_in_use) {
@@ -334,12 +331,12 @@ void send_data(struct work_struct *work)
334 if (count == 0) { 331 if (count == 0) {
335 priv->flags.write_urb_in_use = 0; 332 priv->flags.write_urb_in_use = 0;
336 333
337 dbg("%s(): submitting interrupt urb", __FUNCTION__); 334 dbg("%s(): submitting interrupt urb", __func__);
338 port->interrupt_in_urb->dev = port->serial->dev; 335 port->interrupt_in_urb->dev = port->serial->dev;
339 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); 336 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
340 if (result != 0) { 337 if (result != 0) {
341 dev_err(&port->dev, "%s(): usb_submit_urb() failed" 338 dev_err(&port->dev, "%s(): usb_submit_urb() failed"
342 " with error %d\n", __FUNCTION__, result); 339 " with error %d\n", __func__, result);
343 } 340 }
344 return; 341 return;
345 } 342 }
@@ -353,7 +350,7 @@ void send_data(struct work_struct *work)
353 result = usb_submit_urb(port->write_urb, GFP_ATOMIC); 350 result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
354 if (result != 0) { 351 if (result != 0) {
355 dev_err(&port->dev, "%s(): usb_submit_urb() failed" 352 dev_err(&port->dev, "%s(): usb_submit_urb() failed"
356 " with error %d\n", __FUNCTION__, result); 353 " with error %d\n", __func__, result);
357 priv->flags.write_urb_in_use = 0; 354 priv->flags.write_urb_in_use = 0;
358 } 355 }
359 356
@@ -404,7 +401,7 @@ static int oti6858_write(struct usb_serial_port *port,
404 struct oti6858_private *priv = usb_get_serial_port_data(port); 401 struct oti6858_private *priv = usb_get_serial_port_data(port);
405 unsigned long flags; 402 unsigned long flags;
406 403
407 dbg("%s(port = %d, count = %d)", __FUNCTION__, port->number, count); 404 dbg("%s(port = %d, count = %d)", __func__, port->number, count);
408 405
409 if (!count) 406 if (!count)
410 return count; 407 return count;
@@ -422,7 +419,7 @@ static int oti6858_write_room(struct usb_serial_port *port)
422 int room = 0; 419 int room = 0;
423 unsigned long flags; 420 unsigned long flags;
424 421
425 dbg("%s(port = %d)", __FUNCTION__, port->number); 422 dbg("%s(port = %d)", __func__, port->number);
426 423
427 spin_lock_irqsave(&priv->lock, flags); 424 spin_lock_irqsave(&priv->lock, flags);
428 room = oti6858_buf_space_avail(priv->buf); 425 room = oti6858_buf_space_avail(priv->buf);
@@ -437,7 +434,7 @@ static int oti6858_chars_in_buffer(struct usb_serial_port *port)
437 int chars = 0; 434 int chars = 0;
438 unsigned long flags; 435 unsigned long flags;
439 436
440 dbg("%s(port = %d)", __FUNCTION__, port->number); 437 dbg("%s(port = %d)", __func__, port->number);
441 438
442 spin_lock_irqsave(&priv->lock, flags); 439 spin_lock_irqsave(&priv->lock, flags);
443 chars = oti6858_buf_data_avail(priv->buf); 440 chars = oti6858_buf_data_avail(priv->buf);
@@ -456,10 +453,10 @@ static void oti6858_set_termios(struct usb_serial_port *port,
456 u16 divisor; 453 u16 divisor;
457 int br; 454 int br;
458 455
459 dbg("%s(port = %d)", __FUNCTION__, port->number); 456 dbg("%s(port = %d)", __func__, port->number);
460 457
461 if (!port->tty || !port->tty->termios) { 458 if (!port->tty || !port->tty->termios) {
462 dbg("%s(): no tty structures", __FUNCTION__); 459 dbg("%s(): no tty structures", __func__);
463 return; 460 return;
464 } 461 }
465 462
@@ -575,7 +572,7 @@ static int oti6858_open(struct usb_serial_port *port, struct file *filp)
575 unsigned long flags; 572 unsigned long flags;
576 int result; 573 int result;
577 574
578 dbg("%s(port = %d)", __FUNCTION__, port->number); 575 dbg("%s(port = %d)", __func__, port->number);
579 576
580 usb_clear_halt(serial->dev, port->write_urb->pipe); 577 usb_clear_halt(serial->dev, port->write_urb->pipe);
581 usb_clear_halt(serial->dev, port->read_urb->pipe); 578 usb_clear_halt(serial->dev, port->read_urb->pipe);
@@ -584,7 +581,7 @@ static int oti6858_open(struct usb_serial_port *port, struct file *filp)
584 return 0; 581 return 0;
585 582
586 if ((buf = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL)) == NULL) { 583 if ((buf = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL)) == NULL) {
587 dev_err(&port->dev, "%s(): out of memory!\n", __FUNCTION__); 584 dev_err(&port->dev, "%s(): out of memory!\n", __func__);
588 return -ENOMEM; 585 return -ENOMEM;
589 } 586 }
590 587
@@ -613,12 +610,12 @@ static int oti6858_open(struct usb_serial_port *port, struct file *filp)
613 spin_unlock_irqrestore(&priv->lock, flags); 610 spin_unlock_irqrestore(&priv->lock, flags);
614 kfree(buf); 611 kfree(buf);
615 612
616 dbg("%s(): submitting interrupt urb", __FUNCTION__); 613 dbg("%s(): submitting interrupt urb", __func__);
617 port->interrupt_in_urb->dev = serial->dev; 614 port->interrupt_in_urb->dev = serial->dev;
618 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); 615 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
619 if (result != 0) { 616 if (result != 0) {
620 dev_err(&port->dev, "%s(): usb_submit_urb() failed" 617 dev_err(&port->dev, "%s(): usb_submit_urb() failed"
621 " with error %d\n", __FUNCTION__, result); 618 " with error %d\n", __func__, result);
622 oti6858_close(port, NULL); 619 oti6858_close(port, NULL);
623 return -EPROTO; 620 return -EPROTO;
624 } 621 }
@@ -637,14 +634,14 @@ static void oti6858_close(struct usb_serial_port *port, struct file *filp)
637 long timeout; 634 long timeout;
638 wait_queue_t wait; 635 wait_queue_t wait;
639 636
640 dbg("%s(port = %d)", __FUNCTION__, port->number); 637 dbg("%s(port = %d)", __func__, port->number);
641 638
642 /* wait for data to drain from the buffer */ 639 /* wait for data to drain from the buffer */
643 spin_lock_irqsave(&priv->lock, flags); 640 spin_lock_irqsave(&priv->lock, flags);
644 timeout = 30 * HZ; /* PL2303_CLOSING_WAIT */ 641 timeout = 30 * HZ; /* PL2303_CLOSING_WAIT */
645 init_waitqueue_entry(&wait, current); 642 init_waitqueue_entry(&wait, current);
646 add_wait_queue(&port->tty->write_wait, &wait); 643 add_wait_queue(&port->tty->write_wait, &wait);
647 dbg("%s(): entering wait loop", __FUNCTION__); 644 dbg("%s(): entering wait loop", __func__);
648 for (;;) { 645 for (;;) {
649 set_current_state(TASK_INTERRUPTIBLE); 646 set_current_state(TASK_INTERRUPTIBLE);
650 if (oti6858_buf_data_avail(priv->buf) == 0 647 if (oti6858_buf_data_avail(priv->buf) == 0
@@ -657,7 +654,7 @@ static void oti6858_close(struct usb_serial_port *port, struct file *filp)
657 } 654 }
658 set_current_state(TASK_RUNNING); 655 set_current_state(TASK_RUNNING);
659 remove_wait_queue(&port->tty->write_wait, &wait); 656 remove_wait_queue(&port->tty->write_wait, &wait);
660 dbg("%s(): after wait loop", __FUNCTION__); 657 dbg("%s(): after wait loop", __func__);
661 658
662 /* clear out any remaining data in the buffer */ 659 /* clear out any remaining data in the buffer */
663 oti6858_buf_clear(priv->buf); 660 oti6858_buf_clear(priv->buf);
@@ -678,7 +675,7 @@ static void oti6858_close(struct usb_serial_port *port, struct file *filp)
678 */ 675 */
679 timeout = 2*HZ; 676 timeout = 2*HZ;
680 schedule_timeout_interruptible(timeout); 677 schedule_timeout_interruptible(timeout);
681 dbg("%s(): after schedule_timeout_interruptible()", __FUNCTION__); 678 dbg("%s(): after schedule_timeout_interruptible()", __func__);
682 679
683 /* cancel scheduled setup */ 680 /* cancel scheduled setup */
684 cancel_delayed_work(&priv->delayed_setup_work); 681 cancel_delayed_work(&priv->delayed_setup_work);
@@ -686,7 +683,7 @@ static void oti6858_close(struct usb_serial_port *port, struct file *filp)
686 flush_scheduled_work(); 683 flush_scheduled_work();
687 684
688 /* shutdown our urbs */ 685 /* shutdown our urbs */
689 dbg("%s(): shutting down urbs", __FUNCTION__); 686 dbg("%s(): shutting down urbs", __func__);
690 usb_kill_urb(port->write_urb); 687 usb_kill_urb(port->write_urb);
691 usb_kill_urb(port->read_urb); 688 usb_kill_urb(port->read_urb);
692 usb_kill_urb(port->interrupt_in_urb); 689 usb_kill_urb(port->interrupt_in_urb);
@@ -709,7 +706,7 @@ static int oti6858_tiocmset(struct usb_serial_port *port, struct file *file,
709 u8 control; 706 u8 control;
710 707
711 dbg("%s(port = %d, set = 0x%08x, clear = 0x%08x)", 708 dbg("%s(port = %d, set = 0x%08x, clear = 0x%08x)",
712 __FUNCTION__, port->number, set, clear); 709 __func__, port->number, set, clear);
713 710
714 if (!usb_get_intfdata(port->serial->interface)) 711 if (!usb_get_intfdata(port->serial->interface))
715 return -ENODEV; 712 return -ENODEV;
@@ -741,7 +738,7 @@ static int oti6858_tiocmget(struct usb_serial_port *port, struct file *file)
741 unsigned pin_state; 738 unsigned pin_state;
742 unsigned result = 0; 739 unsigned result = 0;
743 740
744 dbg("%s(port = %d)", __FUNCTION__, port->number); 741 dbg("%s(port = %d)", __func__, port->number);
745 742
746 if (!usb_get_intfdata(port->serial->interface)) 743 if (!usb_get_intfdata(port->serial->interface))
747 return -ENODEV; 744 return -ENODEV;
@@ -764,7 +761,7 @@ static int oti6858_tiocmget(struct usb_serial_port *port, struct file *file)
764 if ((pin_state & PIN_DCD) != 0) 761 if ((pin_state & PIN_DCD) != 0)
765 result |= TIOCM_CD; 762 result |= TIOCM_CD;
766 763
767 dbg("%s() = 0x%08x", __FUNCTION__, result); 764 dbg("%s() = 0x%08x", __func__, result);
768 765
769 return result; 766 return result;
770} 767}
@@ -811,13 +808,9 @@ static int oti6858_ioctl(struct usb_serial_port *port, struct file *file,
811 unsigned int x; 808 unsigned int x;
812 809
813 dbg("%s(port = %d, cmd = 0x%04x, arg = 0x%08lx)", 810 dbg("%s(port = %d, cmd = 0x%04x, arg = 0x%08lx)",
814 __FUNCTION__, port->number, cmd, arg); 811 __func__, port->number, cmd, arg);
815 812
816 switch (cmd) { 813 switch (cmd) {
817 case TCFLSH:
818 /* FIXME */
819 return 0;
820
821 case TIOCMBIS: 814 case TIOCMBIS:
822 if (copy_from_user(&x, user_arg, sizeof(x))) 815 if (copy_from_user(&x, user_arg, sizeof(x)))
823 return -EFAULT; 816 return -EFAULT;
@@ -829,11 +822,11 @@ static int oti6858_ioctl(struct usb_serial_port *port, struct file *file,
829 return oti6858_tiocmset(port, NULL, 0, x); 822 return oti6858_tiocmset(port, NULL, 0, x);
830 823
831 case TIOCMIWAIT: 824 case TIOCMIWAIT:
832 dbg("%s(): TIOCMIWAIT", __FUNCTION__); 825 dbg("%s(): TIOCMIWAIT", __func__);
833 return wait_modem_info(port, arg); 826 return wait_modem_info(port, arg);
834 827
835 default: 828 default:
836 dbg("%s(): 0x%04x not supported", __FUNCTION__, cmd); 829 dbg("%s(): 0x%04x not supported", __func__, cmd);
837 break; 830 break;
838 } 831 }
839 832
@@ -844,10 +837,10 @@ static void oti6858_break_ctl(struct usb_serial_port *port, int break_state)
844{ 837{
845 int state; 838 int state;
846 839
847 dbg("%s(port = %d)", __FUNCTION__, port->number); 840 dbg("%s(port = %d)", __func__, port->number);
848 841
849 state = (break_state == 0) ? 0 : 1; 842 state = (break_state == 0) ? 0 : 1;
850 dbg("%s(): turning break %s", __FUNCTION__, state ? "on" : "off"); 843 dbg("%s(): turning break %s", __func__, state ? "on" : "off");
851 844
852 /* FIXME */ 845 /* FIXME */
853/* 846/*
@@ -855,7 +848,7 @@ static void oti6858_break_ctl(struct usb_serial_port *port, int break_state)
855 BREAK_REQUEST, BREAK_REQUEST_TYPE, state, 848 BREAK_REQUEST, BREAK_REQUEST_TYPE, state,
856 0, NULL, 0, 100); 849 0, NULL, 0, 100);
857 if (result != 0) 850 if (result != 0)
858 dbg("%s(): error sending break", __FUNCTION__); 851 dbg("%s(): error sending break", __func__);
859 */ 852 */
860} 853}
861 854
@@ -864,7 +857,7 @@ static void oti6858_shutdown(struct usb_serial *serial)
864 struct oti6858_private *priv; 857 struct oti6858_private *priv;
865 int i; 858 int i;
866 859
867 dbg("%s()", __FUNCTION__); 860 dbg("%s()", __func__);
868 861
869 for (i = 0; i < serial->num_ports; ++i) { 862 for (i = 0; i < serial->num_ports; ++i) {
870 priv = usb_get_serial_port_data(serial->port[i]); 863 priv = usb_get_serial_port_data(serial->port[i]);
@@ -878,13 +871,13 @@ static void oti6858_shutdown(struct usb_serial *serial)
878 871
879static void oti6858_read_int_callback(struct urb *urb) 872static void oti6858_read_int_callback(struct urb *urb)
880{ 873{
881 struct usb_serial_port *port = (struct usb_serial_port *) urb->context; 874 struct usb_serial_port *port = urb->context;
882 struct oti6858_private *priv = usb_get_serial_port_data(port); 875 struct oti6858_private *priv = usb_get_serial_port_data(port);
883 int transient = 0, can_recv = 0, resubmit = 1; 876 int transient = 0, can_recv = 0, resubmit = 1;
884 int status = urb->status; 877 int status = urb->status;
885 878
886 dbg("%s(port = %d, status = %d)", 879 dbg("%s(port = %d, status = %d)",
887 __FUNCTION__, port->number, status); 880 __func__, port->number, status);
888 881
889 switch (status) { 882 switch (status) {
890 case 0: 883 case 0:
@@ -895,11 +888,11 @@ static void oti6858_read_int_callback(struct urb *urb)
895 case -ESHUTDOWN: 888 case -ESHUTDOWN:
896 /* this urb is terminated, clean up */ 889 /* this urb is terminated, clean up */
897 dbg("%s(): urb shutting down with status: %d", 890 dbg("%s(): urb shutting down with status: %d",
898 __FUNCTION__, status); 891 __func__, status);
899 return; 892 return;
900 default: 893 default:
901 dbg("%s(): nonzero urb status received: %d", 894 dbg("%s(): nonzero urb status received: %d",
902 __FUNCTION__, status); 895 __func__, status);
903 break; 896 break;
904 } 897 }
905 898
@@ -916,7 +909,7 @@ static void oti6858_read_int_callback(struct urb *urb)
916 priv->setup_done = 0; 909 priv->setup_done = 0;
917 resubmit = 0; 910 resubmit = 0;
918 dbg("%s(): scheduling setup_line()", 911 dbg("%s(): scheduling setup_line()",
919 __FUNCTION__); 912 __func__);
920 schedule_delayed_work(&priv->delayed_setup_work, 0); 913 schedule_delayed_work(&priv->delayed_setup_work, 0);
921 } 914 }
922 } 915 }
@@ -931,7 +924,7 @@ static void oti6858_read_int_callback(struct urb *urb)
931 priv->setup_done = 0; 924 priv->setup_done = 0;
932 resubmit = 0; 925 resubmit = 0;
933 dbg("%s(): scheduling setup_line()", 926 dbg("%s(): scheduling setup_line()",
934 __FUNCTION__); 927 __func__);
935 schedule_delayed_work(&priv->delayed_setup_work, 0); 928 schedule_delayed_work(&priv->delayed_setup_work, 0);
936 } 929 }
937 } 930 }
@@ -960,7 +953,7 @@ static void oti6858_read_int_callback(struct urb *urb)
960 if (result != 0) { 953 if (result != 0) {
961 priv->flags.read_urb_in_use = 0; 954 priv->flags.read_urb_in_use = 0;
962 dev_err(&port->dev, "%s(): usb_submit_urb() failed," 955 dev_err(&port->dev, "%s(): usb_submit_urb() failed,"
963 " error %d\n", __FUNCTION__, result); 956 " error %d\n", __func__, result);
964 } else { 957 } else {
965 resubmit = 0; 958 resubmit = 0;
966 } 959 }
@@ -979,20 +972,20 @@ static void oti6858_read_int_callback(struct urb *urb)
979 if (resubmit) { 972 if (resubmit) {
980 int result; 973 int result;
981 974
982// dbg("%s(): submitting interrupt urb", __FUNCTION__); 975// dbg("%s(): submitting interrupt urb", __func__);
983 urb->dev = port->serial->dev; 976 urb->dev = port->serial->dev;
984 result = usb_submit_urb(urb, GFP_ATOMIC); 977 result = usb_submit_urb(urb, GFP_ATOMIC);
985 if (result != 0) { 978 if (result != 0) {
986 dev_err(&urb->dev->dev, 979 dev_err(&urb->dev->dev,
987 "%s(): usb_submit_urb() failed with" 980 "%s(): usb_submit_urb() failed with"
988 " error %d\n", __FUNCTION__, result); 981 " error %d\n", __func__, result);
989 } 982 }
990 } 983 }
991} 984}
992 985
993static void oti6858_read_bulk_callback(struct urb *urb) 986static void oti6858_read_bulk_callback(struct urb *urb)
994{ 987{
995 struct usb_serial_port *port = (struct usb_serial_port *) urb->context; 988 struct usb_serial_port *port = urb->context;
996 struct oti6858_private *priv = usb_get_serial_port_data(port); 989 struct oti6858_private *priv = usb_get_serial_port_data(port);
997 struct tty_struct *tty; 990 struct tty_struct *tty;
998 unsigned char *data = urb->transfer_buffer; 991 unsigned char *data = urb->transfer_buffer;
@@ -1001,7 +994,7 @@ static void oti6858_read_bulk_callback(struct urb *urb)
1001 int result; 994 int result;
1002 995
1003 dbg("%s(port = %d, status = %d)", 996 dbg("%s(port = %d, status = %d)",
1004 __FUNCTION__, port->number, status); 997 __func__, port->number, status);
1005 998
1006 spin_lock_irqsave(&priv->lock, flags); 999 spin_lock_irqsave(&priv->lock, flags);
1007 priv->flags.read_urb_in_use = 0; 1000 priv->flags.read_urb_in_use = 0;
@@ -1009,20 +1002,20 @@ static void oti6858_read_bulk_callback(struct urb *urb)
1009 1002
1010 if (status != 0) { 1003 if (status != 0) {
1011 if (!port->open_count) { 1004 if (!port->open_count) {
1012 dbg("%s(): port is closed, exiting", __FUNCTION__); 1005 dbg("%s(): port is closed, exiting", __func__);
1013 return; 1006 return;
1014 } 1007 }
1015 /* 1008 /*
1016 if (status == -EPROTO) { 1009 if (status == -EPROTO) {
1017 // PL2303 mysteriously fails with -EPROTO reschedule the read 1010 // PL2303 mysteriously fails with -EPROTO reschedule the read
1018 dbg("%s - caught -EPROTO, resubmitting the urb", __FUNCTION__); 1011 dbg("%s - caught -EPROTO, resubmitting the urb", __func__);
1019 result = usb_submit_urb(urb, GFP_ATOMIC); 1012 result = usb_submit_urb(urb, GFP_ATOMIC);
1020 if (result) 1013 if (result)
1021 dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); 1014 dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __func__, result);
1022 return; 1015 return;
1023 } 1016 }
1024 */ 1017 */
1025 dbg("%s(): unable to handle the error, exiting", __FUNCTION__); 1018 dbg("%s(): unable to handle the error, exiting", __func__);
1026 return; 1019 return;
1027 } 1020 }
1028 1021
@@ -1038,20 +1031,20 @@ static void oti6858_read_bulk_callback(struct urb *urb)
1038 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); 1031 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
1039 if (result != 0) { 1032 if (result != 0) {
1040 dev_err(&port->dev, "%s(): usb_submit_urb() failed," 1033 dev_err(&port->dev, "%s(): usb_submit_urb() failed,"
1041 " error %d\n", __FUNCTION__, result); 1034 " error %d\n", __func__, result);
1042 } 1035 }
1043 } 1036 }
1044} 1037}
1045 1038
1046static void oti6858_write_bulk_callback(struct urb *urb) 1039static void oti6858_write_bulk_callback(struct urb *urb)
1047{ 1040{
1048 struct usb_serial_port *port = (struct usb_serial_port *) urb->context; 1041 struct usb_serial_port *port = urb->context;
1049 struct oti6858_private *priv = usb_get_serial_port_data(port); 1042 struct oti6858_private *priv = usb_get_serial_port_data(port);
1050 int status = urb->status; 1043 int status = urb->status;
1051 int result; 1044 int result;
1052 1045
1053 dbg("%s(port = %d, status = %d)", 1046 dbg("%s(port = %d, status = %d)",
1054 __FUNCTION__, port->number, status); 1047 __func__, port->number, status);
1055 1048
1056 switch (status) { 1049 switch (status) {
1057 case 0: 1050 case 0:
@@ -1062,21 +1055,21 @@ static void oti6858_write_bulk_callback(struct urb *urb)
1062 case -ESHUTDOWN: 1055 case -ESHUTDOWN:
1063 /* this urb is terminated, clean up */ 1056 /* this urb is terminated, clean up */
1064 dbg("%s(): urb shutting down with status: %d", 1057 dbg("%s(): urb shutting down with status: %d",
1065 __FUNCTION__, status); 1058 __func__, status);
1066 priv->flags.write_urb_in_use = 0; 1059 priv->flags.write_urb_in_use = 0;
1067 return; 1060 return;
1068 default: 1061 default:
1069 /* error in the urb, so we have to resubmit it */ 1062 /* error in the urb, so we have to resubmit it */
1070 dbg("%s(): nonzero write bulk status received: %d", 1063 dbg("%s(): nonzero write bulk status received: %d",
1071 __FUNCTION__, status); 1064 __func__, status);
1072 dbg("%s(): overflow in write", __FUNCTION__); 1065 dbg("%s(): overflow in write", __func__);
1073 1066
1074 port->write_urb->transfer_buffer_length = 1; 1067 port->write_urb->transfer_buffer_length = 1;
1075 port->write_urb->dev = port->serial->dev; 1068 port->write_urb->dev = port->serial->dev;
1076 result = usb_submit_urb(port->write_urb, GFP_ATOMIC); 1069 result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
1077 if (result) { 1070 if (result) {
1078 dev_err(&port->dev, "%s(): usb_submit_urb() failed," 1071 dev_err(&port->dev, "%s(): usb_submit_urb() failed,"
1079 " error %d\n", __FUNCTION__, result); 1072 " error %d\n", __func__, result);
1080 } else { 1073 } else {
1081 return; 1074 return;
1082 } 1075 }
@@ -1086,11 +1079,11 @@ static void oti6858_write_bulk_callback(struct urb *urb)
1086 1079
1087 // schedule the interrupt urb if we are still open */ 1080 // schedule the interrupt urb if we are still open */
1088 port->interrupt_in_urb->dev = port->serial->dev; 1081 port->interrupt_in_urb->dev = port->serial->dev;
1089 dbg("%s(): submitting interrupt urb", __FUNCTION__); 1082 dbg("%s(): submitting interrupt urb", __func__);
1090 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); 1083 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
1091 if (result != 0) { 1084 if (result != 0) {
1092 dev_err(&port->dev, "%s(): failed submitting int urb," 1085 dev_err(&port->dev, "%s(): failed submitting int urb,"
1093 " error %d\n", __FUNCTION__, result); 1086 " error %d\n", __func__, result);
1094 } 1087 }
1095} 1088}
1096 1089