aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/sh-sci.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 2cbefd2ca522..0251077693d1 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -496,7 +496,7 @@ static inline void sci_receive_chars(struct uart_port *port)
496 } 496 }
497 497
498 /* Nonzero => end-of-break */ 498 /* Nonzero => end-of-break */
499 pr_debug("scif: debounce<%02x>\n", c); 499 dev_dbg(port->dev, "debounce<%02x>\n", c);
500 sci_port->break_flag = 0; 500 sci_port->break_flag = 0;
501 501
502 if (STEPFN(c)) { 502 if (STEPFN(c)) {
@@ -513,12 +513,13 @@ static inline void sci_receive_chars(struct uart_port *port)
513 /* Store data and status */ 513 /* Store data and status */
514 if (status&SCxSR_FER(port)) { 514 if (status&SCxSR_FER(port)) {
515 flag = TTY_FRAME; 515 flag = TTY_FRAME;
516 pr_debug("sci: frame error\n"); 516 dev_notice(port->dev, "frame error\n");
517 } else if (status&SCxSR_PER(port)) { 517 } else if (status&SCxSR_PER(port)) {
518 flag = TTY_PARITY; 518 flag = TTY_PARITY;
519 pr_debug("sci: parity error\n"); 519 dev_notice(port->dev, "parity error\n");
520 } else 520 } else
521 flag = TTY_NORMAL; 521 flag = TTY_NORMAL;
522
522 tty_insert_flip_char(tty, c, flag); 523 tty_insert_flip_char(tty, c, flag);
523 } 524 }
524 } 525 }
@@ -578,7 +579,8 @@ static inline int sci_handle_errors(struct uart_port *port)
578 /* overrun error */ 579 /* overrun error */
579 if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) 580 if (tty_insert_flip_char(tty, 0, TTY_OVERRUN))
580 copied++; 581 copied++;
581 pr_debug("sci: overrun error\n"); 582
583 dev_notice(port->dev, "overrun error");
582 } 584 }
583 585
584 if (status & SCxSR_FER(port)) { 586 if (status & SCxSR_FER(port)) {
@@ -593,7 +595,9 @@ static inline int sci_handle_errors(struct uart_port *port)
593 /* Do sysrq handling. */ 595 /* Do sysrq handling. */
594 if (uart_handle_break(port)) 596 if (uart_handle_break(port))
595 return 0; 597 return 0;
596 pr_debug("sci: BREAK detected\n"); 598
599 dev_dbg(port->dev, "BREAK detected\n");
600
597 if (tty_insert_flip_char(tty, 0, TTY_BREAK)) 601 if (tty_insert_flip_char(tty, 0, TTY_BREAK))
598 copied++; 602 copied++;
599 } 603 }
@@ -602,7 +606,8 @@ static inline int sci_handle_errors(struct uart_port *port)
602 /* frame error */ 606 /* frame error */
603 if (tty_insert_flip_char(tty, 0, TTY_FRAME)) 607 if (tty_insert_flip_char(tty, 0, TTY_FRAME))
604 copied++; 608 copied++;
605 pr_debug("sci: frame error\n"); 609
610 dev_notice(port->dev, "frame error\n");
606 } 611 }
607 } 612 }
608 613
@@ -610,7 +615,8 @@ static inline int sci_handle_errors(struct uart_port *port)
610 /* parity error */ 615 /* parity error */
611 if (tty_insert_flip_char(tty, 0, TTY_PARITY)) 616 if (tty_insert_flip_char(tty, 0, TTY_PARITY))
612 copied++; 617 copied++;
613 pr_debug("sci: parity error\n"); 618
619 dev_notice(port->dev, "parity error");
614 } 620 }
615 621
616 if (copied) 622 if (copied)
@@ -637,7 +643,8 @@ static inline int sci_handle_breaks(struct uart_port *port)
637 /* Notify of BREAK */ 643 /* Notify of BREAK */
638 if (tty_insert_flip_char(tty, 0, TTY_BREAK)) 644 if (tty_insert_flip_char(tty, 0, TTY_BREAK))
639 copied++; 645 copied++;
640 pr_debug("sci: BREAK detected\n"); 646
647 dev_dbg(port->dev, "BREAK detected\n");
641 } 648 }
642 649
643#if defined(SCIF_ORER) 650#if defined(SCIF_ORER)
@@ -646,7 +653,7 @@ static inline int sci_handle_breaks(struct uart_port *port)
646 sci_out(port, SCLSR, 0); 653 sci_out(port, SCLSR, 0);
647 if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) { 654 if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) {
648 copied++; 655 copied++;
649 pr_debug("sci: overrun error\n"); 656 dev_notice(port->dev, "overrun error\n");
650 } 657 }
651 } 658 }
652#endif 659#endif
@@ -698,7 +705,7 @@ static irqreturn_t sci_er_interrupt(int irq, void *ptr)
698 sci_out(port, SCLSR, 0); 705 sci_out(port, SCLSR, 0);
699 tty_insert_flip_char(tty, 0, TTY_OVERRUN); 706 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
700 tty_flip_buffer_push(tty); 707 tty_flip_buffer_push(tty);
701 pr_debug("scif: overrun error\n"); 708 dev_notice(port->dev, "overrun error\n");
702 } 709 }
703#endif 710#endif
704 sci_rx_interrupt(irq, ptr); 711 sci_rx_interrupt(irq, ptr);
@@ -782,23 +789,22 @@ static int sci_request_irq(struct sci_port *port)
782 "SCI Transmit Data Empty", "SCI Break" }; 789 "SCI Transmit Data Empty", "SCI Break" };
783 790
784 if (port->irqs[0] == port->irqs[1]) { 791 if (port->irqs[0] == port->irqs[1]) {
785 if (!port->irqs[0]) { 792 if (unlikely(!port->irqs[0]))
786 printk(KERN_ERR "sci: Cannot allocate irq.(IRQ=0)\n");
787 return -ENODEV; 793 return -ENODEV;
788 }
789 794
790 if (request_irq(port->irqs[0], sci_mpxed_interrupt, 795 if (request_irq(port->irqs[0], sci_mpxed_interrupt,
791 IRQF_DISABLED, "sci", port)) { 796 IRQF_DISABLED, "sci", port)) {
792 printk(KERN_ERR "sci: Cannot allocate irq.\n"); 797 dev_err(port->port.dev, "Can't allocate IRQ\n");
793 return -ENODEV; 798 return -ENODEV;
794 } 799 }
795 } else { 800 } else {
796 for (i = 0; i < ARRAY_SIZE(handlers); i++) { 801 for (i = 0; i < ARRAY_SIZE(handlers); i++) {
797 if (!port->irqs[i]) 802 if (unlikely(!port->irqs[i]))
798 continue; 803 continue;
804
799 if (request_irq(port->irqs[i], handlers[i], 805 if (request_irq(port->irqs[i], handlers[i],
800 IRQF_DISABLED, desc[i], port)) { 806 IRQF_DISABLED, desc[i], port)) {
801 printk(KERN_ERR "sci: Cannot allocate irq.\n"); 807 dev_err(port->port.dev, "Can't allocate IRQ\n");
802 return -ENODEV; 808 return -ENODEV;
803 } 809 }
804 } 810 }
@@ -811,12 +817,9 @@ static void sci_free_irq(struct sci_port *port)
811{ 817{
812 int i; 818 int i;
813 819
814 if (port->irqs[0] == port->irqs[1]) { 820 if (port->irqs[0] == port->irqs[1])
815 if (!port->irqs[0]) 821 free_irq(port->irqs[0], port);
816 printk(KERN_ERR "sci: sci_free_irq error\n"); 822 else {
817 else
818 free_irq(port->irqs[0], port);
819 } else {
820 for (i = 0; i < ARRAY_SIZE(port->irqs); i++) { 823 for (i = 0; i < ARRAY_SIZE(port->irqs); i++) {
821 if (!port->irqs[i]) 824 if (!port->irqs[i])
822 continue; 825 continue;
@@ -1040,7 +1043,7 @@ static void sci_config_port(struct uart_port *port, int flags)
1040 port->membase = ioremap_nocache(port->mapbase, 0x40); 1043 port->membase = ioremap_nocache(port->mapbase, 0x40);
1041#endif 1044#endif
1042 1045
1043 printk(KERN_ERR "sci: can't remap port#%d\n", port->line); 1046 dev_err(port->dev, "can't remap port#%d\n", port->line);
1044 } 1047 }
1045} 1048}
1046 1049