diff options
Diffstat (limited to 'drivers/tty/serial/lpc32xx_hs.c')
-rw-r--r-- | drivers/tty/serial/lpc32xx_hs.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c index 0e86bff3fe2a..dffea6b2cd7d 100644 --- a/drivers/tty/serial/lpc32xx_hs.c +++ b/drivers/tty/serial/lpc32xx_hs.c | |||
@@ -257,17 +257,8 @@ static void __serial_uart_flush(struct uart_port *port) | |||
257 | 257 | ||
258 | static void __serial_lpc32xx_rx(struct uart_port *port) | 258 | static void __serial_lpc32xx_rx(struct uart_port *port) |
259 | { | 259 | { |
260 | struct tty_port *tport = &port->state->port; | ||
260 | unsigned int tmp, flag; | 261 | unsigned int tmp, flag; |
261 | struct tty_struct *tty = tty_port_tty_get(&port->state->port); | ||
262 | |||
263 | if (!tty) { | ||
264 | /* Discard data: no tty available */ | ||
265 | while (!(readl(LPC32XX_HSUART_FIFO(port->membase)) & | ||
266 | LPC32XX_HSU_RX_EMPTY)) | ||
267 | ; | ||
268 | |||
269 | return; | ||
270 | } | ||
271 | 262 | ||
272 | /* Read data from FIFO and push into terminal */ | 263 | /* Read data from FIFO and push into terminal */ |
273 | tmp = readl(LPC32XX_HSUART_FIFO(port->membase)); | 264 | tmp = readl(LPC32XX_HSUART_FIFO(port->membase)); |
@@ -281,15 +272,14 @@ static void __serial_lpc32xx_rx(struct uart_port *port) | |||
281 | LPC32XX_HSUART_IIR(port->membase)); | 272 | LPC32XX_HSUART_IIR(port->membase)); |
282 | port->icount.frame++; | 273 | port->icount.frame++; |
283 | flag = TTY_FRAME; | 274 | flag = TTY_FRAME; |
284 | tty_insert_flip_char(tty, 0, TTY_FRAME); | 275 | tty_insert_flip_char(tport, 0, TTY_FRAME); |
285 | } | 276 | } |
286 | 277 | ||
287 | tty_insert_flip_char(tty, (tmp & 0xFF), flag); | 278 | tty_insert_flip_char(tport, (tmp & 0xFF), flag); |
288 | 279 | ||
289 | tmp = readl(LPC32XX_HSUART_FIFO(port->membase)); | 280 | tmp = readl(LPC32XX_HSUART_FIFO(port->membase)); |
290 | } | 281 | } |
291 | tty_flip_buffer_push(tty); | 282 | tty_flip_buffer_push(tport); |
292 | tty_kref_put(tty); | ||
293 | } | 283 | } |
294 | 284 | ||
295 | static void __serial_lpc32xx_tx(struct uart_port *port) | 285 | static void __serial_lpc32xx_tx(struct uart_port *port) |
@@ -332,7 +322,7 @@ exit_tx: | |||
332 | static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id) | 322 | static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id) |
333 | { | 323 | { |
334 | struct uart_port *port = dev_id; | 324 | struct uart_port *port = dev_id; |
335 | struct tty_struct *tty = tty_port_tty_get(&port->state->port); | 325 | struct tty_port *tport = &port->state->port; |
336 | u32 status; | 326 | u32 status; |
337 | 327 | ||
338 | spin_lock(&port->lock); | 328 | spin_lock(&port->lock); |
@@ -356,17 +346,14 @@ static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id) | |||
356 | writel(LPC32XX_HSU_RX_OE_INT, | 346 | writel(LPC32XX_HSU_RX_OE_INT, |
357 | LPC32XX_HSUART_IIR(port->membase)); | 347 | LPC32XX_HSUART_IIR(port->membase)); |
358 | port->icount.overrun++; | 348 | port->icount.overrun++; |
359 | if (tty) { | 349 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
360 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 350 | tty_schedule_flip(tport); |
361 | tty_schedule_flip(tty); | ||
362 | } | ||
363 | } | 351 | } |
364 | 352 | ||
365 | /* Data received? */ | 353 | /* Data received? */ |
366 | if (status & (LPC32XX_HSU_RX_TIMEOUT_INT | LPC32XX_HSU_RX_TRIG_INT)) { | 354 | if (status & (LPC32XX_HSU_RX_TIMEOUT_INT | LPC32XX_HSU_RX_TRIG_INT)) { |
367 | __serial_lpc32xx_rx(port); | 355 | __serial_lpc32xx_rx(port); |
368 | if (tty) | 356 | tty_flip_buffer_push(tport); |
369 | tty_flip_buffer_push(tty); | ||
370 | } | 357 | } |
371 | 358 | ||
372 | /* Transmit data request? */ | 359 | /* Transmit data request? */ |
@@ -376,7 +363,6 @@ static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id) | |||
376 | } | 363 | } |
377 | 364 | ||
378 | spin_unlock(&port->lock); | 365 | spin_unlock(&port->lock); |
379 | tty_kref_put(tty); | ||
380 | 366 | ||
381 | return IRQ_HANDLED; | 367 | return IRQ_HANDLED; |
382 | } | 368 | } |