aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/mos7840.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/mos7840.c')
-rw-r--r--drivers/usb/serial/mos7840.c164
1 files changed, 80 insertions, 84 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index aeeb9cb20999..6bcb82d3911a 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -403,7 +403,7 @@ static void mos7840_handle_new_lsr(struct moschip_port *port, __u8 new_lsr)
403{ 403{
404 struct async_icount *icount; 404 struct async_icount *icount;
405 405
406 dbg("%s - %02x", __FUNCTION__, new_lsr); 406 dbg("%s - %02x", __func__, new_lsr);
407 407
408 if (new_lsr & SERIAL_LSR_BI) { 408 if (new_lsr & SERIAL_LSR_BI) {
409 // 409 //
@@ -449,7 +449,7 @@ static void mos7840_control_callback(struct urb *urb)
449 int result = 0; 449 int result = 0;
450 int status = urb->status; 450 int status = urb->status;
451 451
452 mos7840_port = (struct moschip_port *)urb->context; 452 mos7840_port = urb->context;
453 453
454 switch (status) { 454 switch (status) {
455 case 0: 455 case 0:
@@ -459,21 +459,21 @@ static void mos7840_control_callback(struct urb *urb)
459 case -ENOENT: 459 case -ENOENT:
460 case -ESHUTDOWN: 460 case -ESHUTDOWN:
461 /* this urb is terminated, clean up */ 461 /* this urb is terminated, clean up */
462 dbg("%s - urb shutting down with status: %d", __FUNCTION__, 462 dbg("%s - urb shutting down with status: %d", __func__,
463 status); 463 status);
464 return; 464 return;
465 default: 465 default:
466 dbg("%s - nonzero urb status received: %d", __FUNCTION__, 466 dbg("%s - nonzero urb status received: %d", __func__,
467 status); 467 status);
468 goto exit; 468 goto exit;
469 } 469 }
470 470
471 dbg("%s urb buffer size is %d\n", __FUNCTION__, urb->actual_length); 471 dbg("%s urb buffer size is %d\n", __func__, urb->actual_length);
472 dbg("%s mos7840_port->MsrLsr is %d port %d\n", __FUNCTION__, 472 dbg("%s mos7840_port->MsrLsr is %d port %d\n", __func__,
473 mos7840_port->MsrLsr, mos7840_port->port_num); 473 mos7840_port->MsrLsr, mos7840_port->port_num);
474 data = urb->transfer_buffer; 474 data = urb->transfer_buffer;
475 regval = (__u8) data[0]; 475 regval = (__u8) data[0];
476 dbg("%s data is %x\n", __FUNCTION__, regval); 476 dbg("%s data is %x\n", __func__, regval);
477 if (mos7840_port->MsrLsr == 0) 477 if (mos7840_port->MsrLsr == 0)
478 mos7840_handle_new_msr(mos7840_port, regval); 478 mos7840_handle_new_msr(mos7840_port, regval);
479 else if (mos7840_port->MsrLsr == 1) 479 else if (mos7840_port->MsrLsr == 1)
@@ -487,7 +487,7 @@ exit:
487 if (result) { 487 if (result) {
488 dev_err(&urb->dev->dev, 488 dev_err(&urb->dev->dev,
489 "%s - Error %d submitting interrupt urb\n", 489 "%s - Error %d submitting interrupt urb\n",
490 __FUNCTION__, result); 490 __func__, result);
491 } 491 }
492} 492}
493 493
@@ -542,11 +542,11 @@ static void mos7840_interrupt_callback(struct urb *urb)
542 case -ENOENT: 542 case -ENOENT:
543 case -ESHUTDOWN: 543 case -ESHUTDOWN:
544 /* this urb is terminated, clean up */ 544 /* this urb is terminated, clean up */
545 dbg("%s - urb shutting down with status: %d", __FUNCTION__, 545 dbg("%s - urb shutting down with status: %d", __func__,
546 status); 546 status);
547 return; 547 return;
548 default: 548 default:
549 dbg("%s - nonzero urb status received: %d", __FUNCTION__, 549 dbg("%s - nonzero urb status received: %d", __func__,
550 status); 550 status);
551 goto exit; 551 goto exit;
552 } 552 }
@@ -554,7 +554,7 @@ static void mos7840_interrupt_callback(struct urb *urb)
554 length = urb->actual_length; 554 length = urb->actual_length;
555 data = urb->transfer_buffer; 555 data = urb->transfer_buffer;
556 556
557 serial = (struct usb_serial *)urb->context; 557 serial = urb->context;
558 558
559 /* Moschip get 5 bytes 559 /* Moschip get 5 bytes
560 * Byte 1 IIR Port 1 (port.number is 0) 560 * Byte 1 IIR Port 1 (port.number is 0)
@@ -614,7 +614,7 @@ exit:
614 if (result) { 614 if (result) {
615 dev_err(&urb->dev->dev, 615 dev_err(&urb->dev->dev,
616 "%s - Error %d submitting interrupt urb\n", 616 "%s - Error %d submitting interrupt urb\n",
617 __FUNCTION__, result); 617 __func__, result);
618 } 618 }
619} 619}
620 620
@@ -685,19 +685,19 @@ static void mos7840_bulk_in_callback(struct urb *urb)
685 return; 685 return;
686 } 686 }
687 687
688 mos7840_port = (struct moschip_port *)urb->context; 688 mos7840_port = urb->context;
689 if (!mos7840_port) { 689 if (!mos7840_port) {
690 dbg("%s", "NULL mos7840_port pointer \n"); 690 dbg("%s", "NULL mos7840_port pointer \n");
691 return; 691 return;
692 } 692 }
693 693
694 port = (struct usb_serial_port *)mos7840_port->port; 694 port = (struct usb_serial_port *)mos7840_port->port;
695 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 695 if (mos7840_port_paranoia_check(port, __func__)) {
696 dbg("%s", "Port Paranoia failed \n"); 696 dbg("%s", "Port Paranoia failed \n");
697 return; 697 return;
698 } 698 }
699 699
700 serial = mos7840_get_usb_serial(port, __FUNCTION__); 700 serial = mos7840_get_usb_serial(port, __func__);
701 if (!serial) { 701 if (!serial) {
702 dbg("%s\n", "Bad serial pointer "); 702 dbg("%s\n", "Bad serial pointer ");
703 return; 703 return;
@@ -752,7 +752,7 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
752 int status = urb->status; 752 int status = urb->status;
753 int i; 753 int i;
754 754
755 mos7840_port = (struct moschip_port *)urb->context; 755 mos7840_port = urb->context;
756 spin_lock(&mos7840_port->pool_lock); 756 spin_lock(&mos7840_port->pool_lock);
757 for (i = 0; i < NUM_URBS; i++) { 757 for (i = 0; i < NUM_URBS; i++) {
758 if (urb == mos7840_port->write_urb_pool[i]) { 758 if (urb == mos7840_port->write_urb_pool[i]) {
@@ -767,7 +767,7 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
767 return; 767 return;
768 } 768 }
769 769
770 if (mos7840_port_paranoia_check(mos7840_port->port, __FUNCTION__)) { 770 if (mos7840_port_paranoia_check(mos7840_port->port, __func__)) {
771 dbg("%s", "Port Paranoia failed \n"); 771 dbg("%s", "Port Paranoia failed \n");
772 return; 772 return;
773 } 773 }
@@ -815,14 +815,14 @@ static int mos7840_open(struct usb_serial_port *port, struct file *filp)
815 struct moschip_port *mos7840_port; 815 struct moschip_port *mos7840_port;
816 struct moschip_port *port0; 816 struct moschip_port *port0;
817 817
818 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 818 if (mos7840_port_paranoia_check(port, __func__)) {
819 dbg("%s", "Port Paranoia failed \n"); 819 dbg("%s", "Port Paranoia failed \n");
820 return -ENODEV; 820 return -ENODEV;
821 } 821 }
822 822
823 serial = port->serial; 823 serial = port->serial;
824 824
825 if (mos7840_serial_paranoia_check(serial, __FUNCTION__)) { 825 if (mos7840_serial_paranoia_check(serial, __func__)) {
826 dbg("%s", "Serial Paranoia failed \n"); 826 dbg("%s", "Serial Paranoia failed \n");
827 return -ENODEV; 827 return -ENODEV;
828 } 828 }
@@ -851,7 +851,7 @@ static int mos7840_open(struct usb_serial_port *port, struct file *filp)
851 if (!urb->transfer_buffer) { 851 if (!urb->transfer_buffer) {
852 usb_free_urb(urb); 852 usb_free_urb(urb);
853 mos7840_port->write_urb_pool[j] = NULL; 853 mos7840_port->write_urb_pool[j] = NULL;
854 err("%s-out of memory for urb buffers.", __FUNCTION__); 854 err("%s-out of memory for urb buffers.", __func__);
855 continue; 855 continue;
856 } 856 }
857 } 857 }
@@ -1039,7 +1039,7 @@ static int mos7840_open(struct usb_serial_port *port, struct file *filp)
1039 GFP_KERNEL); 1039 GFP_KERNEL);
1040 if (response) { 1040 if (response) {
1041 err("%s - Error %d submitting interrupt urb", 1041 err("%s - Error %d submitting interrupt urb",
1042 __FUNCTION__, response); 1042 __func__, response);
1043 } 1043 }
1044 1044
1045 } 1045 }
@@ -1072,7 +1072,7 @@ static int mos7840_open(struct usb_serial_port *port, struct file *filp)
1072 port->bulk_in_endpointAddress); 1072 port->bulk_in_endpointAddress);
1073 response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); 1073 response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL);
1074 if (response) { 1074 if (response) {
1075 err("%s - Error %d submitting control urb", __FUNCTION__, 1075 err("%s - Error %d submitting control urb", __func__,
1076 response); 1076 response);
1077 } 1077 }
1078 1078
@@ -1116,7 +1116,7 @@ static int mos7840_chars_in_buffer(struct usb_serial_port *port)
1116 1116
1117 dbg("%s \n", " mos7840_chars_in_buffer:entering ..........."); 1117 dbg("%s \n", " mos7840_chars_in_buffer:entering ...........");
1118 1118
1119 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 1119 if (mos7840_port_paranoia_check(port, __func__)) {
1120 dbg("%s", "Invalid port \n"); 1120 dbg("%s", "Invalid port \n");
1121 return -1; 1121 return -1;
1122 } 1122 }
@@ -1134,7 +1134,7 @@ static int mos7840_chars_in_buffer(struct usb_serial_port *port)
1134 } 1134 }
1135 } 1135 }
1136 spin_unlock_irqrestore(&mos7840_port->pool_lock,flags); 1136 spin_unlock_irqrestore(&mos7840_port->pool_lock,flags);
1137 dbg("%s - returns %d", __FUNCTION__, chars); 1137 dbg("%s - returns %d", __func__, chars);
1138 return chars; 1138 return chars;
1139 1139
1140} 1140}
@@ -1171,7 +1171,7 @@ static void mos7840_block_until_tx_empty(struct moschip_port *mos7840_port)
1171 /* No activity.. count down section */ 1171 /* No activity.. count down section */
1172 wait--; 1172 wait--;
1173 if (wait == 0) { 1173 if (wait == 0) {
1174 dbg("%s - TIMEOUT", __FUNCTION__); 1174 dbg("%s - TIMEOUT", __func__);
1175 return; 1175 return;
1176 } else { 1176 } else {
1177 /* Reset timeout value back to seconds */ 1177 /* Reset timeout value back to seconds */
@@ -1195,12 +1195,12 @@ static void mos7840_close(struct usb_serial_port *port, struct file *filp)
1195 1195
1196 dbg("%s\n", "mos7840_close:entering..."); 1196 dbg("%s\n", "mos7840_close:entering...");
1197 1197
1198 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 1198 if (mos7840_port_paranoia_check(port, __func__)) {
1199 dbg("%s", "Port Paranoia failed \n"); 1199 dbg("%s", "Port Paranoia failed \n");
1200 return; 1200 return;
1201 } 1201 }
1202 1202
1203 serial = mos7840_get_usb_serial(port, __FUNCTION__); 1203 serial = mos7840_get_usb_serial(port, __func__);
1204 if (!serial) { 1204 if (!serial) {
1205 dbg("%s", "Serial Paranoia failed \n"); 1205 dbg("%s", "Serial Paranoia failed \n");
1206 return; 1206 return;
@@ -1314,7 +1314,7 @@ static void mos7840_block_until_chase_response(struct moschip_port
1314 /* No activity.. count down section */ 1314 /* No activity.. count down section */
1315 wait--; 1315 wait--;
1316 if (wait == 0) { 1316 if (wait == 0) {
1317 dbg("%s - TIMEOUT", __FUNCTION__); 1317 dbg("%s - TIMEOUT", __func__);
1318 return; 1318 return;
1319 } else { 1319 } else {
1320 /* Reset timeout value back to seconds */ 1320 /* Reset timeout value back to seconds */
@@ -1337,12 +1337,12 @@ static void mos7840_break(struct usb_serial_port *port, int break_state)
1337 dbg("%s \n", "Entering ..........."); 1337 dbg("%s \n", "Entering ...........");
1338 dbg("mos7840_break: Start\n"); 1338 dbg("mos7840_break: Start\n");
1339 1339
1340 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 1340 if (mos7840_port_paranoia_check(port, __func__)) {
1341 dbg("%s", "Port Paranoia failed \n"); 1341 dbg("%s", "Port Paranoia failed \n");
1342 return; 1342 return;
1343 } 1343 }
1344 1344
1345 serial = mos7840_get_usb_serial(port, __FUNCTION__); 1345 serial = mos7840_get_usb_serial(port, __func__);
1346 if (!serial) { 1346 if (!serial) {
1347 dbg("%s", "Serial Paranoia failed \n"); 1347 dbg("%s", "Serial Paranoia failed \n");
1348 return; 1348 return;
@@ -1392,7 +1392,7 @@ static int mos7840_write_room(struct usb_serial_port *port)
1392 1392
1393 dbg("%s \n", " mos7840_write_room:entering ..........."); 1393 dbg("%s \n", " mos7840_write_room:entering ...........");
1394 1394
1395 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 1395 if (mos7840_port_paranoia_check(port, __func__)) {
1396 dbg("%s", "Invalid port \n"); 1396 dbg("%s", "Invalid port \n");
1397 dbg("%s \n", " mos7840_write_room:leaving ..........."); 1397 dbg("%s \n", " mos7840_write_room:leaving ...........");
1398 return -1; 1398 return -1;
@@ -1413,7 +1413,7 @@ static int mos7840_write_room(struct usb_serial_port *port)
1413 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); 1413 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
1414 1414
1415 room = (room == 0) ? 0 : room - URB_TRANSFER_BUFFER_SIZE + 1; 1415 room = (room == 0) ? 0 : room - URB_TRANSFER_BUFFER_SIZE + 1;
1416 dbg("%s - returns %d", __FUNCTION__, room); 1416 dbg("%s - returns %d", __func__, room);
1417 return room; 1417 return room;
1418 1418
1419} 1419}
@@ -1480,13 +1480,13 @@ static int mos7840_write(struct usb_serial_port *port,
1480 status = mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, Data); 1480 status = mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, Data);
1481#endif 1481#endif
1482 1482
1483 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 1483 if (mos7840_port_paranoia_check(port, __func__)) {
1484 dbg("%s", "Port Paranoia failed \n"); 1484 dbg("%s", "Port Paranoia failed \n");
1485 return -1; 1485 return -1;
1486 } 1486 }
1487 1487
1488 serial = port->serial; 1488 serial = port->serial;
1489 if (mos7840_serial_paranoia_check(serial, __FUNCTION__)) { 1489 if (mos7840_serial_paranoia_check(serial, __func__)) {
1490 dbg("%s", "Serial Paranoia failed \n"); 1490 dbg("%s", "Serial Paranoia failed \n");
1491 return -1; 1491 return -1;
1492 } 1492 }
@@ -1512,7 +1512,7 @@ static int mos7840_write(struct usb_serial_port *port,
1512 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); 1512 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
1513 1513
1514 if (urb == NULL) { 1514 if (urb == NULL) {
1515 dbg("%s - no more free urbs", __FUNCTION__); 1515 dbg("%s - no more free urbs", __func__);
1516 goto exit; 1516 goto exit;
1517 } 1517 }
1518 1518
@@ -1521,7 +1521,7 @@ static int mos7840_write(struct usb_serial_port *port,
1521 kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); 1521 kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL);
1522 1522
1523 if (urb->transfer_buffer == NULL) { 1523 if (urb->transfer_buffer == NULL) {
1524 err("%s no more kernel memory...", __FUNCTION__); 1524 err("%s no more kernel memory...", __func__);
1525 goto exit; 1525 goto exit;
1526 } 1526 }
1527 } 1527 }
@@ -1547,7 +1547,7 @@ static int mos7840_write(struct usb_serial_port *port,
1547 if (status) { 1547 if (status) {
1548 mos7840_port->busy[i] = 0; 1548 mos7840_port->busy[i] = 0;
1549 err("%s - usb_submit_urb(write bulk) failed with status = %d", 1549 err("%s - usb_submit_urb(write bulk) failed with status = %d",
1550 __FUNCTION__, status); 1550 __func__, status);
1551 bytes_sent = status; 1551 bytes_sent = status;
1552 goto exit; 1552 goto exit;
1553 } 1553 }
@@ -1573,7 +1573,7 @@ static void mos7840_throttle(struct usb_serial_port *port)
1573 struct tty_struct *tty; 1573 struct tty_struct *tty;
1574 int status; 1574 int status;
1575 1575
1576 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 1576 if (mos7840_port_paranoia_check(port, __func__)) {
1577 dbg("%s", "Invalid port \n"); 1577 dbg("%s", "Invalid port \n");
1578 return; 1578 return;
1579 } 1579 }
@@ -1594,7 +1594,7 @@ static void mos7840_throttle(struct usb_serial_port *port)
1594 1594
1595 tty = port->tty; 1595 tty = port->tty;
1596 if (!tty) { 1596 if (!tty) {
1597 dbg("%s - no tty available", __FUNCTION__); 1597 dbg("%s - no tty available", __func__);
1598 return; 1598 return;
1599 } 1599 }
1600 1600
@@ -1634,7 +1634,7 @@ static void mos7840_unthrottle(struct usb_serial_port *port)
1634 int status; 1634 int status;
1635 struct moschip_port *mos7840_port = mos7840_get_port_private(port); 1635 struct moschip_port *mos7840_port = mos7840_get_port_private(port);
1636 1636
1637 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 1637 if (mos7840_port_paranoia_check(port, __func__)) {
1638 dbg("%s", "Invalid port \n"); 1638 dbg("%s", "Invalid port \n");
1639 return; 1639 return;
1640 } 1640 }
@@ -1643,7 +1643,7 @@ static void mos7840_unthrottle(struct usb_serial_port *port)
1643 return; 1643 return;
1644 1644
1645 if (!mos7840_port->open) { 1645 if (!mos7840_port->open) {
1646 dbg("%s - port not opened", __FUNCTION__); 1646 dbg("%s - port not opened", __func__);
1647 return; 1647 return;
1648 } 1648 }
1649 1649
@@ -1651,7 +1651,7 @@ static void mos7840_unthrottle(struct usb_serial_port *port)
1651 1651
1652 tty = port->tty; 1652 tty = port->tty;
1653 if (!tty) { 1653 if (!tty) {
1654 dbg("%s - no tty available", __FUNCTION__); 1654 dbg("%s - no tty available", __func__);
1655 return; 1655 return;
1656 } 1656 }
1657 1657
@@ -1688,7 +1688,7 @@ static int mos7840_tiocmget(struct usb_serial_port *port, struct file *file)
1688 int status = 0; 1688 int status = 0;
1689 mos7840_port = mos7840_get_port_private(port); 1689 mos7840_port = mos7840_get_port_private(port);
1690 1690
1691 dbg("%s - port %d", __FUNCTION__, port->number); 1691 dbg("%s - port %d", __func__, port->number);
1692 1692
1693 if (mos7840_port == NULL) 1693 if (mos7840_port == NULL)
1694 return -ENODEV; 1694 return -ENODEV;
@@ -1703,7 +1703,7 @@ static int mos7840_tiocmget(struct usb_serial_port *port, struct file *file)
1703 | ((msr & MOS7840_MSR_RI) ? TIOCM_RI : 0) 1703 | ((msr & MOS7840_MSR_RI) ? TIOCM_RI : 0)
1704 | ((msr & MOS7840_MSR_DSR) ? TIOCM_DSR : 0); 1704 | ((msr & MOS7840_MSR_DSR) ? TIOCM_DSR : 0);
1705 1705
1706 dbg("%s - 0x%04X", __FUNCTION__, result); 1706 dbg("%s - 0x%04X", __func__, result);
1707 1707
1708 return result; 1708 return result;
1709} 1709}
@@ -1715,13 +1715,14 @@ static int mos7840_tiocmset(struct usb_serial_port *port, struct file *file,
1715 unsigned int mcr; 1715 unsigned int mcr;
1716 unsigned int status; 1716 unsigned int status;
1717 1717
1718 dbg("%s - port %d", __FUNCTION__, port->number); 1718 dbg("%s - port %d", __func__, port->number);
1719 1719
1720 mos7840_port = mos7840_get_port_private(port); 1720 mos7840_port = mos7840_get_port_private(port);
1721 1721
1722 if (mos7840_port == NULL) 1722 if (mos7840_port == NULL)
1723 return -ENODEV; 1723 return -ENODEV;
1724 1724
1725 /* FIXME: What locks the port registers ? */
1725 mcr = mos7840_port->shadowMCR; 1726 mcr = mos7840_port->shadowMCR;
1726 if (clear & TIOCM_RTS) 1727 if (clear & TIOCM_RTS)
1727 mcr &= ~MCR_RTS; 1728 mcr &= ~MCR_RTS;
@@ -1758,7 +1759,7 @@ static int mos7840_calc_baud_rate_divisor(int baudRate, int *divisor,
1758 __u16 * clk_sel_val) 1759 __u16 * clk_sel_val)
1759{ 1760{
1760 1761
1761 dbg("%s - %d", __FUNCTION__, baudRate); 1762 dbg("%s - %d", __func__, baudRate);
1762 1763
1763 if (baudRate <= 115200) { 1764 if (baudRate <= 115200) {
1764 *divisor = 115200 / baudRate; 1765 *divisor = 115200 / baudRate;
@@ -1841,12 +1842,12 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port,
1841 return -1; 1842 return -1;
1842 1843
1843 port = (struct usb_serial_port *)mos7840_port->port; 1844 port = (struct usb_serial_port *)mos7840_port->port;
1844 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 1845 if (mos7840_port_paranoia_check(port, __func__)) {
1845 dbg("%s", "Invalid port \n"); 1846 dbg("%s", "Invalid port \n");
1846 return -1; 1847 return -1;
1847 } 1848 }
1848 1849
1849 if (mos7840_serial_paranoia_check(port->serial, __FUNCTION__)) { 1850 if (mos7840_serial_paranoia_check(port->serial, __func__)) {
1850 dbg("%s", "Invalid Serial \n"); 1851 dbg("%s", "Invalid Serial \n");
1851 return -1; 1852 return -1;
1852 } 1853 }
@@ -1855,7 +1856,7 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port,
1855 1856
1856 number = mos7840_port->port->number - mos7840_port->port->serial->minor; 1857 number = mos7840_port->port->number - mos7840_port->port->serial->minor;
1857 1858
1858 dbg("%s - port = %d, baud = %d", __FUNCTION__, 1859 dbg("%s - port = %d, baud = %d", __func__,
1859 mos7840_port->port->number, baudRate); 1860 mos7840_port->port->number, baudRate);
1860 //reset clk_uart_sel in spregOffset 1861 //reset clk_uart_sel in spregOffset
1861 if (baudRate > 115200) { 1862 if (baudRate > 115200) {
@@ -1915,7 +1916,7 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port,
1915 /* Calculate the Divisor */ 1916 /* Calculate the Divisor */
1916 1917
1917 if (status) { 1918 if (status) {
1918 err("%s - bad baud rate", __FUNCTION__); 1919 err("%s - bad baud rate", __func__);
1919 dbg("%s\n", "bad baud rate"); 1920 dbg("%s\n", "bad baud rate");
1920 return status; 1921 return status;
1921 } 1922 }
@@ -1969,22 +1970,22 @@ static void mos7840_change_port_settings(struct moschip_port *mos7840_port,
1969 1970
1970 port = (struct usb_serial_port *)mos7840_port->port; 1971 port = (struct usb_serial_port *)mos7840_port->port;
1971 1972
1972 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 1973 if (mos7840_port_paranoia_check(port, __func__)) {
1973 dbg("%s", "Invalid port \n"); 1974 dbg("%s", "Invalid port \n");
1974 return; 1975 return;
1975 } 1976 }
1976 1977
1977 if (mos7840_serial_paranoia_check(port->serial, __FUNCTION__)) { 1978 if (mos7840_serial_paranoia_check(port->serial, __func__)) {
1978 dbg("%s", "Invalid Serial \n"); 1979 dbg("%s", "Invalid Serial \n");
1979 return; 1980 return;
1980 } 1981 }
1981 1982
1982 serial = port->serial; 1983 serial = port->serial;
1983 1984
1984 dbg("%s - port %d", __FUNCTION__, mos7840_port->port->number); 1985 dbg("%s - port %d", __func__, mos7840_port->port->number);
1985 1986
1986 if (!mos7840_port->open) { 1987 if (!mos7840_port->open) {
1987 dbg("%s - port not opened", __FUNCTION__); 1988 dbg("%s - port not opened", __func__);
1988 return; 1989 return;
1989 } 1990 }
1990 1991
@@ -2023,14 +2024,14 @@ static void mos7840_change_port_settings(struct moschip_port *mos7840_port,
2023 if (cflag & PARENB) { 2024 if (cflag & PARENB) {
2024 if (cflag & PARODD) { 2025 if (cflag & PARODD) {
2025 lParity = LCR_PAR_ODD; 2026 lParity = LCR_PAR_ODD;
2026 dbg("%s - parity = odd", __FUNCTION__); 2027 dbg("%s - parity = odd", __func__);
2027 } else { 2028 } else {
2028 lParity = LCR_PAR_EVEN; 2029 lParity = LCR_PAR_EVEN;
2029 dbg("%s - parity = even", __FUNCTION__); 2030 dbg("%s - parity = even", __func__);
2030 } 2031 }
2031 2032
2032 } else { 2033 } else {
2033 dbg("%s - parity = none", __FUNCTION__); 2034 dbg("%s - parity = none", __func__);
2034 } 2035 }
2035 2036
2036 if (cflag & CMSPAR) { 2037 if (cflag & CMSPAR) {
@@ -2040,10 +2041,10 @@ static void mos7840_change_port_settings(struct moschip_port *mos7840_port,
2040 /* Change the Stop bit */ 2041 /* Change the Stop bit */
2041 if (cflag & CSTOPB) { 2042 if (cflag & CSTOPB) {
2042 lStop = LCR_STOP_2; 2043 lStop = LCR_STOP_2;
2043 dbg("%s - stop bits = 2", __FUNCTION__); 2044 dbg("%s - stop bits = 2", __func__);
2044 } else { 2045 } else {
2045 lStop = LCR_STOP_1; 2046 lStop = LCR_STOP_1;
2046 dbg("%s - stop bits = 1", __FUNCTION__); 2047 dbg("%s - stop bits = 1", __func__);
2047 } 2048 }
2048 2049
2049 /* Update the LCR with the correct value */ 2050 /* Update the LCR with the correct value */
@@ -2100,7 +2101,7 @@ static void mos7840_change_port_settings(struct moschip_port *mos7840_port,
2100 baud = 9600; 2101 baud = 9600;
2101 } 2102 }
2102 2103
2103 dbg("%s - baud rate = %d", __FUNCTION__, baud); 2104 dbg("%s - baud rate = %d", __func__, baud);
2104 status = mos7840_send_cmd_write_baud_rate(mos7840_port, baud); 2105 status = mos7840_send_cmd_write_baud_rate(mos7840_port, baud);
2105 2106
2106 /* Enable Interrupts */ 2107 /* Enable Interrupts */
@@ -2140,14 +2141,14 @@ static void mos7840_set_termios(struct usb_serial_port *port,
2140 struct moschip_port *mos7840_port; 2141 struct moschip_port *mos7840_port;
2141 struct tty_struct *tty; 2142 struct tty_struct *tty;
2142 dbg("mos7840_set_termios: START\n"); 2143 dbg("mos7840_set_termios: START\n");
2143 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 2144 if (mos7840_port_paranoia_check(port, __func__)) {
2144 dbg("%s", "Invalid port \n"); 2145 dbg("%s", "Invalid port \n");
2145 return; 2146 return;
2146 } 2147 }
2147 2148
2148 serial = port->serial; 2149 serial = port->serial;
2149 2150
2150 if (mos7840_serial_paranoia_check(serial, __FUNCTION__)) { 2151 if (mos7840_serial_paranoia_check(serial, __func__)) {
2151 dbg("%s", "Invalid Serial \n"); 2152 dbg("%s", "Invalid Serial \n");
2152 return; 2153 return;
2153 } 2154 }
@@ -2160,7 +2161,7 @@ static void mos7840_set_termios(struct usb_serial_port *port,
2160 tty = port->tty; 2161 tty = port->tty;
2161 2162
2162 if (!mos7840_port->open) { 2163 if (!mos7840_port->open) {
2163 dbg("%s - port not opened", __FUNCTION__); 2164 dbg("%s - port not opened", __func__);
2164 return; 2165 return;
2165 } 2166 }
2166 2167
@@ -2168,11 +2169,11 @@ static void mos7840_set_termios(struct usb_serial_port *port,
2168 2169
2169 cflag = tty->termios->c_cflag; 2170 cflag = tty->termios->c_cflag;
2170 2171
2171 dbg("%s - clfag %08x iflag %08x", __FUNCTION__, 2172 dbg("%s - clfag %08x iflag %08x", __func__,
2172 tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag)); 2173 tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag));
2173 dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__, 2174 dbg("%s - old clfag %08x old iflag %08x", __func__,
2174 old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag)); 2175 old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag));
2175 dbg("%s - port %d", __FUNCTION__, port->number); 2176 dbg("%s - port %d", __func__, port->number);
2176 2177
2177 /* change the port settings to the new ones specified */ 2178 /* change the port settings to the new ones specified */
2178 2179
@@ -2213,7 +2214,7 @@ static int mos7840_get_lsr_info(struct moschip_port *mos7840_port,
2213 2214
2214 count = mos7840_chars_in_buffer(mos7840_port->port); 2215 count = mos7840_chars_in_buffer(mos7840_port->port);
2215 if (count == 0) { 2216 if (count == 0) {
2216 dbg("%s -- Empty", __FUNCTION__); 2217 dbg("%s -- Empty", __func__);
2217 result = TIOCSER_TEMT; 2218 result = TIOCSER_TEMT;
2218 } 2219 }
2219 2220
@@ -2240,7 +2241,7 @@ static int mos7840_set_modem_info(struct moschip_port *mos7840_port,
2240 return -1; 2241 return -1;
2241 2242
2242 port = (struct usb_serial_port *)mos7840_port->port; 2243 port = (struct usb_serial_port *)mos7840_port->port;
2243 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 2244 if (mos7840_port_paranoia_check(port, __func__)) {
2244 dbg("%s", "Invalid port \n"); 2245 dbg("%s", "Invalid port \n");
2245 return -1; 2246 return -1;
2246 } 2247 }
@@ -2314,7 +2315,7 @@ static int mos7840_get_modem_info(struct moschip_port *mos7840_port,
2314 |((msr & MOS7840_MSR_RI) ? TIOCM_RI : 0) /* 0x080 */ 2315 |((msr & MOS7840_MSR_RI) ? TIOCM_RI : 0) /* 0x080 */
2315 |((msr & MOS7840_MSR_DSR) ? TIOCM_DSR : 0); /* 0x100 */ 2316 |((msr & MOS7840_MSR_DSR) ? TIOCM_DSR : 0); /* 0x100 */
2316 2317
2317 dbg("%s -- %x", __FUNCTION__, result); 2318 dbg("%s -- %x", __func__, result);
2318 2319
2319 if (copy_to_user(value, &result, sizeof(int))) 2320 if (copy_to_user(value, &result, sizeof(int)))
2320 return -EFAULT; 2321 return -EFAULT;
@@ -2371,7 +2372,7 @@ static int mos7840_ioctl(struct usb_serial_port *port, struct file *file,
2371 struct serial_icounter_struct icount; 2372 struct serial_icounter_struct icount;
2372 int mosret = 0; 2373 int mosret = 0;
2373 2374
2374 if (mos7840_port_paranoia_check(port, __FUNCTION__)) { 2375 if (mos7840_port_paranoia_check(port, __func__)) {
2375 dbg("%s", "Invalid port \n"); 2376 dbg("%s", "Invalid port \n");
2376 return -1; 2377 return -1;
2377 } 2378 }
@@ -2383,39 +2384,39 @@ static int mos7840_ioctl(struct usb_serial_port *port, struct file *file,
2383 2384
2384 tty = mos7840_port->port->tty; 2385 tty = mos7840_port->port->tty;
2385 2386
2386 dbg("%s - port %d, cmd = 0x%x", __FUNCTION__, port->number, cmd); 2387 dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd);
2387 2388
2388 switch (cmd) { 2389 switch (cmd) {
2389 /* return number of bytes available */ 2390 /* return number of bytes available */
2390 2391
2391 case TIOCSERGETLSR: 2392 case TIOCSERGETLSR:
2392 dbg("%s (%d) TIOCSERGETLSR", __FUNCTION__, port->number); 2393 dbg("%s (%d) TIOCSERGETLSR", __func__, port->number);
2393 return mos7840_get_lsr_info(mos7840_port, argp); 2394 return mos7840_get_lsr_info(mos7840_port, argp);
2394 return 0; 2395 return 0;
2395 2396
2396 case TIOCMBIS: 2397 case TIOCMBIS:
2397 case TIOCMBIC: 2398 case TIOCMBIC:
2398 case TIOCMSET: 2399 case TIOCMSET:
2399 dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __FUNCTION__, 2400 dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __func__,
2400 port->number); 2401 port->number);
2401 mosret = 2402 mosret =
2402 mos7840_set_modem_info(mos7840_port, cmd, argp); 2403 mos7840_set_modem_info(mos7840_port, cmd, argp);
2403 return mosret; 2404 return mosret;
2404 2405
2405 case TIOCMGET: 2406 case TIOCMGET:
2406 dbg("%s (%d) TIOCMGET", __FUNCTION__, port->number); 2407 dbg("%s (%d) TIOCMGET", __func__, port->number);
2407 return mos7840_get_modem_info(mos7840_port, argp); 2408 return mos7840_get_modem_info(mos7840_port, argp);
2408 2409
2409 case TIOCGSERIAL: 2410 case TIOCGSERIAL:
2410 dbg("%s (%d) TIOCGSERIAL", __FUNCTION__, port->number); 2411 dbg("%s (%d) TIOCGSERIAL", __func__, port->number);
2411 return mos7840_get_serial_info(mos7840_port, argp); 2412 return mos7840_get_serial_info(mos7840_port, argp);
2412 2413
2413 case TIOCSSERIAL: 2414 case TIOCSSERIAL:
2414 dbg("%s (%d) TIOCSSERIAL", __FUNCTION__, port->number); 2415 dbg("%s (%d) TIOCSSERIAL", __func__, port->number);
2415 break; 2416 break;
2416 2417
2417 case TIOCMIWAIT: 2418 case TIOCMIWAIT:
2418 dbg("%s (%d) TIOCMIWAIT", __FUNCTION__, port->number); 2419 dbg("%s (%d) TIOCMIWAIT", __func__, port->number);
2419 cprev = mos7840_port->icount; 2420 cprev = mos7840_port->icount;
2420 while (1) { 2421 while (1) {
2421 //interruptible_sleep_on(&mos7840_port->delta_msr_wait); 2422 //interruptible_sleep_on(&mos7840_port->delta_msr_wait);
@@ -2458,7 +2459,7 @@ static int mos7840_ioctl(struct usb_serial_port *port, struct file *file,
2458 icount.brk = cnow.brk; 2459 icount.brk = cnow.brk;
2459 icount.buf_overrun = cnow.buf_overrun; 2460 icount.buf_overrun = cnow.buf_overrun;
2460 2461
2461 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __FUNCTION__, 2462 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
2462 port->number, icount.rx, icount.tx); 2463 port->number, icount.rx, icount.tx);
2463 if (copy_to_user(argp, &icount, sizeof(icount))) 2464 if (copy_to_user(argp, &icount, sizeof(icount)))
2464 return -EFAULT; 2465 return -EFAULT;
@@ -2521,7 +2522,7 @@ static int mos7840_startup(struct usb_serial *serial)
2521 for (i = 0; i < serial->num_ports; ++i) { 2522 for (i = 0; i < serial->num_ports; ++i) {
2522 mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); 2523 mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL);
2523 if (mos7840_port == NULL) { 2524 if (mos7840_port == NULL) {
2524 err("%s - Out of memory", __FUNCTION__); 2525 err("%s - Out of memory", __func__);
2525 status = -ENOMEM; 2526 status = -ENOMEM;
2526 i--; /* don't follow NULL pointer cleaning up */ 2527 i--; /* don't follow NULL pointer cleaning up */
2527 goto error; 2528 goto error;
@@ -2799,12 +2800,7 @@ static struct usb_serial_driver moschip7840_4port_device = {
2799 .description = DRIVER_DESC, 2800 .description = DRIVER_DESC,
2800 .usb_driver = &io_driver, 2801 .usb_driver = &io_driver,
2801 .id_table = moschip_port_id_table, 2802 .id_table = moschip_port_id_table,
2802 .num_interrupt_in = 1, //NUM_DONT_CARE,//1,
2803#ifdef check
2804 .num_bulk_in = 4,
2805 .num_bulk_out = 4,
2806 .num_ports = 4, 2803 .num_ports = 4,
2807#endif
2808 .open = mos7840_open, 2804 .open = mos7840_open,
2809 .close = mos7840_close, 2805 .close = mos7840_close,
2810 .write = mos7840_write, 2806 .write = mos7840_write,