Skip to content

Commit

Permalink
serial: omap: make sure to put() on poll_get_char
Browse files Browse the repository at this point in the history
if we would reach serial_omap_get_char() while
Data Ready bit isn't set, we would return from
it without kicking our pm timer. This would mean
we would, eventually, have an unbalanced
pm_runtime_get on our device which would prevent
it from ever sleeping again.

Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Felipe Balbi authored and Greg Kroah-Hartman committed Sep 6, 2012
1 parent 9727faf commit a6b19c3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/tty/serial/omap-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1005,12 +1005,17 @@ static int serial_omap_poll_get_char(struct uart_port *port)

pm_runtime_get_sync(up->dev);
status = serial_in(up, UART_LSR);
if (!(status & UART_LSR_DR))
return NO_POLL_CHAR;
if (!(status & UART_LSR_DR)) {
status = NO_POLL_CHAR;
goto out;
}

status = serial_in(up, UART_RX);

out:
pm_runtime_mark_last_busy(up->dev);
pm_runtime_put_autosuspend(up->dev);

return status;
}

Expand Down

0 comments on commit a6b19c3

Please sign in to comment.