All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] uart updates
@ 2012-01-16 10:22 ` Shubhrajyoti D
  0 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti D @ 2012-01-16 10:22 UTC (permalink / raw)
  To: linux-serial; +Cc: linux-omap, linux-arm-kernel, Shubhrajyoti D

The patch series does the following

- Make the Make the suspend/resume functions depend on
    CONFIG_PM_SLEEP
- Fix the serial omap probe's error handling 
- Make he context_loss_cnt signed so that error handling is 
 possible.


Shubhrajyoti D (5):
  omap-serial :Make the suspend/resume functions depend on
    CONFIG_PM_SLEEP.
  omap-serial: make serial_omap_restore_context depend on
    CONFIG_PM_RUNTIME
  omap-serial: Fix the error handling in the omap_serial probe
  ARM : OMAP : serial : Make context_loss_cnt signed
  OMAP : serial : Check for error in get_context_loss_count

 arch/arm/plat-omap/include/plat/omap-serial.h |    2 +-
 drivers/tty/serial/omap-serial.c              |   41 ++++++++++++++++--------
 2 files changed, 28 insertions(+), 15 deletions(-)


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 0/5] uart updates
@ 2012-01-16 10:22 ` Shubhrajyoti D
  0 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti D @ 2012-01-16 10:22 UTC (permalink / raw)
  To: linux-arm-kernel

The patch series does the following

- Make the Make the suspend/resume functions depend on
    CONFIG_PM_SLEEP
- Fix the serial omap probe's error handling 
- Make he context_loss_cnt signed so that error handling is 
 possible.


Shubhrajyoti D (5):
  omap-serial :Make the suspend/resume functions depend on
    CONFIG_PM_SLEEP.
  omap-serial: make serial_omap_restore_context depend on
    CONFIG_PM_RUNTIME
  omap-serial: Fix the error handling in the omap_serial probe
  ARM : OMAP : serial : Make context_loss_cnt signed
  OMAP : serial : Check for error in get_context_loss_count

 arch/arm/plat-omap/include/plat/omap-serial.h |    2 +-
 drivers/tty/serial/omap-serial.c              |   41 ++++++++++++++++--------
 2 files changed, 28 insertions(+), 15 deletions(-)

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 1/5] omap-serial :Make the suspend/resume functions depend on CONFIG_PM_SLEEP.
  2012-01-16 10:22 ` Shubhrajyoti D
@ 2012-01-16 10:22   ` Shubhrajyoti D
  -1 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti D @ 2012-01-16 10:22 UTC (permalink / raw)
  To: linux-serial; +Cc: linux-omap, linux-arm-kernel, Shubhrajyoti D

    The macro SET_SYSTEM_SLEEP_PM_OPS  depends CONFIG_PM_SLEEP. The patch
    defines the suspend and resume functions for CONFIG_PM_SLEEP instead of
    CONFIG_SUSPEND.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 drivers/tty/serial/omap-serial.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index d192dcb..33e3360 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1160,7 +1160,7 @@ static struct uart_driver serial_omap_reg = {
 	.cons		= OMAP_CONSOLE,
 };
 
-#ifdef CONFIG_SUSPEND
+#ifdef CONFIG_PM_SLEEP
 static int serial_omap_suspend(struct device *dev)
 {
 	struct uart_omap_port *up = dev_get_drvdata(dev);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 1/5] omap-serial :Make the suspend/resume functions depend on CONFIG_PM_SLEEP.
@ 2012-01-16 10:22   ` Shubhrajyoti D
  0 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti D @ 2012-01-16 10:22 UTC (permalink / raw)
  To: linux-arm-kernel

    The macro SET_SYSTEM_SLEEP_PM_OPS  depends CONFIG_PM_SLEEP. The patch
    defines the suspend and resume functions for CONFIG_PM_SLEEP instead of
    CONFIG_SUSPEND.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 drivers/tty/serial/omap-serial.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index d192dcb..33e3360 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1160,7 +1160,7 @@ static struct uart_driver serial_omap_reg = {
 	.cons		= OMAP_CONSOLE,
 };
 
-#ifdef CONFIG_SUSPEND
+#ifdef CONFIG_PM_SLEEP
 static int serial_omap_suspend(struct device *dev)
 {
 	struct uart_omap_port *up = dev_get_drvdata(dev);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 2/5] omap-serial: make serial_omap_restore_context depend on CONFIG_PM_RUNTIME
  2012-01-16 10:22 ` Shubhrajyoti D
@ 2012-01-16 10:22   ` Shubhrajyoti D
  -1 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti D @ 2012-01-16 10:22 UTC (permalink / raw)
  To: linux-serial; +Cc: linux-omap, linux-arm-kernel, Shubhrajyoti D

The function serial_omap_restore_context is called only from
serial_omap_runtime_resume which depends on CONFIG_PM_RUNTIME. Make
serial_omap_restore_context also compile conditionally.

if CONFIG_PM_RUNTIME is not defined below warn may be seen.

  LD      net/xfrm/built-in.o
drivers/tty/serial/omap-serial.c:1524: warning: 'serial_omap_restore_context' defined but not used
  CC      drivers/tty/vt/selection.o

Acked-by: Govindraj.R <govindraj.raja@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 drivers/tty/serial/omap-serial.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 33e3360..1c24269 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1521,6 +1521,7 @@ static void serial_omap_mdr1_errataset(struct uart_omap_port *up, u8 mdr1)
 	}
 }
 
+#ifdef CONFIG_PM_RUNTIME
 static void serial_omap_restore_context(struct uart_omap_port *up)
 {
 	if (up->errata & UART_ERRATA_i202_MDR1_ACCESS)
@@ -1550,7 +1551,6 @@ static void serial_omap_restore_context(struct uart_omap_port *up)
 		serial_out(up, UART_OMAP_MDR1, up->mdr1);
 }
 
-#ifdef CONFIG_PM_RUNTIME
 static int serial_omap_runtime_suspend(struct device *dev)
 {
 	struct uart_omap_port *up = dev_get_drvdata(dev);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 2/5] omap-serial: make serial_omap_restore_context depend on CONFIG_PM_RUNTIME
@ 2012-01-16 10:22   ` Shubhrajyoti D
  0 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti D @ 2012-01-16 10:22 UTC (permalink / raw)
  To: linux-arm-kernel

The function serial_omap_restore_context is called only from
serial_omap_runtime_resume which depends on CONFIG_PM_RUNTIME. Make
serial_omap_restore_context also compile conditionally.

if CONFIG_PM_RUNTIME is not defined below warn may be seen.

  LD      net/xfrm/built-in.o
drivers/tty/serial/omap-serial.c:1524: warning: 'serial_omap_restore_context' defined but not used
  CC      drivers/tty/vt/selection.o

Acked-by: Govindraj.R <govindraj.raja@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 drivers/tty/serial/omap-serial.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 33e3360..1c24269 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1521,6 +1521,7 @@ static void serial_omap_mdr1_errataset(struct uart_omap_port *up, u8 mdr1)
 	}
 }
 
+#ifdef CONFIG_PM_RUNTIME
 static void serial_omap_restore_context(struct uart_omap_port *up)
 {
 	if (up->errata & UART_ERRATA_i202_MDR1_ACCESS)
@@ -1550,7 +1551,6 @@ static void serial_omap_restore_context(struct uart_omap_port *up)
 		serial_out(up, UART_OMAP_MDR1, up->mdr1);
 }
 
-#ifdef CONFIG_PM_RUNTIME
 static int serial_omap_runtime_suspend(struct device *dev)
 {
 	struct uart_omap_port *up = dev_get_drvdata(dev);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 3/5] omap-serial: Fix the error handling in the omap_serial probe
  2012-01-16 10:22 ` Shubhrajyoti D
@ 2012-01-16 10:22   ` Shubhrajyoti D
  -1 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti D @ 2012-01-16 10:22 UTC (permalink / raw)
  To: linux-serial; +Cc: linux-omap, linux-arm-kernel, Shubhrajyoti D

The patch does the following

- The pm_runtime_disable is called in the remove not in the error
  case of probe.The patch calls the pm_runtime_disable in the error
  case.
- The  up is not freed in the error path. Fix the memory leak by calling
 kfree in the error path.
- Also the iounmap is not called fix the same by calling iounmap in the
  error case of probe and remove .
- Make the name of the error tags more meaningful.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 drivers/tty/serial/omap-serial.c |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 1c24269..8c6f137 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1369,14 +1369,14 @@ static int serial_omap_probe(struct platform_device *pdev)
 
 	dma_rx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
 	if (!dma_rx) {
-		ret = -EINVAL;
-		goto err;
+		ret = -ENXIO;
+		goto do_release_region;
 	}
 
 	dma_tx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
 	if (!dma_tx) {
-		ret = -EINVAL;
-		goto err;
+		ret = -ENXIO;
+		goto do_release_region;
 	}
 
 	up = kzalloc(sizeof(*up), GFP_KERNEL);
@@ -1403,7 +1403,7 @@ static int serial_omap_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n",
 								up->port.line);
 		ret = -ENODEV;
-		goto err;
+		goto err_port_line;
 	}
 
 	sprintf(up->name, "OMAP UART%d", up->port.line);
@@ -1412,7 +1412,7 @@ static int serial_omap_probe(struct platform_device *pdev)
 	if (!up->port.membase) {
 		dev_err(&pdev->dev, "can't ioremap UART\n");
 		ret = -ENOMEM;
-		goto err;
+		goto err_ioremap;
 	}
 
 	up->port.flags = omap_up_info->flags;
@@ -1458,16 +1458,22 @@ static int serial_omap_probe(struct platform_device *pdev)
 
 	ret = uart_add_one_port(&serial_omap_reg, &up->port);
 	if (ret != 0)
-		goto do_release_region;
+		goto err_add_port;
 
 	pm_runtime_put(&pdev->dev);
 	platform_set_drvdata(pdev, up);
 	return 0;
-err:
-	dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
-				pdev->id, __func__, ret);
+
+err_add_port:
+	pm_runtime_disable(&pdev->dev);
+	iounmap(up->port.membase);
+err_ioremap:
+err_port_line:
+	kfree(up);
 do_release_region:
 	release_mem_region(mem->start, resource_size(mem));
+	dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
+				pdev->id, __func__, ret);
 	return ret;
 }
 
@@ -1476,6 +1482,7 @@ static int serial_omap_remove(struct platform_device *dev)
 	struct uart_omap_port *up = platform_get_drvdata(dev);
 
 	if (up) {
+		iounmap(up->port.membase);
 		pm_runtime_disable(&up->pdev->dev);
 		uart_remove_one_port(&serial_omap_reg, &up->port);
 		pm_qos_remove_request(&up->pm_qos_request);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 3/5] omap-serial: Fix the error handling in the omap_serial probe
@ 2012-01-16 10:22   ` Shubhrajyoti D
  0 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti D @ 2012-01-16 10:22 UTC (permalink / raw)
  To: linux-arm-kernel

The patch does the following

- The pm_runtime_disable is called in the remove not in the error
  case of probe.The patch calls the pm_runtime_disable in the error
  case.
- The  up is not freed in the error path. Fix the memory leak by calling
 kfree in the error path.
- Also the iounmap is not called fix the same by calling iounmap in the
  error case of probe and remove .
- Make the name of the error tags more meaningful.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 drivers/tty/serial/omap-serial.c |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 1c24269..8c6f137 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1369,14 +1369,14 @@ static int serial_omap_probe(struct platform_device *pdev)
 
 	dma_rx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
 	if (!dma_rx) {
-		ret = -EINVAL;
-		goto err;
+		ret = -ENXIO;
+		goto do_release_region;
 	}
 
 	dma_tx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
 	if (!dma_tx) {
-		ret = -EINVAL;
-		goto err;
+		ret = -ENXIO;
+		goto do_release_region;
 	}
 
 	up = kzalloc(sizeof(*up), GFP_KERNEL);
@@ -1403,7 +1403,7 @@ static int serial_omap_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n",
 								up->port.line);
 		ret = -ENODEV;
-		goto err;
+		goto err_port_line;
 	}
 
 	sprintf(up->name, "OMAP UART%d", up->port.line);
@@ -1412,7 +1412,7 @@ static int serial_omap_probe(struct platform_device *pdev)
 	if (!up->port.membase) {
 		dev_err(&pdev->dev, "can't ioremap UART\n");
 		ret = -ENOMEM;
-		goto err;
+		goto err_ioremap;
 	}
 
 	up->port.flags = omap_up_info->flags;
@@ -1458,16 +1458,22 @@ static int serial_omap_probe(struct platform_device *pdev)
 
 	ret = uart_add_one_port(&serial_omap_reg, &up->port);
 	if (ret != 0)
-		goto do_release_region;
+		goto err_add_port;
 
 	pm_runtime_put(&pdev->dev);
 	platform_set_drvdata(pdev, up);
 	return 0;
-err:
-	dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
-				pdev->id, __func__, ret);
+
+err_add_port:
+	pm_runtime_disable(&pdev->dev);
+	iounmap(up->port.membase);
+err_ioremap:
+err_port_line:
+	kfree(up);
 do_release_region:
 	release_mem_region(mem->start, resource_size(mem));
+	dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
+				pdev->id, __func__, ret);
 	return ret;
 }
 
@@ -1476,6 +1482,7 @@ static int serial_omap_remove(struct platform_device *dev)
 	struct uart_omap_port *up = platform_get_drvdata(dev);
 
 	if (up) {
+		iounmap(up->port.membase);
 		pm_runtime_disable(&up->pdev->dev);
 		uart_remove_one_port(&serial_omap_reg, &up->port);
 		pm_qos_remove_request(&up->pm_qos_request);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 4/5] ARM : OMAP : serial : Make context_loss_cnt signed
  2012-01-16 10:22 ` Shubhrajyoti D
@ 2012-01-16 10:22   ` Shubhrajyoti D
  -1 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti D @ 2012-01-16 10:22 UTC (permalink / raw)
  To: linux-serial; +Cc: linux-omap, linux-arm-kernel, Shubhrajyoti D

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.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 arch/arm/plat-omap/include/plat/omap-serial.h |    2 +-
 1 files changed, 1 insertions(+), 1 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;
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 4/5] ARM : OMAP : serial : Make context_loss_cnt signed
@ 2012-01-16 10:22   ` Shubhrajyoti D
  0 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti D @ 2012-01-16 10:22 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 arch/arm/plat-omap/include/plat/omap-serial.h |    2 +-
 1 files changed, 1 insertions(+), 1 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;
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 5/5] OMAP : serial : Check for error in get_context_loss_count
  2012-01-16 10:22 ` Shubhrajyoti D
@ 2012-01-16 10:22   ` Shubhrajyoti D
  -1 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti D @ 2012-01-16 10:22 UTC (permalink / raw)
  To: linux-serial; +Cc: linux-omap, linux-arm-kernel, Shubhrajyoti D

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>
---
 drivers/tty/serial/omap-serial.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 8c6f137..e1c1a0f 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1602,10 +1602,16 @@ static int serial_omap_runtime_resume(struct device *dev)
 
 	if (up) {
 		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.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 5/5] OMAP : serial : Check for error in get_context_loss_count
@ 2012-01-16 10:22   ` Shubhrajyoti D
  0 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti D @ 2012-01-16 10:22 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---
 drivers/tty/serial/omap-serial.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 8c6f137..e1c1a0f 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1602,10 +1602,16 @@ static int serial_omap_runtime_resume(struct device *dev)
 
 	if (up) {
 		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.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 0/5] uart updates
  2012-01-16 10:22 ` Shubhrajyoti D
@ 2012-01-20  8:45   ` Govindraj
  -1 siblings, 0 replies; 24+ messages in thread
From: Govindraj @ 2012-01-20  8:45 UTC (permalink / raw)
  To: Shubhrajyoti D; +Cc: linux-serial, linux-omap, linux-arm-kernel

On Mon, Jan 16, 2012 at 3:52 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> The patch series does the following
>
> - Make the Make the suspend/resume functions depend on
>    CONFIG_PM_SLEEP
> - Fix the serial omap probe's error handling
> - Make he context_loss_cnt signed so that error handling is
>  possible.
>
>

After fixing Kevin's comment's,

If can add some testing updates it be nice.

like :
boot tested or any other tests done on xxx boards.

--
Thanks,
Govindraj.R



> Shubhrajyoti D (5):
>  omap-serial :Make the suspend/resume functions depend on
>    CONFIG_PM_SLEEP.
>  omap-serial: make serial_omap_restore_context depend on
>    CONFIG_PM_RUNTIME
>  omap-serial: Fix the error handling in the omap_serial probe
>  ARM : OMAP : serial : Make context_loss_cnt signed
>  OMAP : serial : Check for error in get_context_loss_count
>
>  arch/arm/plat-omap/include/plat/omap-serial.h |    2 +-
>  drivers/tty/serial/omap-serial.c              |   41 ++++++++++++++++--------
>  2 files changed, 28 insertions(+), 15 deletions(-)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-serial" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 0/5] uart updates
@ 2012-01-20  8:45   ` Govindraj
  0 siblings, 0 replies; 24+ messages in thread
From: Govindraj @ 2012-01-20  8:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 16, 2012 at 3:52 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> The patch series does the following
>
> - Make the Make the suspend/resume functions depend on
> ? ?CONFIG_PM_SLEEP
> - Fix the serial omap probe's error handling
> - Make he context_loss_cnt signed so that error handling is
> ?possible.
>
>

After fixing Kevin's comment's,

If can add some testing updates it be nice.

like :
boot tested or any other tests done on xxx boards.

--
Thanks,
Govindraj.R



> Shubhrajyoti D (5):
> ?omap-serial :Make the suspend/resume functions depend on
> ? ?CONFIG_PM_SLEEP.
> ?omap-serial: make serial_omap_restore_context depend on
> ? ?CONFIG_PM_RUNTIME
> ?omap-serial: Fix the error handling in the omap_serial probe
> ?ARM : OMAP : serial : Make context_loss_cnt signed
> ?OMAP : serial : Check for error in get_context_loss_count
>
> ?arch/arm/plat-omap/include/plat/omap-serial.h | ? ?2 +-
> ?drivers/tty/serial/omap-serial.c ? ? ? ? ? ? ?| ? 41 ++++++++++++++++--------
> ?2 files changed, 28 insertions(+), 15 deletions(-)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-serial" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/5] omap-serial: Fix the error handling in the omap_serial probe
  2012-01-16 10:22   ` Shubhrajyoti D
@ 2012-01-20  8:49     ` Govindraj
  -1 siblings, 0 replies; 24+ messages in thread
From: Govindraj @ 2012-01-20  8:49 UTC (permalink / raw)
  To: Shubhrajyoti D; +Cc: linux-serial, linux-omap, linux-arm-kernel

On Mon, Jan 16, 2012 at 3:52 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> The patch does the following
>
> - The pm_runtime_disable is called in the remove not in the error
>  case of probe.The patch calls the pm_runtime_disable in the error
>  case.
> - The  up is not freed in the error path. Fix the memory leak by calling
>  kfree in the error path.
> - Also the iounmap is not called fix the same by calling iounmap in the
>  error case of probe and remove .
> - Make the name of the error tags more meaningful.
>
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
> ---
>  drivers/tty/serial/omap-serial.c |   27 +++++++++++++++++----------
>  1 files changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
> index 1c24269..8c6f137 100644
> --- a/drivers/tty/serial/omap-serial.c
> +++ b/drivers/tty/serial/omap-serial.c
> @@ -1369,14 +1369,14 @@ static int serial_omap_probe(struct platform_device *pdev)
>
>        dma_rx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
>        if (!dma_rx) {
> -               ret = -EINVAL;
> -               goto err;
> +               ret = -ENXIO;
> +               goto do_release_region;
>        }
>
>        dma_tx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
>        if (!dma_tx) {
> -               ret = -EINVAL;
> -               goto err;
> +               ret = -ENXIO;
> +               goto do_release_region;
>        }
>
>        up = kzalloc(sizeof(*up), GFP_KERNEL);
> @@ -1403,7 +1403,7 @@ static int serial_omap_probe(struct platform_device *pdev)
>                dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n",
>                                                                up->port.line);
>                ret = -ENODEV;
> -               goto err;
> +               goto err_port_line;
>        }
>
>        sprintf(up->name, "OMAP UART%d", up->port.line);
> @@ -1412,7 +1412,7 @@ static int serial_omap_probe(struct platform_device *pdev)
>        if (!up->port.membase) {
>                dev_err(&pdev->dev, "can't ioremap UART\n");
>                ret = -ENOMEM;
> -               goto err;
> +               goto err_ioremap;
>        }
>
>        up->port.flags = omap_up_info->flags;
> @@ -1458,16 +1458,22 @@ static int serial_omap_probe(struct platform_device *pdev)
>
>        ret = uart_add_one_port(&serial_omap_reg, &up->port);
>        if (ret != 0)
> -               goto do_release_region;
> +               goto err_add_port;
>
>        pm_runtime_put(&pdev->dev);
>        platform_set_drvdata(pdev, up);
>        return 0;
> -err:
> -       dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
> -                               pdev->id, __func__, ret);
> +
> +err_add_port:
> +       pm_runtime_disable(&pdev->dev);
> +       iounmap(up->port.membase);
> +err_ioremap:
> +err_port_line:
> +       kfree(up);
>  do_release_region:
>        release_mem_region(mem->start, resource_size(mem));
> +       dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
> +                               pdev->id, __func__, ret);
>        return ret;
>  }
>
> @@ -1476,6 +1482,7 @@ static int serial_omap_remove(struct platform_device *dev)
>        struct uart_omap_port *up = platform_get_drvdata(dev);
>
>        if (up) {
> +               iounmap(up->port.membase);

you can build omap-serial as module insmod and rmmod
the module and test this patch.

This can be done on zoom board which uses a non-omap uart
as console.

--
Thanks,
Govindraj.R
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 3/5] omap-serial: Fix the error handling in the omap_serial probe
@ 2012-01-20  8:49     ` Govindraj
  0 siblings, 0 replies; 24+ messages in thread
From: Govindraj @ 2012-01-20  8:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 16, 2012 at 3:52 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> The patch does the following
>
> - The pm_runtime_disable is called in the remove not in the error
> ?case of probe.The patch calls the pm_runtime_disable in the error
> ?case.
> - The ?up is not freed in the error path. Fix the memory leak by calling
> ?kfree in the error path.
> - Also the iounmap is not called fix the same by calling iounmap in the
> ?error case of probe and remove .
> - Make the name of the error tags more meaningful.
>
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
> ---
> ?drivers/tty/serial/omap-serial.c | ? 27 +++++++++++++++++----------
> ?1 files changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
> index 1c24269..8c6f137 100644
> --- a/drivers/tty/serial/omap-serial.c
> +++ b/drivers/tty/serial/omap-serial.c
> @@ -1369,14 +1369,14 @@ static int serial_omap_probe(struct platform_device *pdev)
>
> ? ? ? ?dma_rx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
> ? ? ? ?if (!dma_rx) {
> - ? ? ? ? ? ? ? ret = -EINVAL;
> - ? ? ? ? ? ? ? goto err;
> + ? ? ? ? ? ? ? ret = -ENXIO;
> + ? ? ? ? ? ? ? goto do_release_region;
> ? ? ? ?}
>
> ? ? ? ?dma_tx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
> ? ? ? ?if (!dma_tx) {
> - ? ? ? ? ? ? ? ret = -EINVAL;
> - ? ? ? ? ? ? ? goto err;
> + ? ? ? ? ? ? ? ret = -ENXIO;
> + ? ? ? ? ? ? ? goto do_release_region;
> ? ? ? ?}
>
> ? ? ? ?up = kzalloc(sizeof(*up), GFP_KERNEL);
> @@ -1403,7 +1403,7 @@ static int serial_omap_probe(struct platform_device *pdev)
> ? ? ? ? ? ? ? ?dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n",
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?up->port.line);
> ? ? ? ? ? ? ? ?ret = -ENODEV;
> - ? ? ? ? ? ? ? goto err;
> + ? ? ? ? ? ? ? goto err_port_line;
> ? ? ? ?}
>
> ? ? ? ?sprintf(up->name, "OMAP UART%d", up->port.line);
> @@ -1412,7 +1412,7 @@ static int serial_omap_probe(struct platform_device *pdev)
> ? ? ? ?if (!up->port.membase) {
> ? ? ? ? ? ? ? ?dev_err(&pdev->dev, "can't ioremap UART\n");
> ? ? ? ? ? ? ? ?ret = -ENOMEM;
> - ? ? ? ? ? ? ? goto err;
> + ? ? ? ? ? ? ? goto err_ioremap;
> ? ? ? ?}
>
> ? ? ? ?up->port.flags = omap_up_info->flags;
> @@ -1458,16 +1458,22 @@ static int serial_omap_probe(struct platform_device *pdev)
>
> ? ? ? ?ret = uart_add_one_port(&serial_omap_reg, &up->port);
> ? ? ? ?if (ret != 0)
> - ? ? ? ? ? ? ? goto do_release_region;
> + ? ? ? ? ? ? ? goto err_add_port;
>
> ? ? ? ?pm_runtime_put(&pdev->dev);
> ? ? ? ?platform_set_drvdata(pdev, up);
> ? ? ? ?return 0;
> -err:
> - ? ? ? dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pdev->id, __func__, ret);
> +
> +err_add_port:
> + ? ? ? pm_runtime_disable(&pdev->dev);
> + ? ? ? iounmap(up->port.membase);
> +err_ioremap:
> +err_port_line:
> + ? ? ? kfree(up);
> ?do_release_region:
> ? ? ? ?release_mem_region(mem->start, resource_size(mem));
> + ? ? ? dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pdev->id, __func__, ret);
> ? ? ? ?return ret;
> ?}
>
> @@ -1476,6 +1482,7 @@ static int serial_omap_remove(struct platform_device *dev)
> ? ? ? ?struct uart_omap_port *up = platform_get_drvdata(dev);
>
> ? ? ? ?if (up) {
> + ? ? ? ? ? ? ? iounmap(up->port.membase);

you can build omap-serial as module insmod and rmmod
the module and test this patch.

This can be done on zoom board which uses a non-omap uart
as console.

--
Thanks,
Govindraj.R

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] OMAP : serial : Check for error in get_context_loss_count
  2012-01-16 10:22   ` Shubhrajyoti D
@ 2012-01-20  8:51     ` Govindraj
  -1 siblings, 0 replies; 24+ messages in thread
From: Govindraj @ 2012-01-20  8:51 UTC (permalink / raw)
  To: Shubhrajyoti D; +Cc: linux-serial, linux-omap, linux-arm-kernel

On Mon, Jan 16, 2012 at 3:52 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> 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>
> ---
>  drivers/tty/serial/omap-serial.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
> index 8c6f137..e1c1a0f 100644
> --- a/drivers/tty/serial/omap-serial.c
> +++ b/drivers/tty/serial/omap-serial.c
> @@ -1602,10 +1602,16 @@ static int serial_omap_runtime_resume(struct device *dev)
>
>        if (up) {
>                if (pdata->get_context_loss_count) {
> -                       u32 loss_cnt = pdata->get_context_loss_count(dev);
> +                       int loss_cnt = pdata->get_context_loss_count(dev);


Looks ok to me,
Can you ensure off mode is tested with this patch.

--
Thanks,
Govindraj.R
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 5/5] OMAP : serial : Check for error in get_context_loss_count
@ 2012-01-20  8:51     ` Govindraj
  0 siblings, 0 replies; 24+ messages in thread
From: Govindraj @ 2012-01-20  8:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 16, 2012 at 3:52 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> 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>
> ---
> ?drivers/tty/serial/omap-serial.c | ? 10 ++++++++--
> ?1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
> index 8c6f137..e1c1a0f 100644
> --- a/drivers/tty/serial/omap-serial.c
> +++ b/drivers/tty/serial/omap-serial.c
> @@ -1602,10 +1602,16 @@ static int serial_omap_runtime_resume(struct device *dev)
>
> ? ? ? ?if (up) {
> ? ? ? ? ? ? ? ?if (pdata->get_context_loss_count) {
> - ? ? ? ? ? ? ? ? ? ? ? u32 loss_cnt = pdata->get_context_loss_count(dev);
> + ? ? ? ? ? ? ? ? ? ? ? int loss_cnt = pdata->get_context_loss_count(dev);


Looks ok to me,
Can you ensure off mode is tested with this patch.

--
Thanks,
Govindraj.R

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 4/5] ARM : OMAP : serial : Make context_loss_cnt signed
  2012-01-16 10:22   ` Shubhrajyoti D
@ 2012-01-20  8:52     ` Govindraj
  -1 siblings, 0 replies; 24+ messages in thread
From: Govindraj @ 2012-01-20  8:52 UTC (permalink / raw)
  To: Shubhrajyoti D; +Cc: linux-serial, linux-omap, linux-arm-kernel

On Mon, Jan 16, 2012 at 3:52 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> 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.
>

This change should be part [1] patch of itself

[1]:

[PATCH 5/5] OMAP : serial : Check for error in get_context_loss_count

--
Thanks,
Govindraj.R


> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
> ---
>  arch/arm/plat-omap/include/plat/omap-serial.h |    2 +-
>  1 files changed, 1 insertions(+), 1 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;
>
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-serial" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 4/5] ARM : OMAP : serial : Make context_loss_cnt signed
@ 2012-01-20  8:52     ` Govindraj
  0 siblings, 0 replies; 24+ messages in thread
From: Govindraj @ 2012-01-20  8:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 16, 2012 at 3:52 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> 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.
>

This change should be part [1] patch of itself

[1]:

[PATCH 5/5] OMAP : serial : Check for error in get_context_loss_count

--
Thanks,
Govindraj.R


> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
> ---
> ?arch/arm/plat-omap/include/plat/omap-serial.h | ? ?2 +-
> ?1 files changed, 1 insertions(+), 1 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;
>
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-serial" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/5] omap-serial: Fix the error handling in the omap_serial probe
  2012-01-20  8:49     ` Govindraj
@ 2012-01-20  9:35       ` Shubhrajyoti
  -1 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti @ 2012-01-20  9:35 UTC (permalink / raw)
  To: Govindraj; +Cc: linux-serial, linux-omap, linux-arm-kernel

On Friday 20 January 2012 02:19 PM, Govindraj wrote:
> On Mon, Jan 16, 2012 at 3:52 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
>> The patch does the following
>>
>> - The pm_runtime_disable is called in the remove not in the error
>>  case of probe.The patch calls the pm_runtime_disable in the error
>>  case.
>> - The  up is not freed in the error path. Fix the memory leak by calling
>>  kfree in the error path.
>> - Also the iounmap is not called fix the same by calling iounmap in the
>>  error case of probe and remove .
>> - Make the name of the error tags more meaningful.
>>
>> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
>> ---
>>  drivers/tty/serial/omap-serial.c |   27 +++++++++++++++++----------
>>  1 files changed, 17 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
>> index 1c24269..8c6f137 100644
>> --- a/drivers/tty/serial/omap-serial.c
>> +++ b/drivers/tty/serial/omap-serial.c
>> @@ -1369,14 +1369,14 @@ static int serial_omap_probe(struct platform_device *pdev)
>>
>>        dma_rx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
>>        if (!dma_rx) {
>> -               ret = -EINVAL;
>> -               goto err;
>> +               ret = -ENXIO;
>> +               goto do_release_region;
>>        }
>>
>>        dma_tx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
>>        if (!dma_tx) {
>> -               ret = -EINVAL;
>> -               goto err;
>> +               ret = -ENXIO;
>> +               goto do_release_region;
>>        }
>>
>>        up = kzalloc(sizeof(*up), GFP_KERNEL);
>> @@ -1403,7 +1403,7 @@ static int serial_omap_probe(struct platform_device *pdev)
>>                dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n",
>>                                                                up->port.line);
>>                ret = -ENODEV;
>> -               goto err;
>> +               goto err_port_line;
>>        }
>>
>>        sprintf(up->name, "OMAP UART%d", up->port.line);
>> @@ -1412,7 +1412,7 @@ static int serial_omap_probe(struct platform_device *pdev)
>>        if (!up->port.membase) {
>>                dev_err(&pdev->dev, "can't ioremap UART\n");
>>                ret = -ENOMEM;
>> -               goto err;
>> +               goto err_ioremap;
>>        }
>>
>>        up->port.flags = omap_up_info->flags;
>> @@ -1458,16 +1458,22 @@ static int serial_omap_probe(struct platform_device *pdev)
>>
>>        ret = uart_add_one_port(&serial_omap_reg, &up->port);
>>        if (ret != 0)
>> -               goto do_release_region;
>> +               goto err_add_port;
>>
>>        pm_runtime_put(&pdev->dev);
>>        platform_set_drvdata(pdev, up);
>>        return 0;
>> -err:
>> -       dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
>> -                               pdev->id, __func__, ret);
>> +
>> +err_add_port:
>> +       pm_runtime_disable(&pdev->dev);
>> +       iounmap(up->port.membase);
>> +err_ioremap:
>> +err_port_line:
>> +       kfree(up);
>>  do_release_region:
>>        release_mem_region(mem->start, resource_size(mem));
>> +       dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
>> +                               pdev->id, __func__, ret);
>>        return ret;
>>  }
>>
>> @@ -1476,6 +1482,7 @@ static int serial_omap_remove(struct platform_device *dev)
>>        struct uart_omap_port *up = platform_get_drvdata(dev);
>>
>>        if (up) {
>> +               iounmap(up->port.membase);
> you can build omap-serial as module insmod and rmmod
> the module and test this patch.
>
> This can be done on zoom board which uses a non-omap uart
> as console.

Yes will do that and post another version.
> --
> Thanks,
> Govindraj.R


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 3/5] omap-serial: Fix the error handling in the omap_serial probe
@ 2012-01-20  9:35       ` Shubhrajyoti
  0 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti @ 2012-01-20  9:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 20 January 2012 02:19 PM, Govindraj wrote:
> On Mon, Jan 16, 2012 at 3:52 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
>> The patch does the following
>>
>> - The pm_runtime_disable is called in the remove not in the error
>>  case of probe.The patch calls the pm_runtime_disable in the error
>>  case.
>> - The  up is not freed in the error path. Fix the memory leak by calling
>>  kfree in the error path.
>> - Also the iounmap is not called fix the same by calling iounmap in the
>>  error case of probe and remove .
>> - Make the name of the error tags more meaningful.
>>
>> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
>> ---
>>  drivers/tty/serial/omap-serial.c |   27 +++++++++++++++++----------
>>  1 files changed, 17 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
>> index 1c24269..8c6f137 100644
>> --- a/drivers/tty/serial/omap-serial.c
>> +++ b/drivers/tty/serial/omap-serial.c
>> @@ -1369,14 +1369,14 @@ static int serial_omap_probe(struct platform_device *pdev)
>>
>>        dma_rx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
>>        if (!dma_rx) {
>> -               ret = -EINVAL;
>> -               goto err;
>> +               ret = -ENXIO;
>> +               goto do_release_region;
>>        }
>>
>>        dma_tx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
>>        if (!dma_tx) {
>> -               ret = -EINVAL;
>> -               goto err;
>> +               ret = -ENXIO;
>> +               goto do_release_region;
>>        }
>>
>>        up = kzalloc(sizeof(*up), GFP_KERNEL);
>> @@ -1403,7 +1403,7 @@ static int serial_omap_probe(struct platform_device *pdev)
>>                dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n",
>>                                                                up->port.line);
>>                ret = -ENODEV;
>> -               goto err;
>> +               goto err_port_line;
>>        }
>>
>>        sprintf(up->name, "OMAP UART%d", up->port.line);
>> @@ -1412,7 +1412,7 @@ static int serial_omap_probe(struct platform_device *pdev)
>>        if (!up->port.membase) {
>>                dev_err(&pdev->dev, "can't ioremap UART\n");
>>                ret = -ENOMEM;
>> -               goto err;
>> +               goto err_ioremap;
>>        }
>>
>>        up->port.flags = omap_up_info->flags;
>> @@ -1458,16 +1458,22 @@ static int serial_omap_probe(struct platform_device *pdev)
>>
>>        ret = uart_add_one_port(&serial_omap_reg, &up->port);
>>        if (ret != 0)
>> -               goto do_release_region;
>> +               goto err_add_port;
>>
>>        pm_runtime_put(&pdev->dev);
>>        platform_set_drvdata(pdev, up);
>>        return 0;
>> -err:
>> -       dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
>> -                               pdev->id, __func__, ret);
>> +
>> +err_add_port:
>> +       pm_runtime_disable(&pdev->dev);
>> +       iounmap(up->port.membase);
>> +err_ioremap:
>> +err_port_line:
>> +       kfree(up);
>>  do_release_region:
>>        release_mem_region(mem->start, resource_size(mem));
>> +       dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
>> +                               pdev->id, __func__, ret);
>>        return ret;
>>  }
>>
>> @@ -1476,6 +1482,7 @@ static int serial_omap_remove(struct platform_device *dev)
>>        struct uart_omap_port *up = platform_get_drvdata(dev);
>>
>>        if (up) {
>> +               iounmap(up->port.membase);
> you can build omap-serial as module insmod and rmmod
> the module and test this patch.
>
> This can be done on zoom board which uses a non-omap uart
> as console.

Yes will do that and post another version.
> --
> Thanks,
> Govindraj.R

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/5] omap-serial: Fix the error handling in the omap_serial probe
  2012-01-20  9:35       ` Shubhrajyoti
@ 2012-02-10  6:00         ` Shubhrajyoti
  -1 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti @ 2012-02-10  6:00 UTC (permalink / raw)
  To: Govindraj; +Cc: linux-serial, linux-omap, linux-arm-kernel

On Friday 20 January 2012 03:05 PM, Shubhrajyoti wrote:
> On Friday 20 January 2012 02:19 PM, Govindraj wrote:
>> On Mon, Jan 16, 2012 at 3:52 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
>>> The patch does the following
>>>
>>> - The pm_runtime_disable is called in the remove not in the error
>>>  case of probe.The patch calls the pm_runtime_disable in the error
>>>  case.
>>> - The  up is not freed in the error path. Fix the memory leak by calling
>>>  kfree in the error path.
>>> - Also the iounmap is not called fix the same by calling iounmap in the
>>>  error case of probe and remove .
>>> - Make the name of the error tags more meaningful.
>>>
>>> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
>>> ---
>>>  drivers/tty/serial/omap-serial.c |   27 +++++++++++++++++----------
>>>  1 files changed, 17 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
>>> index 1c24269..8c6f137 100644
>>> --- a/drivers/tty/serial/omap-serial.c
>>> +++ b/drivers/tty/serial/omap-serial.c
>>> @@ -1369,14 +1369,14 @@ static int serial_omap_probe(struct platform_device *pdev)
>>>
>>>        dma_rx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
>>>        if (!dma_rx) {
>>> -               ret = -EINVAL;
>>> -               goto err;
>>> +               ret = -ENXIO;
>>> +               goto do_release_region;
>>>        }
>>>
>>>        dma_tx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
>>>        if (!dma_tx) {
>>> -               ret = -EINVAL;
>>> -               goto err;
>>> +               ret = -ENXIO;
>>> +               goto do_release_region;
>>>        }
>>>
>>>        up = kzalloc(sizeof(*up), GFP_KERNEL);
>>> @@ -1403,7 +1403,7 @@ static int serial_omap_probe(struct platform_device *pdev)
>>>                dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n",
>>>                                                                up->port.line);
>>>                ret = -ENODEV;
>>> -               goto err;
>>> +               goto err_port_line;
>>>        }
>>>
>>>        sprintf(up->name, "OMAP UART%d", up->port.line);
>>> @@ -1412,7 +1412,7 @@ static int serial_omap_probe(struct platform_device *pdev)
>>>        if (!up->port.membase) {
>>>                dev_err(&pdev->dev, "can't ioremap UART\n");
>>>                ret = -ENOMEM;
>>> -               goto err;
>>> +               goto err_ioremap;
>>>        }
>>>
>>>        up->port.flags = omap_up_info->flags;
>>> @@ -1458,16 +1458,22 @@ static int serial_omap_probe(struct platform_device *pdev)
>>>
>>>        ret = uart_add_one_port(&serial_omap_reg, &up->port);
>>>        if (ret != 0)
>>> -               goto do_release_region;
>>> +               goto err_add_port;
>>>
>>>        pm_runtime_put(&pdev->dev);
>>>        platform_set_drvdata(pdev, up);
>>>        return 0;
>>> -err:
>>> -       dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
>>> -                               pdev->id, __func__, ret);
>>> +
>>> +err_add_port:
>>> +       pm_runtime_disable(&pdev->dev);
>>> +       iounmap(up->port.membase);
>>> +err_ioremap:
>>> +err_port_line:
>>> +       kfree(up);
>>>  do_release_region:
>>>        release_mem_region(mem->start, resource_size(mem));
>>> +       dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
>>> +                               pdev->id, __func__, ret);
>>>        return ret;
>>>  }
>>>
>>> @@ -1476,6 +1482,7 @@ static int serial_omap_remove(struct platform_device *dev)
>>>        struct uart_omap_port *up = platform_get_drvdata(dev);
>>>
>>>        if (up) {
>>> +               iounmap(up->port.membase);
>> you can build omap-serial as module insmod and rmmod
>> the module and test this patch.
>>
>> This can be done on zoom board which uses a non-omap uart
>> as console.
> Yes will do that and post another version.
yes , there was a missing memory release just tested with that patch.

thanks,
>> --
>> Thanks,
>> Govindraj.R


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 3/5] omap-serial: Fix the error handling in the omap_serial probe
@ 2012-02-10  6:00         ` Shubhrajyoti
  0 siblings, 0 replies; 24+ messages in thread
From: Shubhrajyoti @ 2012-02-10  6:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 20 January 2012 03:05 PM, Shubhrajyoti wrote:
> On Friday 20 January 2012 02:19 PM, Govindraj wrote:
>> On Mon, Jan 16, 2012 at 3:52 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
>>> The patch does the following
>>>
>>> - The pm_runtime_disable is called in the remove not in the error
>>>  case of probe.The patch calls the pm_runtime_disable in the error
>>>  case.
>>> - The  up is not freed in the error path. Fix the memory leak by calling
>>>  kfree in the error path.
>>> - Also the iounmap is not called fix the same by calling iounmap in the
>>>  error case of probe and remove .
>>> - Make the name of the error tags more meaningful.
>>>
>>> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
>>> ---
>>>  drivers/tty/serial/omap-serial.c |   27 +++++++++++++++++----------
>>>  1 files changed, 17 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
>>> index 1c24269..8c6f137 100644
>>> --- a/drivers/tty/serial/omap-serial.c
>>> +++ b/drivers/tty/serial/omap-serial.c
>>> @@ -1369,14 +1369,14 @@ static int serial_omap_probe(struct platform_device *pdev)
>>>
>>>        dma_rx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
>>>        if (!dma_rx) {
>>> -               ret = -EINVAL;
>>> -               goto err;
>>> +               ret = -ENXIO;
>>> +               goto do_release_region;
>>>        }
>>>
>>>        dma_tx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
>>>        if (!dma_tx) {
>>> -               ret = -EINVAL;
>>> -               goto err;
>>> +               ret = -ENXIO;
>>> +               goto do_release_region;
>>>        }
>>>
>>>        up = kzalloc(sizeof(*up), GFP_KERNEL);
>>> @@ -1403,7 +1403,7 @@ static int serial_omap_probe(struct platform_device *pdev)
>>>                dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n",
>>>                                                                up->port.line);
>>>                ret = -ENODEV;
>>> -               goto err;
>>> +               goto err_port_line;
>>>        }
>>>
>>>        sprintf(up->name, "OMAP UART%d", up->port.line);
>>> @@ -1412,7 +1412,7 @@ static int serial_omap_probe(struct platform_device *pdev)
>>>        if (!up->port.membase) {
>>>                dev_err(&pdev->dev, "can't ioremap UART\n");
>>>                ret = -ENOMEM;
>>> -               goto err;
>>> +               goto err_ioremap;
>>>        }
>>>
>>>        up->port.flags = omap_up_info->flags;
>>> @@ -1458,16 +1458,22 @@ static int serial_omap_probe(struct platform_device *pdev)
>>>
>>>        ret = uart_add_one_port(&serial_omap_reg, &up->port);
>>>        if (ret != 0)
>>> -               goto do_release_region;
>>> +               goto err_add_port;
>>>
>>>        pm_runtime_put(&pdev->dev);
>>>        platform_set_drvdata(pdev, up);
>>>        return 0;
>>> -err:
>>> -       dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
>>> -                               pdev->id, __func__, ret);
>>> +
>>> +err_add_port:
>>> +       pm_runtime_disable(&pdev->dev);
>>> +       iounmap(up->port.membase);
>>> +err_ioremap:
>>> +err_port_line:
>>> +       kfree(up);
>>>  do_release_region:
>>>        release_mem_region(mem->start, resource_size(mem));
>>> +       dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
>>> +                               pdev->id, __func__, ret);
>>>        return ret;
>>>  }
>>>
>>> @@ -1476,6 +1482,7 @@ static int serial_omap_remove(struct platform_device *dev)
>>>        struct uart_omap_port *up = platform_get_drvdata(dev);
>>>
>>>        if (up) {
>>> +               iounmap(up->port.membase);
>> you can build omap-serial as module insmod and rmmod
>> the module and test this patch.
>>
>> This can be done on zoom board which uses a non-omap uart
>> as console.
> Yes will do that and post another version.
yes , there was a missing memory release just tested with that patch.

thanks,
>> --
>> Thanks,
>> Govindraj.R

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2012-02-10  6:00 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-16 10:22 [PATCH 0/5] uart updates Shubhrajyoti D
2012-01-16 10:22 ` Shubhrajyoti D
2012-01-16 10:22 ` [PATCH 1/5] omap-serial :Make the suspend/resume functions depend on CONFIG_PM_SLEEP Shubhrajyoti D
2012-01-16 10:22   ` Shubhrajyoti D
2012-01-16 10:22 ` [PATCH 2/5] omap-serial: make serial_omap_restore_context depend on CONFIG_PM_RUNTIME Shubhrajyoti D
2012-01-16 10:22   ` Shubhrajyoti D
2012-01-16 10:22 ` [PATCH 3/5] omap-serial: Fix the error handling in the omap_serial probe Shubhrajyoti D
2012-01-16 10:22   ` Shubhrajyoti D
2012-01-20  8:49   ` Govindraj
2012-01-20  8:49     ` Govindraj
2012-01-20  9:35     ` Shubhrajyoti
2012-01-20  9:35       ` Shubhrajyoti
2012-02-10  6:00       ` Shubhrajyoti
2012-02-10  6:00         ` Shubhrajyoti
2012-01-16 10:22 ` [PATCH 4/5] ARM : OMAP : serial : Make context_loss_cnt signed Shubhrajyoti D
2012-01-16 10:22   ` Shubhrajyoti D
2012-01-20  8:52   ` Govindraj
2012-01-20  8:52     ` Govindraj
2012-01-16 10:22 ` [PATCH 5/5] OMAP : serial : Check for error in get_context_loss_count Shubhrajyoti D
2012-01-16 10:22   ` Shubhrajyoti D
2012-01-20  8:51   ` Govindraj
2012-01-20  8:51     ` Govindraj
2012-01-20  8:45 ` [PATCH 0/5] uart updates Govindraj
2012-01-20  8:45   ` Govindraj

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.