All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shubhrajyoti D <shubhrajyoti@ti.com>
To: linux-serial@vger.kernel.org
Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Shubhrajyoti D <shubhrajyoti@ti.com>,
	"Govindraj.R" <govindraj.raja@ti.com>
Subject: [PATCH 1/7] ARM: OMAP: UART: Make context_loss_cnt signed
Date: Mon, 16 Apr 2012 20:36:55 +0530	[thread overview]
Message-ID: <1334588821-5224-2-git-send-email-shubhrajyoti@ti.com> (raw)
In-Reply-To: <1334588821-5224-1-git-send-email-shubhrajyoti@ti.com>

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(which may be negative)
the value 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.

Cc: Govindraj.R <govindraj.raja@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 arch/arm/plat-omap/include/plat/omap-serial.h |    2 +-
 drivers/tty/serial/omap-serial.c              |   10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 9ff4444..b7fb6dc 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -128,7 +128,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;
 
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index d00b38e..fe099bb 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1612,10 +1612,16 @@ static int serial_omap_runtime_resume(struct device *dev)
 
 	if (up && pdata) {
 		if (pdata->get_context_loss_count) {
-			u32 loss_cnt = pdata->get_context_loss_count(dev);
+			int loss_cnt = pdata->get_context_loss_count(dev);
 
-			if (up->context_loss_cnt != loss_cnt)
+			if (loss_cnt < 0) {
+				dev_err(dev,
+					"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);
+			}
 		}
 
 		/* Errata i291 */
-- 
1.7.4.1


WARNING: multiple messages have this Message-ID (diff)
From: shubhrajyoti@ti.com (Shubhrajyoti D)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/7] ARM: OMAP: UART: Make context_loss_cnt signed
Date: Mon, 16 Apr 2012 20:36:55 +0530	[thread overview]
Message-ID: <1334588821-5224-2-git-send-email-shubhrajyoti@ti.com> (raw)
In-Reply-To: <1334588821-5224-1-git-send-email-shubhrajyoti@ti.com>

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(which may be negative)
the value 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.

Cc: Govindraj.R <govindraj.raja@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 arch/arm/plat-omap/include/plat/omap-serial.h |    2 +-
 drivers/tty/serial/omap-serial.c              |   10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 9ff4444..b7fb6dc 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -128,7 +128,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;
 
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index d00b38e..fe099bb 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1612,10 +1612,16 @@ static int serial_omap_runtime_resume(struct device *dev)
 
 	if (up && pdata) {
 		if (pdata->get_context_loss_count) {
-			u32 loss_cnt = pdata->get_context_loss_count(dev);
+			int loss_cnt = pdata->get_context_loss_count(dev);
 
-			if (up->context_loss_cnt != loss_cnt)
+			if (loss_cnt < 0) {
+				dev_err(dev,
+					"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);
+			}
 		}
 
 		/* Errata i291 */
-- 
1.7.4.1

  reply	other threads:[~2012-04-16 15:07 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-16 15:06 [PATCH 0/7] UART: OMAP: Updates Shubhrajyoti D
2012-04-16 15:06 ` Shubhrajyoti D
2012-04-16 15:06 ` Shubhrajyoti D [this message]
2012-04-16 15:06   ` [PATCH 1/7] ARM: OMAP: UART: Make context_loss_cnt signed Shubhrajyoti D
2012-04-16 15:06 ` [PATCH 2/7] UART: OMAP: Cut the clock in the error cases Shubhrajyoti D
2012-04-16 15:06   ` Shubhrajyoti D
2012-04-18  0:06   ` Kevin Hilman
2012-04-18  0:06     ` Kevin Hilman
2012-04-18  6:44     ` Shubhrajyoti
2012-04-18  6:44       ` Shubhrajyoti
2012-04-18 14:00       ` Kevin Hilman
2012-04-18 14:00         ` Kevin Hilman
2012-04-18 15:13         ` Shubhrajyoti
2012-04-18 15:13           ` Shubhrajyoti
2012-04-20 13:20           ` Shubhrajyoti Datta
2012-04-20 13:20             ` Shubhrajyoti Datta
2012-04-20 13:46             ` Kevin Hilman
2012-04-20 13:46               ` Kevin Hilman
2012-04-16 15:06 ` [PATCH 3/7] UART: OMAP: fix software flow control Shubhrajyoti D
2012-04-16 15:06   ` Shubhrajyoti D
2012-04-16 15:06 ` [PATCH 4/7] UART: OMAP: Remove the default setting of special character Shubhrajyoti D
2012-04-16 15:06   ` Shubhrajyoti D
2012-04-16 15:06 ` [PATCH 5/7] UART: OMAP: Prevent cutting of clocks if put_sync immediately follows Shubhrajyoti D
2012-04-16 15:06   ` Shubhrajyoti D
2012-04-16 15:07 ` [PATCH 6/7] UART: OMAP: Remove the hardcode serial_omap_console_ports array Shubhrajyoti D
2012-04-16 15:07   ` Shubhrajyoti D
2012-04-16 15:07 ` [PATCH 7/7] UART: OMAP: Trivial optimisation of the probe and remove Shubhrajyoti D
2012-04-16 15:07   ` Shubhrajyoti D

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1334588821-5224-2-git-send-email-shubhrajyoti@ti.com \
    --to=shubhrajyoti@ti.com \
    --cc=govindraj.raja@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.