Skip to content

Commit

Permalink
dz: always check if it is safe to console_putchar()
Browse files Browse the repository at this point in the history
Polled transmission is tricky enough with the DZ11 design.  While "loop" is
set to a high value, conceptually you are not allowed to transmit without
checking whether the device offers the right transmission line (yes, it is the
device that selects the line -- the driver has no control over it other than
disabling the transmitter offered if it is the wrong one), so the loop has to
be run at least once.

Well, the '1977 or PDP11 view of how serial lines should be handled...  Except
that the serial interface used to be quite an impressive board back then
rather than chip.

Signed-off-by: Maciej W. Rozycki <[email protected]>
Cc: Jiri Slaby <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Maciej W. Rozycki authored and Linus Torvalds committed Feb 7, 2008
1 parent d4dd146 commit dbab812
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/serial/dz.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ static void dz_console_putchar(struct uart_port *uport, int ch)
iob();
spin_unlock_irqrestore(&dport->port.lock, flags);

while (loops--) {
do {
trdy = dz_in(dport, DZ_CSR);
if (!(trdy & DZ_TRDY))
continue;
Expand All @@ -696,7 +696,7 @@ static void dz_console_putchar(struct uart_port *uport, int ch)
dz_out(dport, DZ_TCR, mask);
iob();
udelay(2);
}
} while (loops--);

if (loops) /* Cannot send otherwise. */
dz_out(dport, DZ_TDR, ch);
Expand Down

0 comments on commit dbab812

Please sign in to comment.