Skip to content

Commit

Permalink
serial: omap: Make context_loss_cnt signed
Browse files Browse the repository at this point in the history
get_context_loss_count returns an int however it is stored in
unsigned integer context_loss_cnt . This patch tries to make
context_loss_cnt int. So that in case of errors the value
(which may be negative) is not interpreted wrongly.

In serial_omap_runtime_resume in case of errors returned by
get_context_loss_count print a warning and do a restore.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Shubhrajyoti D authored and Greg Kroah-Hartman committed Oct 25, 2012
1 parent 57cf50a commit 39aee51
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/tty/serial/omap-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct uart_omap_port {
unsigned char msr_saved_flags;
char name[20];
unsigned long port_activity;
u32 context_loss_cnt;
int context_loss_cnt;
u32 errata;
u8 wakeups_enabled;
unsigned int irq_pending:1;
Expand Down Expand Up @@ -1556,11 +1556,15 @@ static int serial_omap_runtime_resume(struct device *dev)
{
struct uart_omap_port *up = dev_get_drvdata(dev);

u32 loss_cnt = serial_omap_get_context_loss_count(up);
int loss_cnt = serial_omap_get_context_loss_count(up);

if (up->context_loss_cnt != loss_cnt)
if (loss_cnt < 0) {
dev_err(dev, "serial_omap_get_context_loss_count failed : %d\n",
loss_cnt);
serial_omap_restore_context(up);

} else if (up->context_loss_cnt != loss_cnt) {
serial_omap_restore_context(up);
}
up->latency = up->calc_latency;
schedule_work(&up->qos_work);

Expand Down

0 comments on commit 39aee51

Please sign in to comment.