aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/sunsab.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial/sunsab.c')
-rw-r--r--drivers/tty/serial/sunsab.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c
index bd8b3b634103..8de2213664e0 100644
--- a/drivers/tty/serial/sunsab.c
+++ b/drivers/tty/serial/sunsab.c
@@ -107,11 +107,11 @@ static __inline__ void sunsab_cec_wait(struct uart_sunsab_port *up)
107 udelay(1); 107 udelay(1);
108} 108}
109 109
110static struct tty_struct * 110static struct tty_port *
111receive_chars(struct uart_sunsab_port *up, 111receive_chars(struct uart_sunsab_port *up,
112 union sab82532_irq_status *stat) 112 union sab82532_irq_status *stat)
113{ 113{
114 struct tty_struct *tty = NULL; 114 struct tty_port *port = NULL;
115 unsigned char buf[32]; 115 unsigned char buf[32];
116 int saw_console_brk = 0; 116 int saw_console_brk = 0;
117 int free_fifo = 0; 117 int free_fifo = 0;
@@ -119,7 +119,7 @@ receive_chars(struct uart_sunsab_port *up,
119 int i; 119 int i;
120 120
121 if (up->port.state != NULL) /* Unopened serial console */ 121 if (up->port.state != NULL) /* Unopened serial console */
122 tty = up->port.state->port.tty; 122 port = &up->port.state->port;
123 123
124 /* Read number of BYTES (Character + Status) available. */ 124 /* Read number of BYTES (Character + Status) available. */
125 if (stat->sreg.isr0 & SAB82532_ISR0_RPF) { 125 if (stat->sreg.isr0 & SAB82532_ISR0_RPF) {
@@ -136,7 +136,7 @@ receive_chars(struct uart_sunsab_port *up,
136 if (stat->sreg.isr0 & SAB82532_ISR0_TIME) { 136 if (stat->sreg.isr0 & SAB82532_ISR0_TIME) {
137 sunsab_cec_wait(up); 137 sunsab_cec_wait(up);
138 writeb(SAB82532_CMDR_RFRD, &up->regs->w.cmdr); 138 writeb(SAB82532_CMDR_RFRD, &up->regs->w.cmdr);
139 return tty; 139 return port;
140 } 140 }
141 141
142 if (stat->sreg.isr0 & SAB82532_ISR0_RFO) 142 if (stat->sreg.isr0 & SAB82532_ISR0_RFO)
@@ -160,11 +160,6 @@ receive_chars(struct uart_sunsab_port *up,
160 for (i = 0; i < count; i++) { 160 for (i = 0; i < count; i++) {
161 unsigned char ch = buf[i], flag; 161 unsigned char ch = buf[i], flag;
162 162
163 if (tty == NULL) {
164 uart_handle_sysrq_char(&up->port, ch);
165 continue;
166 }
167
168 flag = TTY_NORMAL; 163 flag = TTY_NORMAL;
169 up->port.icount.rx++; 164 up->port.icount.rx++;
170 165
@@ -213,15 +208,15 @@ receive_chars(struct uart_sunsab_port *up,
213 208
214 if ((stat->sreg.isr0 & (up->port.ignore_status_mask & 0xff)) == 0 && 209 if ((stat->sreg.isr0 & (up->port.ignore_status_mask & 0xff)) == 0 &&
215 (stat->sreg.isr1 & ((up->port.ignore_status_mask >> 8) & 0xff)) == 0) 210 (stat->sreg.isr1 & ((up->port.ignore_status_mask >> 8) & 0xff)) == 0)
216 tty_insert_flip_char(tty, ch, flag); 211 tty_insert_flip_char(port, ch, flag);
217 if (stat->sreg.isr0 & SAB82532_ISR0_RFO) 212 if (stat->sreg.isr0 & SAB82532_ISR0_RFO)
218 tty_insert_flip_char(tty, 0, TTY_OVERRUN); 213 tty_insert_flip_char(port, 0, TTY_OVERRUN);
219 } 214 }
220 215
221 if (saw_console_brk) 216 if (saw_console_brk)
222 sun_do_break(); 217 sun_do_break();
223 218
224 return tty; 219 return port;
225} 220}
226 221
227static void sunsab_stop_tx(struct uart_port *); 222static void sunsab_stop_tx(struct uart_port *);
@@ -304,7 +299,7 @@ static void check_status(struct uart_sunsab_port *up,
304static irqreturn_t sunsab_interrupt(int irq, void *dev_id) 299static irqreturn_t sunsab_interrupt(int irq, void *dev_id)
305{ 300{
306 struct uart_sunsab_port *up = dev_id; 301 struct uart_sunsab_port *up = dev_id;
307 struct tty_struct *tty; 302 struct tty_port *port = NULL;
308 union sab82532_irq_status status; 303 union sab82532_irq_status status;
309 unsigned long flags; 304 unsigned long flags;
310 unsigned char gis; 305 unsigned char gis;
@@ -318,12 +313,11 @@ static irqreturn_t sunsab_interrupt(int irq, void *dev_id)
318 if (gis & 2) 313 if (gis & 2)
319 status.sreg.isr1 = readb(&up->regs->r.isr1); 314 status.sreg.isr1 = readb(&up->regs->r.isr1);
320 315
321 tty = NULL;
322 if (status.stat) { 316 if (status.stat) {
323 if ((status.sreg.isr0 & (SAB82532_ISR0_TCD | SAB82532_ISR0_TIME | 317 if ((status.sreg.isr0 & (SAB82532_ISR0_TCD | SAB82532_ISR0_TIME |
324 SAB82532_ISR0_RFO | SAB82532_ISR0_RPF)) || 318 SAB82532_ISR0_RFO | SAB82532_ISR0_RPF)) ||
325 (status.sreg.isr1 & SAB82532_ISR1_BRK)) 319 (status.sreg.isr1 & SAB82532_ISR1_BRK))
326 tty = receive_chars(up, &status); 320 port = receive_chars(up, &status);
327 if ((status.sreg.isr0 & SAB82532_ISR0_CDSC) || 321 if ((status.sreg.isr0 & SAB82532_ISR0_CDSC) ||
328 (status.sreg.isr1 & SAB82532_ISR1_CSC)) 322 (status.sreg.isr1 & SAB82532_ISR1_CSC))
329 check_status(up, &status); 323 check_status(up, &status);
@@ -333,8 +327,8 @@ static irqreturn_t sunsab_interrupt(int irq, void *dev_id)
333 327
334 spin_unlock_irqrestore(&up->port.lock, flags); 328 spin_unlock_irqrestore(&up->port.lock, flags);
335 329
336 if (tty) 330 if (port)
337 tty_flip_buffer_push(tty); 331 tty_flip_buffer_push(port);
338 332
339 return IRQ_HANDLED; 333 return IRQ_HANDLED;
340} 334}