diff options
author | Shubhrajyoti D <shubhrajyoti@ti.com> | 2012-10-03 07:54:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-25 14:29:10 -0400 |
commit | 39aee51d439d8ad7339ee49dc3ccaf91ca61d8f0 (patch) | |
tree | becd86cafee1154112430e35e647a89499c19d6d /drivers/tty/serial/omap-serial.c | |
parent | 57cf50acbf5b153f331a966ecc08836324c1cd8d (diff) |
serial: omap: Make context_loss_cnt signed
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>
Diffstat (limited to 'drivers/tty/serial/omap-serial.c')
-rw-r--r-- | drivers/tty/serial/omap-serial.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 6ede6fd92b4c..fd0fb8cf7cb9 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
@@ -96,7 +96,7 @@ struct uart_omap_port { | |||
96 | unsigned char msr_saved_flags; | 96 | unsigned char msr_saved_flags; |
97 | char name[20]; | 97 | char name[20]; |
98 | unsigned long port_activity; | 98 | unsigned long port_activity; |
99 | u32 context_loss_cnt; | 99 | int context_loss_cnt; |
100 | u32 errata; | 100 | u32 errata; |
101 | u8 wakeups_enabled; | 101 | u8 wakeups_enabled; |
102 | unsigned int irq_pending:1; | 102 | unsigned int irq_pending:1; |
@@ -1556,11 +1556,15 @@ static int serial_omap_runtime_resume(struct device *dev) | |||
1556 | { | 1556 | { |
1557 | struct uart_omap_port *up = dev_get_drvdata(dev); | 1557 | struct uart_omap_port *up = dev_get_drvdata(dev); |
1558 | 1558 | ||
1559 | u32 loss_cnt = serial_omap_get_context_loss_count(up); | 1559 | int loss_cnt = serial_omap_get_context_loss_count(up); |
1560 | 1560 | ||
1561 | if (up->context_loss_cnt != loss_cnt) | 1561 | if (loss_cnt < 0) { |
1562 | dev_err(dev, "serial_omap_get_context_loss_count failed : %d\n", | ||
1563 | loss_cnt); | ||
1562 | serial_omap_restore_context(up); | 1564 | serial_omap_restore_context(up); |
1563 | 1565 | } else if (up->context_loss_cnt != loss_cnt) { | |
1566 | serial_omap_restore_context(up); | ||
1567 | } | ||
1564 | up->latency = up->calc_latency; | 1568 | up->latency = up->calc_latency; |
1565 | schedule_work(&up->qos_work); | 1569 | schedule_work(&up->qos_work); |
1566 | 1570 | ||