aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/sc26xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial/sc26xx.c')
-rw-r--r--drivers/tty/serial/sc26xx.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/tty/serial/sc26xx.c b/drivers/tty/serial/sc26xx.c
index aced1dd923d8..c9735680762d 100644
--- a/drivers/tty/serial/sc26xx.c
+++ b/drivers/tty/serial/sc26xx.c
@@ -136,16 +136,17 @@ static void sc26xx_disable_irq(struct uart_port *port, int mask)
136 WRITE_SC(port, IMR, up->imr); 136 WRITE_SC(port, IMR, up->imr);
137} 137}
138 138
139static struct tty_struct *receive_chars(struct uart_port *port) 139static bool receive_chars(struct uart_port *port)
140{ 140{
141 struct tty_struct *tty = NULL; 141 struct tty_port *tport = NULL;
142 int limit = 10000; 142 int limit = 10000;
143 unsigned char ch; 143 unsigned char ch;
144 char flag; 144 char flag;
145 u8 status; 145 u8 status;
146 146
147 /* FIXME what is this trying to achieve? */
147 if (port->state != NULL) /* Unopened serial console */ 148 if (port->state != NULL) /* Unopened serial console */
148 tty = port->state->port.tty; 149 tport = &port->state->port;
149 150
150 while (limit-- > 0) { 151 while (limit-- > 0) {
151 status = READ_SC_PORT(port, SR); 152 status = READ_SC_PORT(port, SR);
@@ -185,9 +186,9 @@ static struct tty_struct *receive_chars(struct uart_port *port)
185 if (status & port->ignore_status_mask) 186 if (status & port->ignore_status_mask)
186 continue; 187 continue;
187 188
188 tty_insert_flip_char(tty, ch, flag); 189 tty_insert_flip_char(tport, ch, flag);
189 } 190 }
190 return tty; 191 return !!tport;
191} 192}
192 193
193static void transmit_chars(struct uart_port *port) 194static void transmit_chars(struct uart_port *port)
@@ -217,36 +218,36 @@ static void transmit_chars(struct uart_port *port)
217static irqreturn_t sc26xx_interrupt(int irq, void *dev_id) 218static irqreturn_t sc26xx_interrupt(int irq, void *dev_id)
218{ 219{
219 struct uart_sc26xx_port *up = dev_id; 220 struct uart_sc26xx_port *up = dev_id;
220 struct tty_struct *tty;
221 unsigned long flags; 221 unsigned long flags;
222 bool push;
222 u8 isr; 223 u8 isr;
223 224
224 spin_lock_irqsave(&up->port[0].lock, flags); 225 spin_lock_irqsave(&up->port[0].lock, flags);
225 226
226 tty = NULL; 227 push = false;
227 isr = READ_SC(&up->port[0], ISR); 228 isr = READ_SC(&up->port[0], ISR);
228 if (isr & ISR_TXRDYA) 229 if (isr & ISR_TXRDYA)
229 transmit_chars(&up->port[0]); 230 transmit_chars(&up->port[0]);
230 if (isr & ISR_RXRDYA) 231 if (isr & ISR_RXRDYA)
231 tty = receive_chars(&up->port[0]); 232 push = receive_chars(&up->port[0]);
232 233
233 spin_unlock(&up->port[0].lock); 234 spin_unlock(&up->port[0].lock);
234 235
235 if (tty) 236 if (push)
236 tty_flip_buffer_push(tty); 237 tty_flip_buffer_push(&up->port[0].state->port);
237 238
238 spin_lock(&up->port[1].lock); 239 spin_lock(&up->port[1].lock);
239 240
240 tty = NULL; 241 push = false;
241 if (isr & ISR_TXRDYB) 242 if (isr & ISR_TXRDYB)
242 transmit_chars(&up->port[1]); 243 transmit_chars(&up->port[1]);
243 if (isr & ISR_RXRDYB) 244 if (isr & ISR_RXRDYB)
244 tty = receive_chars(&up->port[1]); 245 push = receive_chars(&up->port[1]);
245 246
246 spin_unlock_irqrestore(&up->port[1].lock, flags); 247 spin_unlock_irqrestore(&up->port[1].lock, flags);
247 248
248 if (tty) 249 if (push)
249 tty_flip_buffer_push(tty); 250 tty_flip_buffer_push(&up->port[1].state->port);
250 251
251 return IRQ_HANDLED; 252 return IRQ_HANDLED;
252} 253}