aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-13 20:18:13 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-13 20:18:13 -0400
commit660f3b1410d327e8cd29adb5b834caa66ebbd7d4 (patch)
treedca344b5eb412f60bf6f7568392574b8402fe367
parent79cbeeaf26b3f8c3e3043e05a8e14ca7e7a49b89 (diff)
USB: serial: cp210x.c: remove dbg() usage
dbg() was a very old USB-serial-specific macro. This patch removes it from being used in the driver and uses dev_dbg() instead. CC: Johan Hovold <jhovold@gmail.com> CC: Preston Fick <preston.fick@silabs.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/serial/cp210x.c135
1 files changed, 64 insertions, 71 deletions
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 3f86cf3735a7..9cf698544175 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -304,9 +304,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
304 kfree(buf); 304 kfree(buf);
305 305
306 if (result != size) { 306 if (result != size) {
307 dbg("%s - Unable to send config request, " 307 dev_dbg(&port->dev, "%s - Unable to send config request, request=0x%x size=%d result=%d\n",
308 "request=0x%x size=%d result=%d", 308 __func__, request, size, result);
309 __func__, request, size, result);
310 if (result > 0) 309 if (result > 0)
311 result = -EPROTO; 310 result = -EPROTO;
312 311
@@ -361,9 +360,8 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
361 kfree(buf); 360 kfree(buf);
362 361
363 if ((size > 2 && result != size) || result < 0) { 362 if ((size > 2 && result != size) || result < 0) {
364 dbg("%s - Unable to send request, " 363 dev_dbg(&port->dev, "%s - Unable to send request, request=0x%x size=%d result=%d\n",
365 "request=0x%x size=%d result=%d", 364 __func__, request, size, result);
366 __func__, request, size, result);
367 if (result > 0) 365 if (result > 0)
368 result = -EPROTO; 366 result = -EPROTO;
369 367
@@ -487,13 +485,14 @@ static void cp210x_get_termios(struct tty_struct *tty,
487static void cp210x_get_termios_port(struct usb_serial_port *port, 485static void cp210x_get_termios_port(struct usb_serial_port *port,
488 unsigned int *cflagp, unsigned int *baudp) 486 unsigned int *cflagp, unsigned int *baudp)
489{ 487{
488 struct device *dev = &port->dev;
490 unsigned int cflag, modem_ctl[4]; 489 unsigned int cflag, modem_ctl[4];
491 unsigned int baud; 490 unsigned int baud;
492 unsigned int bits; 491 unsigned int bits;
493 492
494 cp210x_get_config(port, CP210X_GET_BAUDRATE, &baud, 4); 493 cp210x_get_config(port, CP210X_GET_BAUDRATE, &baud, 4);
495 494
496 dbg("%s - baud rate = %d", __func__, baud); 495 dev_dbg(dev, "%s - baud rate = %d\n", __func__, baud);
497 *baudp = baud; 496 *baudp = baud;
498 497
499 cflag = *cflagp; 498 cflag = *cflagp;
@@ -502,31 +501,30 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
502 cflag &= ~CSIZE; 501 cflag &= ~CSIZE;
503 switch (bits & BITS_DATA_MASK) { 502 switch (bits & BITS_DATA_MASK) {
504 case BITS_DATA_5: 503 case BITS_DATA_5:
505 dbg("%s - data bits = 5", __func__); 504 dev_dbg(dev, "%s - data bits = 5\n", __func__);
506 cflag |= CS5; 505 cflag |= CS5;
507 break; 506 break;
508 case BITS_DATA_6: 507 case BITS_DATA_6:
509 dbg("%s - data bits = 6", __func__); 508 dev_dbg(dev, "%s - data bits = 6\n", __func__);
510 cflag |= CS6; 509 cflag |= CS6;
511 break; 510 break;
512 case BITS_DATA_7: 511 case BITS_DATA_7:
513 dbg("%s - data bits = 7", __func__); 512 dev_dbg(dev, "%s - data bits = 7\n", __func__);
514 cflag |= CS7; 513 cflag |= CS7;
515 break; 514 break;
516 case BITS_DATA_8: 515 case BITS_DATA_8:
517 dbg("%s - data bits = 8", __func__); 516 dev_dbg(dev, "%s - data bits = 8\n", __func__);
518 cflag |= CS8; 517 cflag |= CS8;
519 break; 518 break;
520 case BITS_DATA_9: 519 case BITS_DATA_9:
521 dbg("%s - data bits = 9 (not supported, using 8 data bits)", 520 dev_dbg(dev, "%s - data bits = 9 (not supported, using 8 data bits)\n", __func__);
522 __func__);
523 cflag |= CS8; 521 cflag |= CS8;
524 bits &= ~BITS_DATA_MASK; 522 bits &= ~BITS_DATA_MASK;
525 bits |= BITS_DATA_8; 523 bits |= BITS_DATA_8;
526 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); 524 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
527 break; 525 break;
528 default: 526 default:
529 dbg("%s - Unknown number of data bits, using 8", __func__); 527 dev_dbg(dev, "%s - Unknown number of data bits, using 8\n", __func__);
530 cflag |= CS8; 528 cflag |= CS8;
531 bits &= ~BITS_DATA_MASK; 529 bits &= ~BITS_DATA_MASK;
532 bits |= BITS_DATA_8; 530 bits |= BITS_DATA_8;
@@ -536,29 +534,29 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
536 534
537 switch (bits & BITS_PARITY_MASK) { 535 switch (bits & BITS_PARITY_MASK) {
538 case BITS_PARITY_NONE: 536 case BITS_PARITY_NONE:
539 dbg("%s - parity = NONE", __func__); 537 dev_dbg(dev, "%s - parity = NONE\n", __func__);
540 cflag &= ~PARENB; 538 cflag &= ~PARENB;
541 break; 539 break;
542 case BITS_PARITY_ODD: 540 case BITS_PARITY_ODD:
543 dbg("%s - parity = ODD", __func__); 541 dev_dbg(dev, "%s - parity = ODD\n", __func__);
544 cflag |= (PARENB|PARODD); 542 cflag |= (PARENB|PARODD);
545 break; 543 break;
546 case BITS_PARITY_EVEN: 544 case BITS_PARITY_EVEN:
547 dbg("%s - parity = EVEN", __func__); 545 dev_dbg(dev, "%s - parity = EVEN\n", __func__);
548 cflag &= ~PARODD; 546 cflag &= ~PARODD;
549 cflag |= PARENB; 547 cflag |= PARENB;
550 break; 548 break;
551 case BITS_PARITY_MARK: 549 case BITS_PARITY_MARK:
552 dbg("%s - parity = MARK", __func__); 550 dev_dbg(dev, "%s - parity = MARK\n", __func__);
553 cflag |= (PARENB|PARODD|CMSPAR); 551 cflag |= (PARENB|PARODD|CMSPAR);
554 break; 552 break;
555 case BITS_PARITY_SPACE: 553 case BITS_PARITY_SPACE:
556 dbg("%s - parity = SPACE", __func__); 554 dev_dbg(dev, "%s - parity = SPACE\n", __func__);
557 cflag &= ~PARODD; 555 cflag &= ~PARODD;
558 cflag |= (PARENB|CMSPAR); 556 cflag |= (PARENB|CMSPAR);
559 break; 557 break;
560 default: 558 default:
561 dbg("%s - Unknown parity mode, disabling parity", __func__); 559 dev_dbg(dev, "%s - Unknown parity mode, disabling parity\n", __func__);
562 cflag &= ~PARENB; 560 cflag &= ~PARENB;
563 bits &= ~BITS_PARITY_MASK; 561 bits &= ~BITS_PARITY_MASK;
564 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); 562 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
@@ -568,21 +566,19 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
568 cflag &= ~CSTOPB; 566 cflag &= ~CSTOPB;
569 switch (bits & BITS_STOP_MASK) { 567 switch (bits & BITS_STOP_MASK) {
570 case BITS_STOP_1: 568 case BITS_STOP_1:
571 dbg("%s - stop bits = 1", __func__); 569 dev_dbg(dev, "%s - stop bits = 1\n", __func__);
572 break; 570 break;
573 case BITS_STOP_1_5: 571 case BITS_STOP_1_5:
574 dbg("%s - stop bits = 1.5 (not supported, using 1 stop bit)", 572 dev_dbg(dev, "%s - stop bits = 1.5 (not supported, using 1 stop bit)\n", __func__);
575 __func__);
576 bits &= ~BITS_STOP_MASK; 573 bits &= ~BITS_STOP_MASK;
577 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); 574 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
578 break; 575 break;
579 case BITS_STOP_2: 576 case BITS_STOP_2:
580 dbg("%s - stop bits = 2", __func__); 577 dev_dbg(dev, "%s - stop bits = 2\n", __func__);
581 cflag |= CSTOPB; 578 cflag |= CSTOPB;
582 break; 579 break;
583 default: 580 default:
584 dbg("%s - Unknown number of stop bits, using 1 stop bit", 581 dev_dbg(dev, "%s - Unknown number of stop bits, using 1 stop bit\n", __func__);
585 __func__);
586 bits &= ~BITS_STOP_MASK; 582 bits &= ~BITS_STOP_MASK;
587 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); 583 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
588 break; 584 break;
@@ -590,10 +586,10 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
590 586
591 cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16); 587 cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16);
592 if (modem_ctl[0] & 0x0008) { 588 if (modem_ctl[0] & 0x0008) {
593 dbg("%s - flow control = CRTSCTS", __func__); 589 dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__);
594 cflag |= CRTSCTS; 590 cflag |= CRTSCTS;
595 } else { 591 } else {
596 dbg("%s - flow control = NONE", __func__); 592 dev_dbg(dev, "%s - flow control = NONE\n", __func__);
597 cflag &= ~CRTSCTS; 593 cflag &= ~CRTSCTS;
598 } 594 }
599 595
@@ -640,7 +636,7 @@ static void cp210x_change_speed(struct tty_struct *tty,
640 */ 636 */
641 baud = cp210x_quantise_baudrate(baud); 637 baud = cp210x_quantise_baudrate(baud);
642 638
643 dbg("%s - setting baud rate to %u", __func__, baud); 639 dev_dbg(&port->dev, "%s - setting baud rate to %u\n", __func__, baud);
644 if (cp210x_set_config(port, CP210X_SET_BAUDRATE, &baud, 640 if (cp210x_set_config(port, CP210X_SET_BAUDRATE, &baud,
645 sizeof(baud))) { 641 sizeof(baud))) {
646 dev_warn(&port->dev, "failed to set baud rate to %u\n", baud); 642 dev_warn(&port->dev, "failed to set baud rate to %u\n", baud);
@@ -656,11 +652,12 @@ static void cp210x_change_speed(struct tty_struct *tty,
656static void cp210x_set_termios(struct tty_struct *tty, 652static void cp210x_set_termios(struct tty_struct *tty,
657 struct usb_serial_port *port, struct ktermios *old_termios) 653 struct usb_serial_port *port, struct ktermios *old_termios)
658{ 654{
655 struct device *dev = &port->dev;
659 unsigned int cflag, old_cflag; 656 unsigned int cflag, old_cflag;
660 unsigned int bits; 657 unsigned int bits;
661 unsigned int modem_ctl[4]; 658 unsigned int modem_ctl[4];
662 659
663 dbg("%s - port %d", __func__, port->number); 660 dev_dbg(dev, "%s - port %d\n", __func__, port->number);
664 661
665 if (!tty) 662 if (!tty)
666 return; 663 return;
@@ -678,34 +675,31 @@ static void cp210x_set_termios(struct tty_struct *tty,
678 switch (cflag & CSIZE) { 675 switch (cflag & CSIZE) {
679 case CS5: 676 case CS5:
680 bits |= BITS_DATA_5; 677 bits |= BITS_DATA_5;
681 dbg("%s - data bits = 5", __func__); 678 dev_dbg(dev, "%s - data bits = 5\n", __func__);
682 break; 679 break;
683 case CS6: 680 case CS6:
684 bits |= BITS_DATA_6; 681 bits |= BITS_DATA_6;
685 dbg("%s - data bits = 6", __func__); 682 dev_dbg(dev, "%s - data bits = 6\n", __func__);
686 break; 683 break;
687 case CS7: 684 case CS7:
688 bits |= BITS_DATA_7; 685 bits |= BITS_DATA_7;
689 dbg("%s - data bits = 7", __func__); 686 dev_dbg(dev, "%s - data bits = 7\n", __func__);
690 break; 687 break;
691 case CS8: 688 case CS8:
692 bits |= BITS_DATA_8; 689 bits |= BITS_DATA_8;
693 dbg("%s - data bits = 8", __func__); 690 dev_dbg(dev, "%s - data bits = 8\n", __func__);
694 break; 691 break;
695 /*case CS9: 692 /*case CS9:
696 bits |= BITS_DATA_9; 693 bits |= BITS_DATA_9;
697 dbg("%s - data bits = 9", __func__); 694 dev_dbg(dev, "%s - data bits = 9\n", __func__);
698 break;*/ 695 break;*/
699 default: 696 default:
700 dbg("cp210x driver does not " 697 dev_dbg(dev, "cp210x driver does not support the number of bits requested, using 8 bit mode\n");
701 "support the number of bits requested,"
702 " using 8 bit mode");
703 bits |= BITS_DATA_8; 698 bits |= BITS_DATA_8;
704 break; 699 break;
705 } 700 }
706 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) 701 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
707 dbg("Number of data bits requested " 702 dev_dbg(dev, "Number of data bits requested not supported by device\n");
708 "not supported by device");
709 } 703 }
710 704
711 if ((cflag & (PARENB|PARODD|CMSPAR)) != 705 if ((cflag & (PARENB|PARODD|CMSPAR)) !=
@@ -714,25 +708,25 @@ static void cp210x_set_termios(struct tty_struct *tty,
714 bits &= ~BITS_PARITY_MASK; 708 bits &= ~BITS_PARITY_MASK;
715 if (cflag & PARENB) { 709 if (cflag & PARENB) {
716 if (cflag & CMSPAR) { 710 if (cflag & CMSPAR) {
717 if (cflag & PARODD) { 711 if (cflag & PARODD) {
718 bits |= BITS_PARITY_MARK; 712 bits |= BITS_PARITY_MARK;
719 dbg("%s - parity = MARK", __func__); 713 dev_dbg(dev, "%s - parity = MARK\n", __func__);
720 } else { 714 } else {
721 bits |= BITS_PARITY_SPACE; 715 bits |= BITS_PARITY_SPACE;
722 dbg("%s - parity = SPACE", __func__); 716 dev_dbg(dev, "%s - parity = SPACE\n", __func__);
723 } 717 }
724 } else { 718 } else {
725 if (cflag & PARODD) { 719 if (cflag & PARODD) {
726 bits |= BITS_PARITY_ODD; 720 bits |= BITS_PARITY_ODD;
727 dbg("%s - parity = ODD", __func__); 721 dev_dbg(dev, "%s - parity = ODD\n", __func__);
728 } else { 722 } else {
729 bits |= BITS_PARITY_EVEN; 723 bits |= BITS_PARITY_EVEN;
730 dbg("%s - parity = EVEN", __func__); 724 dev_dbg(dev, "%s - parity = EVEN\n", __func__);
731 } 725 }
732 } 726 }
733 } 727 }
734 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) 728 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
735 dbg("Parity mode not supported by device"); 729 dev_dbg(dev, "Parity mode not supported by device\n");
736 } 730 }
737 731
738 if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) { 732 if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) {
@@ -740,37 +734,36 @@ static void cp210x_set_termios(struct tty_struct *tty,
740 bits &= ~BITS_STOP_MASK; 734 bits &= ~BITS_STOP_MASK;
741 if (cflag & CSTOPB) { 735 if (cflag & CSTOPB) {
742 bits |= BITS_STOP_2; 736 bits |= BITS_STOP_2;
743 dbg("%s - stop bits = 2", __func__); 737 dev_dbg(dev, "%s - stop bits = 2\n", __func__);
744 } else { 738 } else {
745 bits |= BITS_STOP_1; 739 bits |= BITS_STOP_1;
746 dbg("%s - stop bits = 1", __func__); 740 dev_dbg(dev, "%s - stop bits = 1\n", __func__);
747 } 741 }
748 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) 742 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
749 dbg("Number of stop bits requested " 743 dev_dbg(dev, "Number of stop bits requested not supported by device\n");
750 "not supported by device");
751 } 744 }
752 745
753 if ((cflag & CRTSCTS) != (old_cflag & CRTSCTS)) { 746 if ((cflag & CRTSCTS) != (old_cflag & CRTSCTS)) {
754 cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16); 747 cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16);
755 dbg("%s - read modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x", 748 dev_dbg(dev, "%s - read modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x\n",
756 __func__, modem_ctl[0], modem_ctl[1], 749 __func__, modem_ctl[0], modem_ctl[1],
757 modem_ctl[2], modem_ctl[3]); 750 modem_ctl[2], modem_ctl[3]);
758 751
759 if (cflag & CRTSCTS) { 752 if (cflag & CRTSCTS) {
760 modem_ctl[0] &= ~0x7B; 753 modem_ctl[0] &= ~0x7B;
761 modem_ctl[0] |= 0x09; 754 modem_ctl[0] |= 0x09;
762 modem_ctl[1] = 0x80; 755 modem_ctl[1] = 0x80;
763 dbg("%s - flow control = CRTSCTS", __func__); 756 dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__);
764 } else { 757 } else {
765 modem_ctl[0] &= ~0x7B; 758 modem_ctl[0] &= ~0x7B;
766 modem_ctl[0] |= 0x01; 759 modem_ctl[0] |= 0x01;
767 modem_ctl[1] |= 0x40; 760 modem_ctl[1] |= 0x40;
768 dbg("%s - flow control = NONE", __func__); 761 dev_dbg(dev, "%s - flow control = NONE\n", __func__);
769 } 762 }
770 763
771 dbg("%s - write modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x", 764 dev_dbg(dev, "%s - write modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x\n",
772 __func__, modem_ctl[0], modem_ctl[1], 765 __func__, modem_ctl[0], modem_ctl[1],
773 modem_ctl[2], modem_ctl[3]); 766 modem_ctl[2], modem_ctl[3]);
774 cp210x_set_config(port, CP210X_SET_FLOW, modem_ctl, 16); 767 cp210x_set_config(port, CP210X_SET_FLOW, modem_ctl, 16);
775 } 768 }
776 769
@@ -805,7 +798,7 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port,
805 control |= CONTROL_WRITE_DTR; 798 control |= CONTROL_WRITE_DTR;
806 } 799 }
807 800
808 dbg("%s - control = 0x%.4x", __func__, control); 801 dev_dbg(&port->dev, "%s - control = 0x%.4x\n", __func__, control);
809 802
810 return cp210x_set_config(port, CP210X_SET_MHS, &control, 2); 803 return cp210x_set_config(port, CP210X_SET_MHS, &control, 2);
811} 804}
@@ -833,7 +826,7 @@ static int cp210x_tiocmget (struct tty_struct *tty)
833 |((control & CONTROL_RING)? TIOCM_RI : 0) 826 |((control & CONTROL_RING)? TIOCM_RI : 0)
834 |((control & CONTROL_DCD) ? TIOCM_CD : 0); 827 |((control & CONTROL_DCD) ? TIOCM_CD : 0);
835 828
836 dbg("%s - control = 0x%.2x", __func__, control); 829 dev_dbg(&port->dev, "%s - control = 0x%.2x\n", __func__, control);
837 830
838 return result; 831 return result;
839} 832}
@@ -847,8 +840,8 @@ static void cp210x_break_ctl (struct tty_struct *tty, int break_state)
847 state = BREAK_OFF; 840 state = BREAK_OFF;
848 else 841 else
849 state = BREAK_ON; 842 state = BREAK_ON;
850 dbg("%s - turning break %s", __func__, 843 dev_dbg(&port->dev, "%s - turning break %s\n", __func__,
851 state == BREAK_OFF ? "off" : "on"); 844 state == BREAK_OFF ? "off" : "on");
852 cp210x_set_config(port, CP210X_SET_BREAK, &state, 2); 845 cp210x_set_config(port, CP210X_SET_BREAK, &state, 2);
853} 846}
854 847