diff options
-rw-r--r-- | drivers/usb/serial/mos7840.c | 473 |
1 files changed, 183 insertions, 290 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 2f6da1e89bfa..ffbe4eed2057 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -265,7 +265,7 @@ static int mos7840_set_reg_sync(struct usb_serial_port *port, __u16 reg, | |||
265 | { | 265 | { |
266 | struct usb_device *dev = port->serial->dev; | 266 | struct usb_device *dev = port->serial->dev; |
267 | val = val & 0x00ff; | 267 | val = val & 0x00ff; |
268 | dbg("mos7840_set_reg_sync offset is %x, value %x", reg, val); | 268 | dev_dbg(&port->dev, "mos7840_set_reg_sync offset is %x, value %x\n", reg, val); |
269 | 269 | ||
270 | return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), MCS_WRREQ, | 270 | return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), MCS_WRREQ, |
271 | MCS_WR_RTYPE, val, reg, NULL, 0, | 271 | MCS_WR_RTYPE, val, reg, NULL, 0, |
@@ -293,7 +293,7 @@ static int mos7840_get_reg_sync(struct usb_serial_port *port, __u16 reg, | |||
293 | MCS_RD_RTYPE, 0, reg, buf, VENDOR_READ_LENGTH, | 293 | MCS_RD_RTYPE, 0, reg, buf, VENDOR_READ_LENGTH, |
294 | MOS_WDR_TIMEOUT); | 294 | MOS_WDR_TIMEOUT); |
295 | *val = buf[0]; | 295 | *val = buf[0]; |
296 | dbg("mos7840_get_reg_sync offset is %x, return val %x", reg, *val); | 296 | dev_dbg(&port->dev, "%s offset is %x, return val %x\n", __func__, reg, *val); |
297 | 297 | ||
298 | kfree(buf); | 298 | kfree(buf); |
299 | return ret; | 299 | return ret; |
@@ -316,21 +316,16 @@ static int mos7840_set_uart_reg(struct usb_serial_port *port, __u16 reg, | |||
316 | if (port->serial->num_ports == 4) { | 316 | if (port->serial->num_ports == 4) { |
317 | val |= (((__u16) port->number - | 317 | val |= (((__u16) port->number - |
318 | (__u16) (port->serial->minor)) + 1) << 8; | 318 | (__u16) (port->serial->minor)) + 1) << 8; |
319 | dbg("mos7840_set_uart_reg application number is %x", val); | ||
320 | } else { | 319 | } else { |
321 | if (((__u16) port->number - (__u16) (port->serial->minor)) == 0) { | 320 | if (((__u16) port->number - (__u16) (port->serial->minor)) == 0) { |
322 | val |= (((__u16) port->number - | 321 | val |= (((__u16) port->number - |
323 | (__u16) (port->serial->minor)) + 1) << 8; | 322 | (__u16) (port->serial->minor)) + 1) << 8; |
324 | dbg("mos7840_set_uart_reg application number is %x", | ||
325 | val); | ||
326 | } else { | 323 | } else { |
327 | val |= | 324 | val |= (((__u16) port->number - |
328 | (((__u16) port->number - | ||
329 | (__u16) (port->serial->minor)) + 2) << 8; | 325 | (__u16) (port->serial->minor)) + 2) << 8; |
330 | dbg("mos7840_set_uart_reg application number is %x", | ||
331 | val); | ||
332 | } | 326 | } |
333 | } | 327 | } |
328 | dev_dbg(&port->dev, "%s application number is %x\n", __func__, val); | ||
334 | return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), MCS_WRREQ, | 329 | return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), MCS_WRREQ, |
335 | MCS_WR_RTYPE, val, reg, NULL, 0, | 330 | MCS_WR_RTYPE, val, reg, NULL, 0, |
336 | MOS_WDR_TIMEOUT); | 331 | MOS_WDR_TIMEOUT); |
@@ -354,27 +349,21 @@ static int mos7840_get_uart_reg(struct usb_serial_port *port, __u16 reg, | |||
354 | if (!buf) | 349 | if (!buf) |
355 | return -ENOMEM; | 350 | return -ENOMEM; |
356 | 351 | ||
357 | /* dbg("application number is %4x", | ||
358 | (((__u16)port->number - (__u16)(port->serial->minor))+1)<<8); */ | ||
359 | /* Wval is same as application number */ | 352 | /* Wval is same as application number */ |
360 | if (port->serial->num_ports == 4) { | 353 | if (port->serial->num_ports == 4) { |
361 | Wval = | 354 | Wval = |
362 | (((__u16) port->number - (__u16) (port->serial->minor)) + | 355 | (((__u16) port->number - (__u16) (port->serial->minor)) + |
363 | 1) << 8; | 356 | 1) << 8; |
364 | dbg("mos7840_get_uart_reg application number is %x", Wval); | ||
365 | } else { | 357 | } else { |
366 | if (((__u16) port->number - (__u16) (port->serial->minor)) == 0) { | 358 | if (((__u16) port->number - (__u16) (port->serial->minor)) == 0) { |
367 | Wval = (((__u16) port->number - | 359 | Wval = (((__u16) port->number - |
368 | (__u16) (port->serial->minor)) + 1) << 8; | 360 | (__u16) (port->serial->minor)) + 1) << 8; |
369 | dbg("mos7840_get_uart_reg application number is %x", | ||
370 | Wval); | ||
371 | } else { | 361 | } else { |
372 | Wval = (((__u16) port->number - | 362 | Wval = (((__u16) port->number - |
373 | (__u16) (port->serial->minor)) + 2) << 8; | 363 | (__u16) (port->serial->minor)) + 2) << 8; |
374 | dbg("mos7840_get_uart_reg application number is %x", | ||
375 | Wval); | ||
376 | } | 364 | } |
377 | } | 365 | } |
366 | dev_dbg(&port->dev, "%s application number is %x\n", __func__, Wval); | ||
378 | ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), MCS_RDREQ, | 367 | ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), MCS_RDREQ, |
379 | MCS_RD_RTYPE, Wval, reg, buf, VENDOR_READ_LENGTH, | 368 | MCS_RD_RTYPE, Wval, reg, buf, VENDOR_READ_LENGTH, |
380 | MOS_WDR_TIMEOUT); | 369 | MOS_WDR_TIMEOUT); |
@@ -384,14 +373,13 @@ static int mos7840_get_uart_reg(struct usb_serial_port *port, __u16 reg, | |||
384 | return ret; | 373 | return ret; |
385 | } | 374 | } |
386 | 375 | ||
387 | static void mos7840_dump_serial_port(struct moschip_port *mos7840_port) | 376 | static void mos7840_dump_serial_port(struct usb_serial_port *port, |
377 | struct moschip_port *mos7840_port) | ||
388 | { | 378 | { |
389 | 379 | ||
390 | dbg("***************************************"); | 380 | dev_dbg(&port->dev, "SpRegOffset is %2x\n", mos7840_port->SpRegOffset); |
391 | dbg("SpRegOffset is %2x", mos7840_port->SpRegOffset); | 381 | dev_dbg(&port->dev, "ControlRegOffset is %2x\n", mos7840_port->ControlRegOffset); |
392 | dbg("ControlRegOffset is %2x", mos7840_port->ControlRegOffset); | 382 | dev_dbg(&port->dev, "DCRRegOffset is %2x\n", mos7840_port->DcrRegOffset); |
393 | dbg("DCRRegOffset is %2x", mos7840_port->DcrRegOffset); | ||
394 | dbg("***************************************"); | ||
395 | 383 | ||
396 | } | 384 | } |
397 | 385 | ||
@@ -450,8 +438,6 @@ static void mos7840_handle_new_lsr(struct moschip_port *port, __u8 new_lsr) | |||
450 | { | 438 | { |
451 | struct async_icount *icount; | 439 | struct async_icount *icount; |
452 | 440 | ||
453 | dbg("%s - %02x", __func__, new_lsr); | ||
454 | |||
455 | if (new_lsr & SERIAL_LSR_BI) { | 441 | if (new_lsr & SERIAL_LSR_BI) { |
456 | /* | 442 | /* |
457 | * Parity and Framing errors only count if they | 443 | * Parity and Framing errors only count if they |
@@ -492,6 +478,7 @@ static void mos7840_control_callback(struct urb *urb) | |||
492 | { | 478 | { |
493 | unsigned char *data; | 479 | unsigned char *data; |
494 | struct moschip_port *mos7840_port; | 480 | struct moschip_port *mos7840_port; |
481 | struct device *dev = &urb->dev->dev; | ||
495 | __u8 regval = 0x0; | 482 | __u8 regval = 0x0; |
496 | int result = 0; | 483 | int result = 0; |
497 | int status = urb->status; | 484 | int status = urb->status; |
@@ -506,21 +493,19 @@ static void mos7840_control_callback(struct urb *urb) | |||
506 | case -ENOENT: | 493 | case -ENOENT: |
507 | case -ESHUTDOWN: | 494 | case -ESHUTDOWN: |
508 | /* this urb is terminated, clean up */ | 495 | /* this urb is terminated, clean up */ |
509 | dbg("%s - urb shutting down with status: %d", __func__, | 496 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status); |
510 | status); | ||
511 | return; | 497 | return; |
512 | default: | 498 | default: |
513 | dbg("%s - nonzero urb status received: %d", __func__, | 499 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); |
514 | status); | ||
515 | goto exit; | 500 | goto exit; |
516 | } | 501 | } |
517 | 502 | ||
518 | dbg("%s urb buffer size is %d", __func__, urb->actual_length); | 503 | dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length); |
519 | dbg("%s mos7840_port->MsrLsr is %d port %d", __func__, | 504 | dev_dbg(dev, "%s mos7840_port->MsrLsr is %d port %d\n", __func__, |
520 | mos7840_port->MsrLsr, mos7840_port->port_num); | 505 | mos7840_port->MsrLsr, mos7840_port->port_num); |
521 | data = urb->transfer_buffer; | 506 | data = urb->transfer_buffer; |
522 | regval = (__u8) data[0]; | 507 | regval = (__u8) data[0]; |
523 | dbg("%s data is %x", __func__, regval); | 508 | dev_dbg(dev, "%s data is %x\n", __func__, regval); |
524 | if (mos7840_port->MsrLsr == 0) | 509 | if (mos7840_port->MsrLsr == 0) |
525 | mos7840_handle_new_msr(mos7840_port, regval); | 510 | mos7840_handle_new_msr(mos7840_port, regval); |
526 | else if (mos7840_port->MsrLsr == 1) | 511 | else if (mos7840_port->MsrLsr == 1) |
@@ -532,8 +517,7 @@ exit: | |||
532 | result = usb_submit_urb(mos7840_port->int_urb, GFP_ATOMIC); | 517 | result = usb_submit_urb(mos7840_port->int_urb, GFP_ATOMIC); |
533 | spin_unlock(&mos7840_port->pool_lock); | 518 | spin_unlock(&mos7840_port->pool_lock); |
534 | if (result) { | 519 | if (result) { |
535 | dev_err(&urb->dev->dev, | 520 | dev_err(dev, "%s - Error %d submitting interrupt urb\n", |
536 | "%s - Error %d submitting interrupt urb\n", | ||
537 | __func__, result); | 521 | __func__, result); |
538 | } | 522 | } |
539 | } | 523 | } |
@@ -570,12 +554,12 @@ static void mos7840_set_led_callback(struct urb *urb) | |||
570 | case -ENOENT: | 554 | case -ENOENT: |
571 | case -ESHUTDOWN: | 555 | case -ESHUTDOWN: |
572 | /* This urb is terminated, clean up */ | 556 | /* This urb is terminated, clean up */ |
573 | dbg("%s - urb shutting down with status: %d", __func__, | 557 | dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d", |
574 | urb->status); | 558 | __func__, urb->status); |
575 | break; | 559 | break; |
576 | default: | 560 | default: |
577 | dbg("%s - nonzero urb status received: %d", __func__, | 561 | dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: %d", |
578 | urb->status); | 562 | __func__, urb->status); |
579 | } | 563 | } |
580 | } | 564 | } |
581 | 565 | ||
@@ -650,12 +634,12 @@ static void mos7840_interrupt_callback(struct urb *urb) | |||
650 | case -ENOENT: | 634 | case -ENOENT: |
651 | case -ESHUTDOWN: | 635 | case -ESHUTDOWN: |
652 | /* this urb is terminated, clean up */ | 636 | /* this urb is terminated, clean up */ |
653 | dbg("%s - urb shutting down with status: %d", __func__, | 637 | dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d\n", |
654 | status); | 638 | __func__, status); |
655 | return; | 639 | return; |
656 | default: | 640 | default: |
657 | dbg("%s - nonzero urb status received: %d", __func__, | 641 | dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: %d\n", |
658 | status); | 642 | __func__, status); |
659 | goto exit; | 643 | goto exit; |
660 | } | 644 | } |
661 | 645 | ||
@@ -672,7 +656,7 @@ static void mos7840_interrupt_callback(struct urb *urb) | |||
672 | * Byte 5 FIFO status for both */ | 656 | * Byte 5 FIFO status for both */ |
673 | 657 | ||
674 | if (length && length > 5) { | 658 | if (length && length > 5) { |
675 | dbg("%s", "Wrong data !!!"); | 659 | dev_dbg(&urb->dev->dev, "%s", "Wrong data !!!\n"); |
676 | return; | 660 | return; |
677 | } | 661 | } |
678 | 662 | ||
@@ -689,17 +673,17 @@ static void mos7840_interrupt_callback(struct urb *urb) | |||
689 | (__u16) (serial->minor)) + 1) << 8; | 673 | (__u16) (serial->minor)) + 1) << 8; |
690 | if (mos7840_port->open) { | 674 | if (mos7840_port->open) { |
691 | if (sp[i] & 0x01) { | 675 | if (sp[i] & 0x01) { |
692 | dbg("SP%d No Interrupt !!!", i); | 676 | dev_dbg(&urb->dev->dev, "SP%d No Interrupt !!!\n", i); |
693 | } else { | 677 | } else { |
694 | switch (sp[i] & 0x0f) { | 678 | switch (sp[i] & 0x0f) { |
695 | case SERIAL_IIR_RLS: | 679 | case SERIAL_IIR_RLS: |
696 | dbg("Serial Port %d: Receiver status error or ", i); | 680 | dev_dbg(&urb->dev->dev, "Serial Port %d: Receiver status error or \n", i); |
697 | dbg("address bit detected in 9-bit mode"); | 681 | dev_dbg(&urb->dev->dev, "address bit detected in 9-bit mode\n"); |
698 | mos7840_port->MsrLsr = 1; | 682 | mos7840_port->MsrLsr = 1; |
699 | wreg = LINE_STATUS_REGISTER; | 683 | wreg = LINE_STATUS_REGISTER; |
700 | break; | 684 | break; |
701 | case SERIAL_IIR_MS: | 685 | case SERIAL_IIR_MS: |
702 | dbg("Serial Port %d: Modem status change", i); | 686 | dev_dbg(&urb->dev->dev, "Serial Port %d: Modem status change\n", i); |
703 | mos7840_port->MsrLsr = 0; | 687 | mos7840_port->MsrLsr = 0; |
704 | wreg = MODEM_STATUS_REGISTER; | 688 | wreg = MODEM_STATUS_REGISTER; |
705 | break; | 689 | break; |
@@ -731,11 +715,11 @@ static int mos7840_port_paranoia_check(struct usb_serial_port *port, | |||
731 | const char *function) | 715 | const char *function) |
732 | { | 716 | { |
733 | if (!port) { | 717 | if (!port) { |
734 | dbg("%s - port == NULL", function); | 718 | pr_debug("%s - port == NULL\n", function); |
735 | return -1; | 719 | return -1; |
736 | } | 720 | } |
737 | if (!port->serial) { | 721 | if (!port->serial) { |
738 | dbg("%s - port->serial == NULL", function); | 722 | pr_debug("%s - port->serial == NULL\n", function); |
739 | return -1; | 723 | return -1; |
740 | } | 724 | } |
741 | 725 | ||
@@ -747,11 +731,11 @@ static int mos7840_serial_paranoia_check(struct usb_serial *serial, | |||
747 | const char *function) | 731 | const char *function) |
748 | { | 732 | { |
749 | if (!serial) { | 733 | if (!serial) { |
750 | dbg("%s - serial == NULL", function); | 734 | pr_debug("%s - serial == NULL\n", function); |
751 | return -1; | 735 | return -1; |
752 | } | 736 | } |
753 | if (!serial->type) { | 737 | if (!serial->type) { |
754 | dbg("%s - serial->type == NULL!", function); | 738 | pr_debug("%s - serial->type == NULL!\n", function); |
755 | return -1; | 739 | return -1; |
756 | } | 740 | } |
757 | 741 | ||
@@ -790,49 +774,44 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
790 | int status = urb->status; | 774 | int status = urb->status; |
791 | 775 | ||
792 | mos7840_port = urb->context; | 776 | mos7840_port = urb->context; |
793 | if (!mos7840_port) { | 777 | if (!mos7840_port) |
794 | dbg("%s", "NULL mos7840_port pointer"); | ||
795 | return; | 778 | return; |
796 | } | ||
797 | 779 | ||
798 | if (status) { | 780 | if (status) { |
799 | dbg("nonzero read bulk status received: %d", status); | 781 | dev_dbg(&urb->dev->dev, "nonzero read bulk status received: %d\n", status); |
800 | mos7840_port->read_urb_busy = false; | 782 | mos7840_port->read_urb_busy = false; |
801 | return; | 783 | return; |
802 | } | 784 | } |
803 | 785 | ||
804 | port = (struct usb_serial_port *)mos7840_port->port; | 786 | port = mos7840_port->port; |
805 | if (mos7840_port_paranoia_check(port, __func__)) { | 787 | if (mos7840_port_paranoia_check(port, __func__)) { |
806 | dbg("%s", "Port Paranoia failed"); | ||
807 | mos7840_port->read_urb_busy = false; | 788 | mos7840_port->read_urb_busy = false; |
808 | return; | 789 | return; |
809 | } | 790 | } |
810 | 791 | ||
811 | serial = mos7840_get_usb_serial(port, __func__); | 792 | serial = mos7840_get_usb_serial(port, __func__); |
812 | if (!serial) { | 793 | if (!serial) { |
813 | dbg("%s", "Bad serial pointer"); | ||
814 | mos7840_port->read_urb_busy = false; | 794 | mos7840_port->read_urb_busy = false; |
815 | return; | 795 | return; |
816 | } | 796 | } |
817 | 797 | ||
818 | data = urb->transfer_buffer; | 798 | data = urb->transfer_buffer; |
799 | usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); | ||
819 | 800 | ||
820 | if (urb->actual_length) { | 801 | if (urb->actual_length) { |
821 | tty = tty_port_tty_get(&mos7840_port->port->port); | 802 | tty = tty_port_tty_get(&mos7840_port->port->port); |
822 | if (tty) { | 803 | if (tty) { |
823 | tty_insert_flip_string(tty, data, urb->actual_length); | 804 | tty_insert_flip_string(tty, data, urb->actual_length); |
824 | dbg(" %s ", data); | ||
825 | tty_flip_buffer_push(tty); | 805 | tty_flip_buffer_push(tty); |
826 | tty_kref_put(tty); | 806 | tty_kref_put(tty); |
827 | } | 807 | } |
828 | mos7840_port->icount.rx += urb->actual_length; | 808 | mos7840_port->icount.rx += urb->actual_length; |
829 | smp_wmb(); | 809 | smp_wmb(); |
830 | dbg("mos7840_port->icount.rx is %d:", | 810 | dev_dbg(&port->dev, "mos7840_port->icount.rx is %d:\n", mos7840_port->icount.rx); |
831 | mos7840_port->icount.rx); | ||
832 | } | 811 | } |
833 | 812 | ||
834 | if (!mos7840_port->read_urb) { | 813 | if (!mos7840_port->read_urb) { |
835 | dbg("%s", "URB KILLED !!!"); | 814 | dev_dbg(&port->dev, "%s", "URB KILLED !!!\n"); |
836 | mos7840_port->read_urb_busy = false; | 815 | mos7840_port->read_urb_busy = false; |
837 | return; | 816 | return; |
838 | } | 817 | } |
@@ -850,7 +829,7 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
850 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 829 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
851 | 830 | ||
852 | if (retval) { | 831 | if (retval) { |
853 | dbg("usb_submit_urb(read bulk) failed, retval = %d", retval); | 832 | dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, retval = %d\n", retval); |
854 | mos7840_port->read_urb_busy = false; | 833 | mos7840_port->read_urb_busy = false; |
855 | } | 834 | } |
856 | } | 835 | } |
@@ -864,11 +843,13 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
864 | static void mos7840_bulk_out_data_callback(struct urb *urb) | 843 | static void mos7840_bulk_out_data_callback(struct urb *urb) |
865 | { | 844 | { |
866 | struct moschip_port *mos7840_port; | 845 | struct moschip_port *mos7840_port; |
846 | struct usb_serial_port *port; | ||
867 | struct tty_struct *tty; | 847 | struct tty_struct *tty; |
868 | int status = urb->status; | 848 | int status = urb->status; |
869 | int i; | 849 | int i; |
870 | 850 | ||
871 | mos7840_port = urb->context; | 851 | mos7840_port = urb->context; |
852 | port = mos7840_port->port; | ||
872 | spin_lock(&mos7840_port->pool_lock); | 853 | spin_lock(&mos7840_port->pool_lock); |
873 | for (i = 0; i < NUM_URBS; i++) { | 854 | for (i = 0; i < NUM_URBS; i++) { |
874 | if (urb == mos7840_port->write_urb_pool[i]) { | 855 | if (urb == mos7840_port->write_urb_pool[i]) { |
@@ -879,16 +860,14 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) | |||
879 | spin_unlock(&mos7840_port->pool_lock); | 860 | spin_unlock(&mos7840_port->pool_lock); |
880 | 861 | ||
881 | if (status) { | 862 | if (status) { |
882 | dbg("nonzero write bulk status received:%d", status); | 863 | dev_dbg(&port->dev, "nonzero write bulk status received:%d\n", status); |
883 | return; | 864 | return; |
884 | } | 865 | } |
885 | 866 | ||
886 | if (mos7840_port_paranoia_check(mos7840_port->port, __func__)) { | 867 | if (mos7840_port_paranoia_check(port, __func__)) |
887 | dbg("%s", "Port Paranoia failed"); | ||
888 | return; | 868 | return; |
889 | } | ||
890 | 869 | ||
891 | tty = tty_port_tty_get(&mos7840_port->port->port); | 870 | tty = tty_port_tty_get(&port->port); |
892 | if (tty && mos7840_port->open) | 871 | if (tty && mos7840_port->open) |
893 | tty_wakeup(tty); | 872 | tty_wakeup(tty); |
894 | tty_kref_put(tty); | 873 | tty_kref_put(tty); |
@@ -929,17 +908,13 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
929 | struct moschip_port *mos7840_port; | 908 | struct moschip_port *mos7840_port; |
930 | struct moschip_port *port0; | 909 | struct moschip_port *port0; |
931 | 910 | ||
932 | if (mos7840_port_paranoia_check(port, __func__)) { | 911 | if (mos7840_port_paranoia_check(port, __func__)) |
933 | dbg("%s", "Port Paranoia failed"); | ||
934 | return -ENODEV; | 912 | return -ENODEV; |
935 | } | ||
936 | 913 | ||
937 | serial = port->serial; | 914 | serial = port->serial; |
938 | 915 | ||
939 | if (mos7840_serial_paranoia_check(serial, __func__)) { | 916 | if (mos7840_serial_paranoia_check(serial, __func__)) |
940 | dbg("%s", "Serial Paranoia failed"); | ||
941 | return -ENODEV; | 917 | return -ENODEV; |
942 | } | ||
943 | 918 | ||
944 | mos7840_port = mos7840_get_port_private(port); | 919 | mos7840_port = mos7840_get_port_private(port); |
945 | port0 = mos7840_get_port_private(serial->port[0]); | 920 | port0 = mos7840_get_port_private(serial->port[0]); |
@@ -990,20 +965,20 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
990 | Data = 0x0; | 965 | Data = 0x0; |
991 | status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, &Data); | 966 | status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, &Data); |
992 | if (status < 0) { | 967 | if (status < 0) { |
993 | dbg("Reading Spreg failed"); | 968 | dev_dbg(&port->dev, "Reading Spreg failed\n"); |
994 | return -1; | 969 | return -1; |
995 | } | 970 | } |
996 | Data |= 0x80; | 971 | Data |= 0x80; |
997 | status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); | 972 | status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); |
998 | if (status < 0) { | 973 | if (status < 0) { |
999 | dbg("writing Spreg failed"); | 974 | dev_dbg(&port->dev, "writing Spreg failed\n"); |
1000 | return -1; | 975 | return -1; |
1001 | } | 976 | } |
1002 | 977 | ||
1003 | Data &= ~0x80; | 978 | Data &= ~0x80; |
1004 | status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); | 979 | status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); |
1005 | if (status < 0) { | 980 | if (status < 0) { |
1006 | dbg("writing Spreg failed"); | 981 | dev_dbg(&port->dev, "writing Spreg failed\n"); |
1007 | return -1; | 982 | return -1; |
1008 | } | 983 | } |
1009 | /* End of block to be checked */ | 984 | /* End of block to be checked */ |
@@ -1012,7 +987,7 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1012 | status = mos7840_get_reg_sync(port, mos7840_port->ControlRegOffset, | 987 | status = mos7840_get_reg_sync(port, mos7840_port->ControlRegOffset, |
1013 | &Data); | 988 | &Data); |
1014 | if (status < 0) { | 989 | if (status < 0) { |
1015 | dbg("Reading Controlreg failed"); | 990 | dev_dbg(&port->dev, "Reading Controlreg failed\n"); |
1016 | return -1; | 991 | return -1; |
1017 | } | 992 | } |
1018 | Data |= 0x08; /* Driver done bit */ | 993 | Data |= 0x08; /* Driver done bit */ |
@@ -1020,7 +995,7 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1020 | status = mos7840_set_reg_sync(port, | 995 | status = mos7840_set_reg_sync(port, |
1021 | mos7840_port->ControlRegOffset, Data); | 996 | mos7840_port->ControlRegOffset, Data); |
1022 | if (status < 0) { | 997 | if (status < 0) { |
1023 | dbg("writing Controlreg failed"); | 998 | dev_dbg(&port->dev, "writing Controlreg failed\n"); |
1024 | return -1; | 999 | return -1; |
1025 | } | 1000 | } |
1026 | /* do register settings here */ | 1001 | /* do register settings here */ |
@@ -1031,21 +1006,21 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1031 | Data = 0x00; | 1006 | Data = 0x00; |
1032 | status = mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); | 1007 | status = mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); |
1033 | if (status < 0) { | 1008 | if (status < 0) { |
1034 | dbg("disabling interrupts failed"); | 1009 | dev_dbg(&port->dev, "disabling interrupts failed\n"); |
1035 | return -1; | 1010 | return -1; |
1036 | } | 1011 | } |
1037 | /* Set FIFO_CONTROL_REGISTER to the default value */ | 1012 | /* Set FIFO_CONTROL_REGISTER to the default value */ |
1038 | Data = 0x00; | 1013 | Data = 0x00; |
1039 | status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data); | 1014 | status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data); |
1040 | if (status < 0) { | 1015 | if (status < 0) { |
1041 | dbg("Writing FIFO_CONTROL_REGISTER failed"); | 1016 | dev_dbg(&port->dev, "Writing FIFO_CONTROL_REGISTER failed\n"); |
1042 | return -1; | 1017 | return -1; |
1043 | } | 1018 | } |
1044 | 1019 | ||
1045 | Data = 0xcf; | 1020 | Data = 0xcf; |
1046 | status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data); | 1021 | status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data); |
1047 | if (status < 0) { | 1022 | if (status < 0) { |
1048 | dbg("Writing FIFO_CONTROL_REGISTER failed"); | 1023 | dev_dbg(&port->dev, "Writing FIFO_CONTROL_REGISTER failed\n"); |
1049 | return -1; | 1024 | return -1; |
1050 | } | 1025 | } |
1051 | 1026 | ||
@@ -1142,12 +1117,12 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1142 | * (can't set it up in mos7840_startup as the * | 1117 | * (can't set it up in mos7840_startup as the * |
1143 | * structures were not set up at that time.) */ | 1118 | * structures were not set up at that time.) */ |
1144 | 1119 | ||
1145 | dbg("port number is %d", port->number); | 1120 | dev_dbg(&port->dev, "port number is %d\n", port->number); |
1146 | dbg("serial number is %d", port->serial->minor); | 1121 | dev_dbg(&port->dev, "serial number is %d\n", port->serial->minor); |
1147 | dbg("Bulkin endpoint is %d", port->bulk_in_endpointAddress); | 1122 | dev_dbg(&port->dev, "Bulkin endpoint is %d\n", port->bulk_in_endpointAddress); |
1148 | dbg("BulkOut endpoint is %d", port->bulk_out_endpointAddress); | 1123 | dev_dbg(&port->dev, "BulkOut endpoint is %d\n", port->bulk_out_endpointAddress); |
1149 | dbg("Interrupt endpoint is %d", port->interrupt_in_endpointAddress); | 1124 | dev_dbg(&port->dev, "Interrupt endpoint is %d\n", port->interrupt_in_endpointAddress); |
1150 | dbg("port's number in the device is %d", mos7840_port->port_num); | 1125 | dev_dbg(&port->dev, "port's number in the device is %d\n", mos7840_port->port_num); |
1151 | mos7840_port->read_urb = port->read_urb; | 1126 | mos7840_port->read_urb = port->read_urb; |
1152 | 1127 | ||
1153 | /* set up our bulk in urb */ | 1128 | /* set up our bulk in urb */ |
@@ -1171,8 +1146,7 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1171 | mos7840_bulk_in_callback, mos7840_port); | 1146 | mos7840_bulk_in_callback, mos7840_port); |
1172 | } | 1147 | } |
1173 | 1148 | ||
1174 | dbg("mos7840_open: bulkin endpoint is %d", | 1149 | dev_dbg(&port->dev, "%s: bulkin endpoint is %d\n", __func__, port->bulk_in_endpointAddress); |
1175 | port->bulk_in_endpointAddress); | ||
1176 | mos7840_port->read_urb_busy = true; | 1150 | mos7840_port->read_urb_busy = true; |
1177 | response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); | 1151 | response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); |
1178 | if (response) { | 1152 | if (response) { |
@@ -1197,9 +1171,6 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1197 | mos7840_port->icount.tx = 0; | 1171 | mos7840_port->icount.tx = 0; |
1198 | mos7840_port->icount.rx = 0; | 1172 | mos7840_port->icount.rx = 0; |
1199 | 1173 | ||
1200 | dbg("usb_serial serial:%p mos7840_port:%p\n usb_serial_port port:%p", | ||
1201 | serial, mos7840_port, port); | ||
1202 | |||
1203 | return 0; | 1174 | return 0; |
1204 | } | 1175 | } |
1205 | 1176 | ||
@@ -1221,10 +1192,8 @@ static int mos7840_chars_in_buffer(struct tty_struct *tty) | |||
1221 | unsigned long flags; | 1192 | unsigned long flags; |
1222 | struct moschip_port *mos7840_port; | 1193 | struct moschip_port *mos7840_port; |
1223 | 1194 | ||
1224 | if (mos7840_port_paranoia_check(port, __func__)) { | 1195 | if (mos7840_port_paranoia_check(port, __func__)) |
1225 | dbg("%s", "Invalid port"); | ||
1226 | return 0; | 1196 | return 0; |
1227 | } | ||
1228 | 1197 | ||
1229 | mos7840_port = mos7840_get_port_private(port); | 1198 | mos7840_port = mos7840_get_port_private(port); |
1230 | if (mos7840_port == NULL) | 1199 | if (mos7840_port == NULL) |
@@ -1238,7 +1207,7 @@ static int mos7840_chars_in_buffer(struct tty_struct *tty) | |||
1238 | } | 1207 | } |
1239 | } | 1208 | } |
1240 | spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); | 1209 | spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); |
1241 | dbg("%s - returns %d", __func__, chars); | 1210 | dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); |
1242 | return chars; | 1211 | return chars; |
1243 | 1212 | ||
1244 | } | 1213 | } |
@@ -1256,16 +1225,12 @@ static void mos7840_close(struct usb_serial_port *port) | |||
1256 | int j; | 1225 | int j; |
1257 | __u16 Data; | 1226 | __u16 Data; |
1258 | 1227 | ||
1259 | if (mos7840_port_paranoia_check(port, __func__)) { | 1228 | if (mos7840_port_paranoia_check(port, __func__)) |
1260 | dbg("%s", "Port Paranoia failed"); | ||
1261 | return; | 1229 | return; |
1262 | } | ||
1263 | 1230 | ||
1264 | serial = mos7840_get_usb_serial(port, __func__); | 1231 | serial = mos7840_get_usb_serial(port, __func__); |
1265 | if (!serial) { | 1232 | if (!serial) |
1266 | dbg("%s", "Serial Paranoia failed"); | ||
1267 | return; | 1233 | return; |
1268 | } | ||
1269 | 1234 | ||
1270 | mos7840_port = mos7840_get_port_private(port); | 1235 | mos7840_port = mos7840_get_port_private(port); |
1271 | port0 = mos7840_get_port_private(serial->port[0]); | 1236 | port0 = mos7840_get_port_private(serial->port[0]); |
@@ -1291,27 +1256,26 @@ static void mos7840_close(struct usb_serial_port *port) | |||
1291 | * and interrupt read if they exists */ | 1256 | * and interrupt read if they exists */ |
1292 | if (serial->dev) { | 1257 | if (serial->dev) { |
1293 | if (mos7840_port->write_urb) { | 1258 | if (mos7840_port->write_urb) { |
1294 | dbg("%s", "Shutdown bulk write"); | 1259 | dev_dbg(&port->dev, "%s", "Shutdown bulk write\n"); |
1295 | usb_kill_urb(mos7840_port->write_urb); | 1260 | usb_kill_urb(mos7840_port->write_urb); |
1296 | } | 1261 | } |
1297 | if (mos7840_port->read_urb) { | 1262 | if (mos7840_port->read_urb) { |
1298 | dbg("%s", "Shutdown bulk read"); | 1263 | dev_dbg(&port->dev, "%s", "Shutdown bulk read\n"); |
1299 | usb_kill_urb(mos7840_port->read_urb); | 1264 | usb_kill_urb(mos7840_port->read_urb); |
1300 | mos7840_port->read_urb_busy = false; | 1265 | mos7840_port->read_urb_busy = false; |
1301 | } | 1266 | } |
1302 | if ((&mos7840_port->control_urb)) { | 1267 | if ((&mos7840_port->control_urb)) { |
1303 | dbg("%s", "Shutdown control read"); | 1268 | dev_dbg(&port->dev, "%s", "Shutdown control read\n"); |
1304 | /*/ usb_kill_urb (mos7840_port->control_urb); */ | 1269 | /*/ usb_kill_urb (mos7840_port->control_urb); */ |
1305 | } | 1270 | } |
1306 | } | 1271 | } |
1307 | /* if(mos7840_port->ctrl_buf != NULL) */ | 1272 | /* if(mos7840_port->ctrl_buf != NULL) */ |
1308 | /* kfree(mos7840_port->ctrl_buf); */ | 1273 | /* kfree(mos7840_port->ctrl_buf); */ |
1309 | port0->open_ports--; | 1274 | port0->open_ports--; |
1310 | dbg("mos7840_num_open_ports in close%d:in port%d", | 1275 | dev_dbg(&port->dev, "%s in close%d:in port%d\n", __func__, port0->open_ports, port->number); |
1311 | port0->open_ports, port->number); | ||
1312 | if (port0->open_ports == 0) { | 1276 | if (port0->open_ports == 0) { |
1313 | if (serial->port[0]->interrupt_in_urb) { | 1277 | if (serial->port[0]->interrupt_in_urb) { |
1314 | dbg("%s", "Shutdown interrupt_in_urb"); | 1278 | dev_dbg(&port->dev, "Shutdown interrupt_in_urb\n"); |
1315 | usb_kill_urb(serial->port[0]->interrupt_in_urb); | 1279 | usb_kill_urb(serial->port[0]->interrupt_in_urb); |
1316 | } | 1280 | } |
1317 | } | 1281 | } |
@@ -1363,7 +1327,7 @@ static void mos7840_block_until_chase_response(struct tty_struct *tty, | |||
1363 | /* No activity.. count down section */ | 1327 | /* No activity.. count down section */ |
1364 | wait--; | 1328 | wait--; |
1365 | if (wait == 0) { | 1329 | if (wait == 0) { |
1366 | dbg("%s - TIMEOUT", __func__); | 1330 | dev_dbg(&mos7840_port->port->dev, "%s - TIMEOUT\n", __func__); |
1367 | return; | 1331 | return; |
1368 | } else { | 1332 | } else { |
1369 | /* Reset timeout value back to seconds */ | 1333 | /* Reset timeout value back to seconds */ |
@@ -1384,16 +1348,12 @@ static void mos7840_break(struct tty_struct *tty, int break_state) | |||
1384 | struct usb_serial *serial; | 1348 | struct usb_serial *serial; |
1385 | struct moschip_port *mos7840_port; | 1349 | struct moschip_port *mos7840_port; |
1386 | 1350 | ||
1387 | if (mos7840_port_paranoia_check(port, __func__)) { | 1351 | if (mos7840_port_paranoia_check(port, __func__)) |
1388 | dbg("%s", "Port Paranoia failed"); | ||
1389 | return; | 1352 | return; |
1390 | } | ||
1391 | 1353 | ||
1392 | serial = mos7840_get_usb_serial(port, __func__); | 1354 | serial = mos7840_get_usb_serial(port, __func__); |
1393 | if (!serial) { | 1355 | if (!serial) |
1394 | dbg("%s", "Serial Paranoia failed"); | ||
1395 | return; | 1356 | return; |
1396 | } | ||
1397 | 1357 | ||
1398 | mos7840_port = mos7840_get_port_private(port); | 1358 | mos7840_port = mos7840_get_port_private(port); |
1399 | 1359 | ||
@@ -1411,8 +1371,7 @@ static void mos7840_break(struct tty_struct *tty, int break_state) | |||
1411 | 1371 | ||
1412 | /* FIXME: no locking on shadowLCR anywhere in driver */ | 1372 | /* FIXME: no locking on shadowLCR anywhere in driver */ |
1413 | mos7840_port->shadowLCR = data; | 1373 | mos7840_port->shadowLCR = data; |
1414 | dbg("mcs7840_break mos7840_port->shadowLCR is %x", | 1374 | dev_dbg(&port->dev, "%s mos7840_port->shadowLCR is %x\n", __func__, mos7840_port->shadowLCR); |
1415 | mos7840_port->shadowLCR); | ||
1416 | mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, | 1375 | mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, |
1417 | mos7840_port->shadowLCR); | 1376 | mos7840_port->shadowLCR); |
1418 | } | 1377 | } |
@@ -1433,17 +1392,12 @@ static int mos7840_write_room(struct tty_struct *tty) | |||
1433 | unsigned long flags; | 1392 | unsigned long flags; |
1434 | struct moschip_port *mos7840_port; | 1393 | struct moschip_port *mos7840_port; |
1435 | 1394 | ||
1436 | if (mos7840_port_paranoia_check(port, __func__)) { | 1395 | if (mos7840_port_paranoia_check(port, __func__)) |
1437 | dbg("%s", "Invalid port"); | ||
1438 | dbg("%s", " mos7840_write_room:leaving ..........."); | ||
1439 | return -1; | 1396 | return -1; |
1440 | } | ||
1441 | 1397 | ||
1442 | mos7840_port = mos7840_get_port_private(port); | 1398 | mos7840_port = mos7840_get_port_private(port); |
1443 | if (mos7840_port == NULL) { | 1399 | if (mos7840_port == NULL) |
1444 | dbg("%s", "mos7840_break:leaving ..........."); | ||
1445 | return -1; | 1400 | return -1; |
1446 | } | ||
1447 | 1401 | ||
1448 | spin_lock_irqsave(&mos7840_port->pool_lock, flags); | 1402 | spin_lock_irqsave(&mos7840_port->pool_lock, flags); |
1449 | for (i = 0; i < NUM_URBS; ++i) { | 1403 | for (i = 0; i < NUM_URBS; ++i) { |
@@ -1453,7 +1407,7 @@ static int mos7840_write_room(struct tty_struct *tty) | |||
1453 | spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); | 1407 | spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); |
1454 | 1408 | ||
1455 | room = (room == 0) ? 0 : room - URB_TRANSFER_BUFFER_SIZE + 1; | 1409 | room = (room == 0) ? 0 : room - URB_TRANSFER_BUFFER_SIZE + 1; |
1456 | dbg("%s - returns %d", __func__, room); | 1410 | dev_dbg(&mos7840_port->port->dev, "%s - returns %d\n", __func__, room); |
1457 | return room; | 1411 | return room; |
1458 | 1412 | ||
1459 | } | 1413 | } |
@@ -1486,9 +1440,8 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1486 | Data = 0x00; | 1440 | Data = 0x00; |
1487 | status = mos7840_get_uart_reg(port, LINE_CONTROL_REGISTER, &Data); | 1441 | status = mos7840_get_uart_reg(port, LINE_CONTROL_REGISTER, &Data); |
1488 | mos7840_port->shadowLCR = Data; | 1442 | mos7840_port->shadowLCR = Data; |
1489 | dbg("mos7840_write: LINE_CONTROL_REGISTER is %x", Data); | 1443 | dev_dbg(&port->dev, "%s: LINE_CONTROL_REGISTER is %x\n", __func__, Data); |
1490 | dbg("mos7840_write: mos7840_port->shadowLCR is %x", | 1444 | dev_dbg(&port->dev, "%s: mos7840_port->shadowLCR is %x\n", __func__, mos7840_port->shadowLCR); |
1491 | mos7840_port->shadowLCR); | ||
1492 | 1445 | ||
1493 | /* Data = 0x03; */ | 1446 | /* Data = 0x03; */ |
1494 | /* status = mos7840_set_uart_reg(port,LINE_CONTROL_REGISTER,Data); */ | 1447 | /* status = mos7840_set_uart_reg(port,LINE_CONTROL_REGISTER,Data); */ |
@@ -1501,34 +1454,27 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1501 | /* status = mos7840_set_uart_reg(port,DIVISOR_LATCH_LSB,Data); */ | 1454 | /* status = mos7840_set_uart_reg(port,DIVISOR_LATCH_LSB,Data); */ |
1502 | Data = 0x00; | 1455 | Data = 0x00; |
1503 | status = mos7840_get_uart_reg(port, DIVISOR_LATCH_LSB, &Data); | 1456 | status = mos7840_get_uart_reg(port, DIVISOR_LATCH_LSB, &Data); |
1504 | dbg("mos7840_write:DLL value is %x", Data); | 1457 | dev_dbg(&port->dev, "%s: DLL value is %x\n", __func__, Data); |
1505 | 1458 | ||
1506 | Data = 0x0; | 1459 | Data = 0x0; |
1507 | status = mos7840_get_uart_reg(port, DIVISOR_LATCH_MSB, &Data); | 1460 | status = mos7840_get_uart_reg(port, DIVISOR_LATCH_MSB, &Data); |
1508 | dbg("mos7840_write:DLM value is %x", Data); | 1461 | dev_dbg(&port->dev, "%s: DLM value is %x\n", __func__, Data); |
1509 | 1462 | ||
1510 | Data = Data & ~SERIAL_LCR_DLAB; | 1463 | Data = Data & ~SERIAL_LCR_DLAB; |
1511 | dbg("mos7840_write: mos7840_port->shadowLCR is %x", | 1464 | dev_dbg(&port->dev, "%s: mos7840_port->shadowLCR is %x\n", __func__, mos7840_port->shadowLCR); |
1512 | mos7840_port->shadowLCR); | ||
1513 | status = mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, Data); | 1465 | status = mos7840_set_uart_reg(port, LINE_CONTROL_REGISTER, Data); |
1514 | #endif | 1466 | #endif |
1515 | 1467 | ||
1516 | if (mos7840_port_paranoia_check(port, __func__)) { | 1468 | if (mos7840_port_paranoia_check(port, __func__)) |
1517 | dbg("%s", "Port Paranoia failed"); | ||
1518 | return -1; | 1469 | return -1; |
1519 | } | ||
1520 | 1470 | ||
1521 | serial = port->serial; | 1471 | serial = port->serial; |
1522 | if (mos7840_serial_paranoia_check(serial, __func__)) { | 1472 | if (mos7840_serial_paranoia_check(serial, __func__)) |
1523 | dbg("%s", "Serial Paranoia failed"); | ||
1524 | return -1; | 1473 | return -1; |
1525 | } | ||
1526 | 1474 | ||
1527 | mos7840_port = mos7840_get_port_private(port); | 1475 | mos7840_port = mos7840_get_port_private(port); |
1528 | if (mos7840_port == NULL) { | 1476 | if (mos7840_port == NULL) |
1529 | dbg("%s", "mos7840_port is NULL"); | ||
1530 | return -1; | 1477 | return -1; |
1531 | } | ||
1532 | 1478 | ||
1533 | /* try to find a free urb in the list */ | 1479 | /* try to find a free urb in the list */ |
1534 | urb = NULL; | 1480 | urb = NULL; |
@@ -1538,14 +1484,14 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1538 | if (!mos7840_port->busy[i]) { | 1484 | if (!mos7840_port->busy[i]) { |
1539 | mos7840_port->busy[i] = 1; | 1485 | mos7840_port->busy[i] = 1; |
1540 | urb = mos7840_port->write_urb_pool[i]; | 1486 | urb = mos7840_port->write_urb_pool[i]; |
1541 | dbg("URB:%d", i); | 1487 | dev_dbg(&port->dev, "URB:%d\n", i); |
1542 | break; | 1488 | break; |
1543 | } | 1489 | } |
1544 | } | 1490 | } |
1545 | spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); | 1491 | spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); |
1546 | 1492 | ||
1547 | if (urb == NULL) { | 1493 | if (urb == NULL) { |
1548 | dbg("%s - no more free urbs", __func__); | 1494 | dev_dbg(&port->dev, "%s - no more free urbs\n", __func__); |
1549 | goto exit; | 1495 | goto exit; |
1550 | } | 1496 | } |
1551 | 1497 | ||
@@ -1585,7 +1531,7 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1585 | } | 1531 | } |
1586 | 1532 | ||
1587 | data1 = urb->transfer_buffer; | 1533 | data1 = urb->transfer_buffer; |
1588 | dbg("bulkout endpoint is %d", port->bulk_out_endpointAddress); | 1534 | dev_dbg(&port->dev, "bulkout endpoint is %d\n", port->bulk_out_endpointAddress); |
1589 | 1535 | ||
1590 | /* Turn on LED */ | 1536 | /* Turn on LED */ |
1591 | if (mos7840_port->has_led && !mos7840_port->led_flag) { | 1537 | if (mos7840_port->has_led && !mos7840_port->led_flag) { |
@@ -1608,7 +1554,7 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1608 | bytes_sent = transfer_size; | 1554 | bytes_sent = transfer_size; |
1609 | mos7840_port->icount.tx += transfer_size; | 1555 | mos7840_port->icount.tx += transfer_size; |
1610 | smp_wmb(); | 1556 | smp_wmb(); |
1611 | dbg("mos7840_port->icount.tx is %d:", mos7840_port->icount.tx); | 1557 | dev_dbg(&port->dev, "mos7840_port->icount.tx is %d:\n", mos7840_port->icount.tx); |
1612 | exit: | 1558 | exit: |
1613 | return bytes_sent; | 1559 | return bytes_sent; |
1614 | 1560 | ||
@@ -1626,12 +1572,8 @@ static void mos7840_throttle(struct tty_struct *tty) | |||
1626 | struct moschip_port *mos7840_port; | 1572 | struct moschip_port *mos7840_port; |
1627 | int status; | 1573 | int status; |
1628 | 1574 | ||
1629 | if (mos7840_port_paranoia_check(port, __func__)) { | 1575 | if (mos7840_port_paranoia_check(port, __func__)) |
1630 | dbg("%s", "Invalid port"); | ||
1631 | return; | 1576 | return; |
1632 | } | ||
1633 | |||
1634 | dbg("- port %d", port->number); | ||
1635 | 1577 | ||
1636 | mos7840_port = mos7840_get_port_private(port); | 1578 | mos7840_port = mos7840_get_port_private(port); |
1637 | 1579 | ||
@@ -1639,7 +1581,7 @@ static void mos7840_throttle(struct tty_struct *tty) | |||
1639 | return; | 1581 | return; |
1640 | 1582 | ||
1641 | if (!mos7840_port->open) { | 1583 | if (!mos7840_port->open) { |
1642 | dbg("%s", "port not opened"); | 1584 | dev_dbg(&port->dev, "%s", "port not opened\n"); |
1643 | return; | 1585 | return; |
1644 | } | 1586 | } |
1645 | 1587 | ||
@@ -1672,16 +1614,14 @@ static void mos7840_unthrottle(struct tty_struct *tty) | |||
1672 | int status; | 1614 | int status; |
1673 | struct moschip_port *mos7840_port = mos7840_get_port_private(port); | 1615 | struct moschip_port *mos7840_port = mos7840_get_port_private(port); |
1674 | 1616 | ||
1675 | if (mos7840_port_paranoia_check(port, __func__)) { | 1617 | if (mos7840_port_paranoia_check(port, __func__)) |
1676 | dbg("%s", "Invalid port"); | ||
1677 | return; | 1618 | return; |
1678 | } | ||
1679 | 1619 | ||
1680 | if (mos7840_port == NULL) | 1620 | if (mos7840_port == NULL) |
1681 | return; | 1621 | return; |
1682 | 1622 | ||
1683 | if (!mos7840_port->open) { | 1623 | if (!mos7840_port->open) { |
1684 | dbg("%s - port not opened", __func__); | 1624 | dev_dbg(&port->dev, "%s - port not opened\n", __func__); |
1685 | return; | 1625 | return; |
1686 | } | 1626 | } |
1687 | 1627 | ||
@@ -1726,7 +1666,7 @@ static int mos7840_tiocmget(struct tty_struct *tty) | |||
1726 | | ((msr & MOS7840_MSR_RI) ? TIOCM_RI : 0) | 1666 | | ((msr & MOS7840_MSR_RI) ? TIOCM_RI : 0) |
1727 | | ((msr & MOS7840_MSR_DSR) ? TIOCM_DSR : 0); | 1667 | | ((msr & MOS7840_MSR_DSR) ? TIOCM_DSR : 0); |
1728 | 1668 | ||
1729 | dbg("%s - 0x%04X", __func__, result); | 1669 | dev_dbg(&port->dev, "%s - 0x%04X\n", __func__, result); |
1730 | 1670 | ||
1731 | return result; | 1671 | return result; |
1732 | } | 1672 | } |
@@ -1764,7 +1704,7 @@ static int mos7840_tiocmset(struct tty_struct *tty, | |||
1764 | 1704 | ||
1765 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, mcr); | 1705 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, mcr); |
1766 | if (status < 0) { | 1706 | if (status < 0) { |
1767 | dbg("setting MODEM_CONTROL_REGISTER Failed"); | 1707 | dev_dbg(&port->dev, "setting MODEM_CONTROL_REGISTER Failed\n"); |
1768 | return status; | 1708 | return status; |
1769 | } | 1709 | } |
1770 | 1710 | ||
@@ -1776,10 +1716,11 @@ static int mos7840_tiocmset(struct tty_struct *tty, | |||
1776 | * this function calculates the proper baud rate divisor for the specified | 1716 | * this function calculates the proper baud rate divisor for the specified |
1777 | * baud rate. | 1717 | * baud rate. |
1778 | *****************************************************************************/ | 1718 | *****************************************************************************/ |
1779 | static int mos7840_calc_baud_rate_divisor(int baudRate, int *divisor, | 1719 | static int mos7840_calc_baud_rate_divisor(struct usb_serial_port *port, |
1720 | int baudRate, int *divisor, | ||
1780 | __u16 *clk_sel_val) | 1721 | __u16 *clk_sel_val) |
1781 | { | 1722 | { |
1782 | dbg("%s - %d", __func__, baudRate); | 1723 | dev_dbg(&port->dev, "%s - %d\n", __func__, baudRate); |
1783 | 1724 | ||
1784 | if (baudRate <= 115200) { | 1725 | if (baudRate <= 115200) { |
1785 | *divisor = 115200 / baudRate; | 1726 | *divisor = 115200 / baudRate; |
@@ -1832,11 +1773,11 @@ static int mos7840_calc_baud_rate_divisor(int baudRate, int *divisor, | |||
1832 | custom++; | 1773 | custom++; |
1833 | *divisor = custom; | 1774 | *divisor = custom; |
1834 | 1775 | ||
1835 | dbg(" Baud %d = %d", baudrate, custom); | 1776 | dev_dbg(&port->dev, " Baud %d = %d\n", baudrate, custom); |
1836 | return 0; | 1777 | return 0; |
1837 | } | 1778 | } |
1838 | 1779 | ||
1839 | dbg("%s", " Baud calculation Failed..."); | 1780 | dev_dbg(&port->dev, "%s", " Baud calculation Failed...\n"); |
1840 | return -1; | 1781 | return -1; |
1841 | #endif | 1782 | #endif |
1842 | } | 1783 | } |
@@ -1860,21 +1801,17 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, | |||
1860 | if (mos7840_port == NULL) | 1801 | if (mos7840_port == NULL) |
1861 | return -1; | 1802 | return -1; |
1862 | 1803 | ||
1863 | port = (struct usb_serial_port *)mos7840_port->port; | 1804 | port = mos7840_port->port; |
1864 | if (mos7840_port_paranoia_check(port, __func__)) { | 1805 | if (mos7840_port_paranoia_check(port, __func__)) |
1865 | dbg("%s", "Invalid port"); | ||
1866 | return -1; | 1806 | return -1; |
1867 | } | ||
1868 | 1807 | ||
1869 | if (mos7840_serial_paranoia_check(port->serial, __func__)) { | 1808 | if (mos7840_serial_paranoia_check(port->serial, __func__)) |
1870 | dbg("%s", "Invalid Serial"); | ||
1871 | return -1; | 1809 | return -1; |
1872 | } | ||
1873 | 1810 | ||
1874 | number = mos7840_port->port->number - mos7840_port->port->serial->minor; | 1811 | number = mos7840_port->port->number - mos7840_port->port->serial->minor; |
1875 | 1812 | ||
1876 | dbg("%s - port = %d, baud = %d", __func__, | 1813 | dev_dbg(&port->dev, "%s - port = %d, baud = %d\n", __func__, |
1877 | mos7840_port->port->number, baudRate); | 1814 | mos7840_port->port->number, baudRate); |
1878 | /* reset clk_uart_sel in spregOffset */ | 1815 | /* reset clk_uart_sel in spregOffset */ |
1879 | if (baudRate > 115200) { | 1816 | if (baudRate > 115200) { |
1880 | #ifdef HW_flow_control | 1817 | #ifdef HW_flow_control |
@@ -1885,7 +1822,7 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, | |||
1885 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, | 1822 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, |
1886 | Data); | 1823 | Data); |
1887 | if (status < 0) { | 1824 | if (status < 0) { |
1888 | dbg("Writing spreg failed in set_serial_baud"); | 1825 | dev_dbg(&port->dev, "Writing spreg failed in set_serial_baud\n"); |
1889 | return -1; | 1826 | return -1; |
1890 | } | 1827 | } |
1891 | #endif | 1828 | #endif |
@@ -1898,7 +1835,7 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, | |||
1898 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, | 1835 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, |
1899 | Data); | 1836 | Data); |
1900 | if (status < 0) { | 1837 | if (status < 0) { |
1901 | dbg("Writing spreg failed in set_serial_baud"); | 1838 | dev_dbg(&port->dev, "Writing spreg failed in set_serial_baud\n"); |
1902 | return -1; | 1839 | return -1; |
1903 | } | 1840 | } |
1904 | #endif | 1841 | #endif |
@@ -1908,19 +1845,19 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, | |||
1908 | if (1) { /* baudRate <= 115200) */ | 1845 | if (1) { /* baudRate <= 115200) */ |
1909 | clk_sel_val = 0x0; | 1846 | clk_sel_val = 0x0; |
1910 | Data = 0x0; | 1847 | Data = 0x0; |
1911 | status = mos7840_calc_baud_rate_divisor(baudRate, &divisor, | 1848 | status = mos7840_calc_baud_rate_divisor(port, baudRate, &divisor, |
1912 | &clk_sel_val); | 1849 | &clk_sel_val); |
1913 | status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, | 1850 | status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, |
1914 | &Data); | 1851 | &Data); |
1915 | if (status < 0) { | 1852 | if (status < 0) { |
1916 | dbg("reading spreg failed in set_serial_baud"); | 1853 | dev_dbg(&port->dev, "reading spreg failed in set_serial_baud\n"); |
1917 | return -1; | 1854 | return -1; |
1918 | } | 1855 | } |
1919 | Data = (Data & 0x8f) | clk_sel_val; | 1856 | Data = (Data & 0x8f) | clk_sel_val; |
1920 | status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, | 1857 | status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, |
1921 | Data); | 1858 | Data); |
1922 | if (status < 0) { | 1859 | if (status < 0) { |
1923 | dbg("Writing spreg failed in set_serial_baud"); | 1860 | dev_dbg(&port->dev, "Writing spreg failed in set_serial_baud\n"); |
1924 | return -1; | 1861 | return -1; |
1925 | } | 1862 | } |
1926 | /* Calculate the Divisor */ | 1863 | /* Calculate the Divisor */ |
@@ -1936,11 +1873,11 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, | |||
1936 | 1873 | ||
1937 | /* Write the divisor */ | 1874 | /* Write the divisor */ |
1938 | Data = (unsigned char)(divisor & 0xff); | 1875 | Data = (unsigned char)(divisor & 0xff); |
1939 | dbg("set_serial_baud Value to write DLL is %x", Data); | 1876 | dev_dbg(&port->dev, "set_serial_baud Value to write DLL is %x\n", Data); |
1940 | mos7840_set_uart_reg(port, DIVISOR_LATCH_LSB, Data); | 1877 | mos7840_set_uart_reg(port, DIVISOR_LATCH_LSB, Data); |
1941 | 1878 | ||
1942 | Data = (unsigned char)((divisor & 0xff00) >> 8); | 1879 | Data = (unsigned char)((divisor & 0xff00) >> 8); |
1943 | dbg("set_serial_baud Value to write DLM is %x", Data); | 1880 | dev_dbg(&port->dev, "set_serial_baud Value to write DLM is %x\n", Data); |
1944 | mos7840_set_uart_reg(port, DIVISOR_LATCH_MSB, Data); | 1881 | mos7840_set_uart_reg(port, DIVISOR_LATCH_MSB, Data); |
1945 | 1882 | ||
1946 | /* Disable access to divisor latch */ | 1883 | /* Disable access to divisor latch */ |
@@ -1975,24 +1912,18 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
1975 | if (mos7840_port == NULL) | 1912 | if (mos7840_port == NULL) |
1976 | return; | 1913 | return; |
1977 | 1914 | ||
1978 | port = (struct usb_serial_port *)mos7840_port->port; | 1915 | port = mos7840_port->port; |
1979 | 1916 | ||
1980 | if (mos7840_port_paranoia_check(port, __func__)) { | 1917 | if (mos7840_port_paranoia_check(port, __func__)) |
1981 | dbg("%s", "Invalid port"); | ||
1982 | return; | 1918 | return; |
1983 | } | ||
1984 | 1919 | ||
1985 | if (mos7840_serial_paranoia_check(port->serial, __func__)) { | 1920 | if (mos7840_serial_paranoia_check(port->serial, __func__)) |
1986 | dbg("%s", "Invalid Serial"); | ||
1987 | return; | 1921 | return; |
1988 | } | ||
1989 | 1922 | ||
1990 | serial = port->serial; | 1923 | serial = port->serial; |
1991 | 1924 | ||
1992 | dbg("%s - port %d", __func__, mos7840_port->port->number); | ||
1993 | |||
1994 | if (!mos7840_port->open) { | 1925 | if (!mos7840_port->open) { |
1995 | dbg("%s - port not opened", __func__); | 1926 | dev_dbg(&port->dev, "%s - port not opened\n", __func__); |
1996 | return; | 1927 | return; |
1997 | } | 1928 | } |
1998 | 1929 | ||
@@ -2027,14 +1958,14 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
2027 | if (cflag & PARENB) { | 1958 | if (cflag & PARENB) { |
2028 | if (cflag & PARODD) { | 1959 | if (cflag & PARODD) { |
2029 | lParity = LCR_PAR_ODD; | 1960 | lParity = LCR_PAR_ODD; |
2030 | dbg("%s - parity = odd", __func__); | 1961 | dev_dbg(&port->dev, "%s - parity = odd\n", __func__); |
2031 | } else { | 1962 | } else { |
2032 | lParity = LCR_PAR_EVEN; | 1963 | lParity = LCR_PAR_EVEN; |
2033 | dbg("%s - parity = even", __func__); | 1964 | dev_dbg(&port->dev, "%s - parity = even\n", __func__); |
2034 | } | 1965 | } |
2035 | 1966 | ||
2036 | } else { | 1967 | } else { |
2037 | dbg("%s - parity = none", __func__); | 1968 | dev_dbg(&port->dev, "%s - parity = none\n", __func__); |
2038 | } | 1969 | } |
2039 | 1970 | ||
2040 | if (cflag & CMSPAR) | 1971 | if (cflag & CMSPAR) |
@@ -2043,10 +1974,10 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
2043 | /* Change the Stop bit */ | 1974 | /* Change the Stop bit */ |
2044 | if (cflag & CSTOPB) { | 1975 | if (cflag & CSTOPB) { |
2045 | lStop = LCR_STOP_2; | 1976 | lStop = LCR_STOP_2; |
2046 | dbg("%s - stop bits = 2", __func__); | 1977 | dev_dbg(&port->dev, "%s - stop bits = 2\n", __func__); |
2047 | } else { | 1978 | } else { |
2048 | lStop = LCR_STOP_1; | 1979 | lStop = LCR_STOP_1; |
2049 | dbg("%s - stop bits = 1", __func__); | 1980 | dev_dbg(&port->dev, "%s - stop bits = 1\n", __func__); |
2050 | } | 1981 | } |
2051 | 1982 | ||
2052 | /* Update the LCR with the correct value */ | 1983 | /* Update the LCR with the correct value */ |
@@ -2054,8 +1985,8 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
2054 | ~(LCR_BITS_MASK | LCR_STOP_MASK | LCR_PAR_MASK); | 1985 | ~(LCR_BITS_MASK | LCR_STOP_MASK | LCR_PAR_MASK); |
2055 | mos7840_port->shadowLCR |= (lData | lParity | lStop); | 1986 | mos7840_port->shadowLCR |= (lData | lParity | lStop); |
2056 | 1987 | ||
2057 | dbg("mos7840_change_port_settings mos7840_port->shadowLCR is %x", | 1988 | dev_dbg(&port->dev, "%s - mos7840_port->shadowLCR is %x\n", __func__, |
2058 | mos7840_port->shadowLCR); | 1989 | mos7840_port->shadowLCR); |
2059 | /* Disable Interrupts */ | 1990 | /* Disable Interrupts */ |
2060 | Data = 0x00; | 1991 | Data = 0x00; |
2061 | mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); | 1992 | mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); |
@@ -2096,11 +2027,11 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
2096 | 2027 | ||
2097 | if (!baud) { | 2028 | if (!baud) { |
2098 | /* pick a default, any default... */ | 2029 | /* pick a default, any default... */ |
2099 | dbg("%s", "Picked default baud..."); | 2030 | dev_dbg(&port->dev, "%s", "Picked default baud...\n"); |
2100 | baud = 9600; | 2031 | baud = 9600; |
2101 | } | 2032 | } |
2102 | 2033 | ||
2103 | dbg("%s - baud rate = %d", __func__, baud); | 2034 | dev_dbg(&port->dev, "%s - baud rate = %d\n", __func__, baud); |
2104 | status = mos7840_send_cmd_write_baud_rate(mos7840_port, baud); | 2035 | status = mos7840_send_cmd_write_baud_rate(mos7840_port, baud); |
2105 | 2036 | ||
2106 | /* Enable Interrupts */ | 2037 | /* Enable Interrupts */ |
@@ -2111,15 +2042,15 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
2111 | mos7840_port->read_urb_busy = true; | 2042 | mos7840_port->read_urb_busy = true; |
2112 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 2043 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
2113 | if (status) { | 2044 | if (status) { |
2114 | dbg("usb_submit_urb(read bulk) failed, status = %d", | 2045 | dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n", |
2115 | status); | 2046 | status); |
2116 | mos7840_port->read_urb_busy = false; | 2047 | mos7840_port->read_urb_busy = false; |
2117 | } | 2048 | } |
2118 | } | 2049 | } |
2119 | wake_up(&mos7840_port->delta_msr_wait); | 2050 | wake_up(&mos7840_port->delta_msr_wait); |
2120 | mos7840_port->delta_msr_cond = 1; | 2051 | mos7840_port->delta_msr_cond = 1; |
2121 | dbg("mos7840_change_port_settings mos7840_port->shadowLCR is End %x", | 2052 | dev_dbg(&port->dev, "%s - mos7840_port->shadowLCR is End %x\n", __func__, |
2122 | mos7840_port->shadowLCR); | 2053 | mos7840_port->shadowLCR); |
2123 | } | 2054 | } |
2124 | 2055 | ||
2125 | /***************************************************************************** | 2056 | /***************************************************************************** |
@@ -2137,17 +2068,13 @@ static void mos7840_set_termios(struct tty_struct *tty, | |||
2137 | struct usb_serial *serial; | 2068 | struct usb_serial *serial; |
2138 | struct moschip_port *mos7840_port; | 2069 | struct moschip_port *mos7840_port; |
2139 | 2070 | ||
2140 | if (mos7840_port_paranoia_check(port, __func__)) { | 2071 | if (mos7840_port_paranoia_check(port, __func__)) |
2141 | dbg("%s", "Invalid port"); | ||
2142 | return; | 2072 | return; |
2143 | } | ||
2144 | 2073 | ||
2145 | serial = port->serial; | 2074 | serial = port->serial; |
2146 | 2075 | ||
2147 | if (mos7840_serial_paranoia_check(serial, __func__)) { | 2076 | if (mos7840_serial_paranoia_check(serial, __func__)) |
2148 | dbg("%s", "Invalid Serial"); | ||
2149 | return; | 2077 | return; |
2150 | } | ||
2151 | 2078 | ||
2152 | mos7840_port = mos7840_get_port_private(port); | 2079 | mos7840_port = mos7840_get_port_private(port); |
2153 | 2080 | ||
@@ -2155,26 +2082,26 @@ static void mos7840_set_termios(struct tty_struct *tty, | |||
2155 | return; | 2082 | return; |
2156 | 2083 | ||
2157 | if (!mos7840_port->open) { | 2084 | if (!mos7840_port->open) { |
2158 | dbg("%s - port not opened", __func__); | 2085 | dev_dbg(&port->dev, "%s - port not opened\n", __func__); |
2159 | return; | 2086 | return; |
2160 | } | 2087 | } |
2161 | 2088 | ||
2162 | dbg("%s", "setting termios - "); | 2089 | dev_dbg(&port->dev, "%s", "setting termios - \n"); |
2163 | 2090 | ||
2164 | cflag = tty->termios->c_cflag; | 2091 | cflag = tty->termios->c_cflag; |
2165 | 2092 | ||
2166 | dbg("%s - clfag %08x iflag %08x", __func__, | 2093 | dev_dbg(&port->dev, "%s - clfag %08x iflag %08x\n", __func__, |
2167 | tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag)); | 2094 | tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag)); |
2168 | dbg("%s - old clfag %08x old iflag %08x", __func__, | 2095 | dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__, |
2169 | old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag)); | 2096 | old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag)); |
2170 | dbg("%s - port %d", __func__, port->number); | 2097 | dev_dbg(&port->dev, "%s - port %d\n", __func__, port->number); |
2171 | 2098 | ||
2172 | /* change the port settings to the new ones specified */ | 2099 | /* change the port settings to the new ones specified */ |
2173 | 2100 | ||
2174 | mos7840_change_port_settings(tty, mos7840_port, old_termios); | 2101 | mos7840_change_port_settings(tty, mos7840_port, old_termios); |
2175 | 2102 | ||
2176 | if (!mos7840_port->read_urb) { | 2103 | if (!mos7840_port->read_urb) { |
2177 | dbg("%s", "URB KILLED !!!!!"); | 2104 | dev_dbg(&port->dev, "%s", "URB KILLED !!!!!\n"); |
2178 | return; | 2105 | return; |
2179 | } | 2106 | } |
2180 | 2107 | ||
@@ -2182,7 +2109,7 @@ static void mos7840_set_termios(struct tty_struct *tty, | |||
2182 | mos7840_port->read_urb_busy = true; | 2109 | mos7840_port->read_urb_busy = true; |
2183 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 2110 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
2184 | if (status) { | 2111 | if (status) { |
2185 | dbg("usb_submit_urb(read bulk) failed, status = %d", | 2112 | dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n", |
2186 | status); | 2113 | status); |
2187 | mos7840_port->read_urb_busy = false; | 2114 | mos7840_port->read_urb_busy = false; |
2188 | } | 2115 | } |
@@ -2207,10 +2134,8 @@ static int mos7840_get_lsr_info(struct tty_struct *tty, | |||
2207 | unsigned int result = 0; | 2134 | unsigned int result = 0; |
2208 | 2135 | ||
2209 | count = mos7840_chars_in_buffer(tty); | 2136 | count = mos7840_chars_in_buffer(tty); |
2210 | if (count == 0) { | 2137 | if (count == 0) |
2211 | dbg("%s -- Empty", __func__); | ||
2212 | result = TIOCSER_TEMT; | 2138 | result = TIOCSER_TEMT; |
2213 | } | ||
2214 | 2139 | ||
2215 | if (copy_to_user(value, &result, sizeof(int))) | 2140 | if (copy_to_user(value, &result, sizeof(int))) |
2216 | return -EFAULT; | 2141 | return -EFAULT; |
@@ -2273,8 +2198,8 @@ static int mos7840_get_icount(struct tty_struct *tty, | |||
2273 | icount->brk = cnow.brk; | 2198 | icount->brk = cnow.brk; |
2274 | icount->buf_overrun = cnow.buf_overrun; | 2199 | icount->buf_overrun = cnow.buf_overrun; |
2275 | 2200 | ||
2276 | dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, | 2201 | dev_dbg(&port->dev, "%s TIOCGICOUNT RX=%d, TX=%d\n", __func__, |
2277 | port->number, icount->rx, icount->tx); | 2202 | icount->rx, icount->tx); |
2278 | return 0; | 2203 | return 0; |
2279 | } | 2204 | } |
2280 | 2205 | ||
@@ -2293,35 +2218,33 @@ static int mos7840_ioctl(struct tty_struct *tty, | |||
2293 | struct async_icount cnow; | 2218 | struct async_icount cnow; |
2294 | struct async_icount cprev; | 2219 | struct async_icount cprev; |
2295 | 2220 | ||
2296 | if (mos7840_port_paranoia_check(port, __func__)) { | 2221 | if (mos7840_port_paranoia_check(port, __func__)) |
2297 | dbg("%s", "Invalid port"); | ||
2298 | return -1; | 2222 | return -1; |
2299 | } | ||
2300 | 2223 | ||
2301 | mos7840_port = mos7840_get_port_private(port); | 2224 | mos7840_port = mos7840_get_port_private(port); |
2302 | 2225 | ||
2303 | if (mos7840_port == NULL) | 2226 | if (mos7840_port == NULL) |
2304 | return -1; | 2227 | return -1; |
2305 | 2228 | ||
2306 | dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); | 2229 | dev_dbg(&port->dev, "%s - cmd = 0x%x\n", __func__, cmd); |
2307 | 2230 | ||
2308 | switch (cmd) { | 2231 | switch (cmd) { |
2309 | /* return number of bytes available */ | 2232 | /* return number of bytes available */ |
2310 | 2233 | ||
2311 | case TIOCSERGETLSR: | 2234 | case TIOCSERGETLSR: |
2312 | dbg("%s (%d) TIOCSERGETLSR", __func__, port->number); | 2235 | dev_dbg(&port->dev, "%s TIOCSERGETLSR\n", __func__); |
2313 | return mos7840_get_lsr_info(tty, argp); | 2236 | return mos7840_get_lsr_info(tty, argp); |
2314 | 2237 | ||
2315 | case TIOCGSERIAL: | 2238 | case TIOCGSERIAL: |
2316 | dbg("%s (%d) TIOCGSERIAL", __func__, port->number); | 2239 | dev_dbg(&port->dev, "%s TIOCGSERIAL\n", __func__); |
2317 | return mos7840_get_serial_info(mos7840_port, argp); | 2240 | return mos7840_get_serial_info(mos7840_port, argp); |
2318 | 2241 | ||
2319 | case TIOCSSERIAL: | 2242 | case TIOCSSERIAL: |
2320 | dbg("%s (%d) TIOCSSERIAL", __func__, port->number); | 2243 | dev_dbg(&port->dev, "%s TIOCSSERIAL\n", __func__); |
2321 | break; | 2244 | break; |
2322 | 2245 | ||
2323 | case TIOCMIWAIT: | 2246 | case TIOCMIWAIT: |
2324 | dbg("%s (%d) TIOCMIWAIT", __func__, port->number); | 2247 | dev_dbg(&port->dev, "%s TIOCMIWAIT\n", __func__); |
2325 | cprev = mos7840_port->icount; | 2248 | cprev = mos7840_port->icount; |
2326 | while (1) { | 2249 | while (1) { |
2327 | /* interruptible_sleep_on(&mos7840_port->delta_msr_wait); */ | 2250 | /* interruptible_sleep_on(&mos7840_port->delta_msr_wait); */ |
@@ -2437,11 +2360,6 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2437 | int i, status; | 2360 | int i, status; |
2438 | __u16 Data; | 2361 | __u16 Data; |
2439 | 2362 | ||
2440 | if (!serial) { | ||
2441 | dbg("%s", "Invalid Handler"); | ||
2442 | return -1; | ||
2443 | } | ||
2444 | |||
2445 | dev = serial->dev; | 2363 | dev = serial->dev; |
2446 | 2364 | ||
2447 | /* we set up the pointers to the endpoints in the mos7840_open * | 2365 | /* we set up the pointers to the endpoints in the mos7840_open * |
@@ -2449,7 +2367,7 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2449 | 2367 | ||
2450 | /* set up port private structures */ | 2368 | /* set up port private structures */ |
2451 | for (i = 0; i < serial->num_ports; ++i) { | 2369 | for (i = 0; i < serial->num_ports; ++i) { |
2452 | dbg ("mos7840_startup: configuring port %d............", i); | 2370 | dev_dbg(&dev->dev, "mos7840_startup: configuring port %d............\n", i); |
2453 | mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); | 2371 | mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); |
2454 | if (mos7840_port == NULL) { | 2372 | if (mos7840_port == NULL) { |
2455 | dev_err(&dev->dev, "%s - Out of memory\n", __func__); | 2373 | dev_err(&dev->dev, "%s - Out of memory\n", __func__); |
@@ -2470,10 +2388,10 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2470 | * usb-serial.c:get_free_serial() and cannot therefore be used | 2388 | * usb-serial.c:get_free_serial() and cannot therefore be used |
2471 | * to index device instances */ | 2389 | * to index device instances */ |
2472 | mos7840_port->port_num = i + 1; | 2390 | mos7840_port->port_num = i + 1; |
2473 | dbg ("serial->port[i]->number = %d", serial->port[i]->number); | 2391 | dev_dbg(&dev->dev, "serial->port[i]->number = %d\n", serial->port[i]->number); |
2474 | dbg ("serial->port[i]->serial->minor = %d", serial->port[i]->serial->minor); | 2392 | dev_dbg(&dev->dev, "serial->port[i]->serial->minor = %d\n", serial->port[i]->serial->minor); |
2475 | dbg ("mos7840_port->port_num = %d", mos7840_port->port_num); | 2393 | dev_dbg(&dev->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num); |
2476 | dbg ("serial->minor = %d", serial->minor); | 2394 | dev_dbg(&dev->dev, "serial->minor = %d\n", serial->minor); |
2477 | 2395 | ||
2478 | if (mos7840_port->port_num == 1) { | 2396 | if (mos7840_port->port_num == 1) { |
2479 | mos7840_port->SpRegOffset = 0x0; | 2397 | mos7840_port->SpRegOffset = 0x0; |
@@ -2500,18 +2418,17 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2500 | mos7840_port->ControlRegOffset = 0xd; | 2418 | mos7840_port->ControlRegOffset = 0xd; |
2501 | mos7840_port->DcrRegOffset = 0x1c; | 2419 | mos7840_port->DcrRegOffset = 0x1c; |
2502 | } | 2420 | } |
2503 | mos7840_dump_serial_port(mos7840_port); | 2421 | mos7840_dump_serial_port(serial->port[i], mos7840_port); |
2504 | mos7840_set_port_private(serial->port[i], mos7840_port); | 2422 | mos7840_set_port_private(serial->port[i], mos7840_port); |
2505 | 2423 | ||
2506 | /* enable rx_disable bit in control register */ | 2424 | /* enable rx_disable bit in control register */ |
2507 | status = mos7840_get_reg_sync(serial->port[i], | 2425 | status = mos7840_get_reg_sync(serial->port[i], |
2508 | mos7840_port->ControlRegOffset, &Data); | 2426 | mos7840_port->ControlRegOffset, &Data); |
2509 | if (status < 0) { | 2427 | if (status < 0) { |
2510 | dbg("Reading ControlReg failed status-0x%x", status); | 2428 | dev_dbg(&dev->dev, "Reading ControlReg failed status-0x%x\n", status); |
2511 | break; | 2429 | break; |
2512 | } else | 2430 | } else |
2513 | dbg("ControlReg Reading success val is %x, status%d", | 2431 | dev_dbg(&dev->dev, "ControlReg Reading success val is %x, status%d\n", Data, status); |
2514 | Data, status); | ||
2515 | Data |= 0x08; /* setting driver done bit */ | 2432 | Data |= 0x08; /* setting driver done bit */ |
2516 | Data |= 0x04; /* sp1_bit to have cts change reflect in | 2433 | Data |= 0x04; /* sp1_bit to have cts change reflect in |
2517 | modem status reg */ | 2434 | modem status reg */ |
@@ -2520,11 +2437,10 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2520 | status = mos7840_set_reg_sync(serial->port[i], | 2437 | status = mos7840_set_reg_sync(serial->port[i], |
2521 | mos7840_port->ControlRegOffset, Data); | 2438 | mos7840_port->ControlRegOffset, Data); |
2522 | if (status < 0) { | 2439 | if (status < 0) { |
2523 | dbg("Writing ControlReg failed(rx_disable) status-0x%x", status); | 2440 | dev_dbg(&dev->dev, "Writing ControlReg failed(rx_disable) status-0x%x\n", status); |
2524 | break; | 2441 | break; |
2525 | } else | 2442 | } else |
2526 | dbg("ControlReg Writing success(rx_disable) status%d", | 2443 | dev_dbg(&dev->dev, "ControlReg Writing success(rx_disable) status%d\n", status); |
2527 | status); | ||
2528 | 2444 | ||
2529 | /* Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2 | 2445 | /* Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2 |
2530 | and 0x24 in DCR3 */ | 2446 | and 0x24 in DCR3 */ |
@@ -2532,61 +2448,57 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2532 | status = mos7840_set_reg_sync(serial->port[i], | 2448 | status = mos7840_set_reg_sync(serial->port[i], |
2533 | (__u16) (mos7840_port->DcrRegOffset + 0), Data); | 2449 | (__u16) (mos7840_port->DcrRegOffset + 0), Data); |
2534 | if (status < 0) { | 2450 | if (status < 0) { |
2535 | dbg("Writing DCR0 failed status-0x%x", status); | 2451 | dev_dbg(&dev->dev, "Writing DCR0 failed status-0x%x\n", status); |
2536 | break; | 2452 | break; |
2537 | } else | 2453 | } else |
2538 | dbg("DCR0 Writing success status%d", status); | 2454 | dev_dbg(&dev->dev, "DCR0 Writing success status%d\n", status); |
2539 | 2455 | ||
2540 | Data = 0x05; | 2456 | Data = 0x05; |
2541 | status = mos7840_set_reg_sync(serial->port[i], | 2457 | status = mos7840_set_reg_sync(serial->port[i], |
2542 | (__u16) (mos7840_port->DcrRegOffset + 1), Data); | 2458 | (__u16) (mos7840_port->DcrRegOffset + 1), Data); |
2543 | if (status < 0) { | 2459 | if (status < 0) { |
2544 | dbg("Writing DCR1 failed status-0x%x", status); | 2460 | dev_dbg(&dev->dev, "Writing DCR1 failed status-0x%x\n", status); |
2545 | break; | 2461 | break; |
2546 | } else | 2462 | } else |
2547 | dbg("DCR1 Writing success status%d", status); | 2463 | dev_dbg(&dev->dev, "DCR1 Writing success status%d\n", status); |
2548 | 2464 | ||
2549 | Data = 0x24; | 2465 | Data = 0x24; |
2550 | status = mos7840_set_reg_sync(serial->port[i], | 2466 | status = mos7840_set_reg_sync(serial->port[i], |
2551 | (__u16) (mos7840_port->DcrRegOffset + 2), Data); | 2467 | (__u16) (mos7840_port->DcrRegOffset + 2), Data); |
2552 | if (status < 0) { | 2468 | if (status < 0) { |
2553 | dbg("Writing DCR2 failed status-0x%x", status); | 2469 | dev_dbg(&dev->dev, "Writing DCR2 failed status-0x%x\n", status); |
2554 | break; | 2470 | break; |
2555 | } else | 2471 | } else |
2556 | dbg("DCR2 Writing success status%d", status); | 2472 | dev_dbg(&dev->dev, "DCR2 Writing success status%d\n", status); |
2557 | 2473 | ||
2558 | /* write values in clkstart0x0 and clkmulti 0x20 */ | 2474 | /* write values in clkstart0x0 and clkmulti 0x20 */ |
2559 | Data = 0x0; | 2475 | Data = 0x0; |
2560 | status = mos7840_set_reg_sync(serial->port[i], | 2476 | status = mos7840_set_reg_sync(serial->port[i], |
2561 | CLK_START_VALUE_REGISTER, Data); | 2477 | CLK_START_VALUE_REGISTER, Data); |
2562 | if (status < 0) { | 2478 | if (status < 0) { |
2563 | dbg("Writing CLK_START_VALUE_REGISTER failed status-0x%x", status); | 2479 | dev_dbg(&dev->dev, "Writing CLK_START_VALUE_REGISTER failed status-0x%x\n", status); |
2564 | break; | 2480 | break; |
2565 | } else | 2481 | } else |
2566 | dbg("CLK_START_VALUE_REGISTER Writing success status%d", status); | 2482 | dev_dbg(&dev->dev, "CLK_START_VALUE_REGISTER Writing success status%d\n", status); |
2567 | 2483 | ||
2568 | Data = 0x20; | 2484 | Data = 0x20; |
2569 | status = mos7840_set_reg_sync(serial->port[i], | 2485 | status = mos7840_set_reg_sync(serial->port[i], |
2570 | CLK_MULTI_REGISTER, Data); | 2486 | CLK_MULTI_REGISTER, Data); |
2571 | if (status < 0) { | 2487 | if (status < 0) { |
2572 | dbg("Writing CLK_MULTI_REGISTER failed status-0x%x", | 2488 | dev_dbg(&dev->dev, "Writing CLK_MULTI_REGISTER failed status-0x%x\n", status); |
2573 | status); | ||
2574 | goto error; | 2489 | goto error; |
2575 | } else | 2490 | } else |
2576 | dbg("CLK_MULTI_REGISTER Writing success status%d", | 2491 | dev_dbg(&dev->dev, "CLK_MULTI_REGISTER Writing success status%d\n", status); |
2577 | status); | ||
2578 | 2492 | ||
2579 | /* write value 0x0 to scratchpad register */ | 2493 | /* write value 0x0 to scratchpad register */ |
2580 | Data = 0x00; | 2494 | Data = 0x00; |
2581 | status = mos7840_set_uart_reg(serial->port[i], | 2495 | status = mos7840_set_uart_reg(serial->port[i], |
2582 | SCRATCH_PAD_REGISTER, Data); | 2496 | SCRATCH_PAD_REGISTER, Data); |
2583 | if (status < 0) { | 2497 | if (status < 0) { |
2584 | dbg("Writing SCRATCH_PAD_REGISTER failed status-0x%x", | 2498 | dev_dbg(&dev->dev, "Writing SCRATCH_PAD_REGISTER failed status-0x%x\n", status); |
2585 | status); | ||
2586 | break; | 2499 | break; |
2587 | } else | 2500 | } else |
2588 | dbg("SCRATCH_PAD_REGISTER Writing success status%d", | 2501 | dev_dbg(&dev->dev, "SCRATCH_PAD_REGISTER Writing success status%d\n", status); |
2589 | status); | ||
2590 | 2502 | ||
2591 | /* Zero Length flag register */ | 2503 | /* Zero Length flag register */ |
2592 | if ((mos7840_port->port_num != 1) | 2504 | if ((mos7840_port->port_num != 1) |
@@ -2596,31 +2508,25 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2596 | status = mos7840_set_reg_sync(serial->port[i], | 2508 | status = mos7840_set_reg_sync(serial->port[i], |
2597 | (__u16) (ZLP_REG1 + | 2509 | (__u16) (ZLP_REG1 + |
2598 | ((__u16)mos7840_port->port_num)), Data); | 2510 | ((__u16)mos7840_port->port_num)), Data); |
2599 | dbg("ZLIP offset %x", | 2511 | dev_dbg(&dev->dev, "ZLIP offset %x\n", |
2600 | (__u16) (ZLP_REG1 + | 2512 | (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num))); |
2601 | ((__u16) mos7840_port->port_num))); | ||
2602 | if (status < 0) { | 2513 | if (status < 0) { |
2603 | dbg("Writing ZLP_REG%d failed status-0x%x", | 2514 | dev_dbg(&dev->dev, "Writing ZLP_REG%d failed status-0x%x\n", i + 2, status); |
2604 | i + 2, status); | ||
2605 | break; | 2515 | break; |
2606 | } else | 2516 | } else |
2607 | dbg("ZLP_REG%d Writing success status%d", | 2517 | dev_dbg(&dev->dev, "ZLP_REG%d Writing success status%d\n", i + 2, status); |
2608 | i + 2, status); | ||
2609 | } else { | 2518 | } else { |
2610 | Data = 0xff; | 2519 | Data = 0xff; |
2611 | status = mos7840_set_reg_sync(serial->port[i], | 2520 | status = mos7840_set_reg_sync(serial->port[i], |
2612 | (__u16) (ZLP_REG1 + | 2521 | (__u16) (ZLP_REG1 + |
2613 | ((__u16)mos7840_port->port_num) - 0x1), Data); | 2522 | ((__u16)mos7840_port->port_num) - 0x1), Data); |
2614 | dbg("ZLIP offset %x", | 2523 | dev_dbg(&dev->dev, "ZLIP offset %x\n", |
2615 | (__u16) (ZLP_REG1 + | 2524 | (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num) - 0x1)); |
2616 | ((__u16) mos7840_port->port_num) - 0x1)); | ||
2617 | if (status < 0) { | 2525 | if (status < 0) { |
2618 | dbg("Writing ZLP_REG%d failed status-0x%x", | 2526 | dev_dbg(&dev->dev, "Writing ZLP_REG%d failed status-0x%x\n", i + 1, status); |
2619 | i + 1, status); | ||
2620 | break; | 2527 | break; |
2621 | } else | 2528 | } else |
2622 | dbg("ZLP_REG%d Writing success status%d", | 2529 | dev_dbg(&dev->dev, "ZLP_REG%d Writing success status%d\n", i + 1, status); |
2623 | i + 1, status); | ||
2624 | 2530 | ||
2625 | } | 2531 | } |
2626 | mos7840_port->control_urb = usb_alloc_urb(0, GFP_KERNEL); | 2532 | mos7840_port->control_urb = usb_alloc_urb(0, GFP_KERNEL); |
@@ -2661,16 +2567,15 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2661 | MODEM_CONTROL_REGISTER, 0x0300); | 2567 | MODEM_CONTROL_REGISTER, 0x0300); |
2662 | } | 2568 | } |
2663 | } | 2569 | } |
2664 | dbg ("mos7840_startup: all ports configured..........."); | ||
2665 | 2570 | ||
2666 | /* Zero Length flag enable */ | 2571 | /* Zero Length flag enable */ |
2667 | Data = 0x0f; | 2572 | Data = 0x0f; |
2668 | status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); | 2573 | status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); |
2669 | if (status < 0) { | 2574 | if (status < 0) { |
2670 | dbg("Writing ZLP_REG5 failed status-0x%x", status); | 2575 | dev_dbg(&dev->dev, "Writing ZLP_REG5 failed status-0x%x\n", status); |
2671 | goto error; | 2576 | goto error; |
2672 | } else | 2577 | } else |
2673 | dbg("ZLP_REG5 Writing success status%d", status); | 2578 | dev_dbg(&dev->dev, "ZLP_REG5 Writing success status%d\n", status); |
2674 | 2579 | ||
2675 | /* setting configuration feature to one */ | 2580 | /* setting configuration feature to one */ |
2676 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | 2581 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
@@ -2700,11 +2605,6 @@ static void mos7840_disconnect(struct usb_serial *serial) | |||
2700 | unsigned long flags; | 2605 | unsigned long flags; |
2701 | struct moschip_port *mos7840_port; | 2606 | struct moschip_port *mos7840_port; |
2702 | 2607 | ||
2703 | if (!serial) { | ||
2704 | dbg("%s", "Invalid Handler"); | ||
2705 | return; | ||
2706 | } | ||
2707 | |||
2708 | /* check for the ports to be closed,close the ports and disconnect */ | 2608 | /* check for the ports to be closed,close the ports and disconnect */ |
2709 | 2609 | ||
2710 | /* free private structure allocated for serial port * | 2610 | /* free private structure allocated for serial port * |
@@ -2712,7 +2612,6 @@ static void mos7840_disconnect(struct usb_serial *serial) | |||
2712 | 2612 | ||
2713 | for (i = 0; i < serial->num_ports; ++i) { | 2613 | for (i = 0; i < serial->num_ports; ++i) { |
2714 | mos7840_port = mos7840_get_port_private(serial->port[i]); | 2614 | mos7840_port = mos7840_get_port_private(serial->port[i]); |
2715 | dbg ("mos7840_port %d = %p", i, mos7840_port); | ||
2716 | if (mos7840_port) { | 2615 | if (mos7840_port) { |
2717 | spin_lock_irqsave(&mos7840_port->pool_lock, flags); | 2616 | spin_lock_irqsave(&mos7840_port->pool_lock, flags); |
2718 | mos7840_port->zombie = 1; | 2617 | mos7840_port->zombie = 1; |
@@ -2732,11 +2631,6 @@ static void mos7840_release(struct usb_serial *serial) | |||
2732 | int i; | 2631 | int i; |
2733 | struct moschip_port *mos7840_port; | 2632 | struct moschip_port *mos7840_port; |
2734 | 2633 | ||
2735 | if (!serial) { | ||
2736 | dbg("%s", "Invalid Handler"); | ||
2737 | return; | ||
2738 | } | ||
2739 | |||
2740 | /* check for the ports to be closed,close the ports and disconnect */ | 2634 | /* check for the ports to be closed,close the ports and disconnect */ |
2741 | 2635 | ||
2742 | /* free private structure allocated for serial port * | 2636 | /* free private structure allocated for serial port * |
@@ -2744,7 +2638,6 @@ static void mos7840_release(struct usb_serial *serial) | |||
2744 | 2638 | ||
2745 | for (i = 0; i < serial->num_ports; ++i) { | 2639 | for (i = 0; i < serial->num_ports; ++i) { |
2746 | mos7840_port = mos7840_get_port_private(serial->port[i]); | 2640 | mos7840_port = mos7840_get_port_private(serial->port[i]); |
2747 | dbg("mos7840_port %d = %p", i, mos7840_port); | ||
2748 | if (mos7840_port) { | 2641 | if (mos7840_port) { |
2749 | if (mos7840_port->has_led) { | 2642 | if (mos7840_port->has_led) { |
2750 | /* Turn off LED */ | 2643 | /* Turn off LED */ |