Skip to contentSkip to conversation

serial: omap: Remove unnecessary checks from suspend/resume

PATCH New Sourav Poddar 3 participants 5 messages Sep 18, 2012 – Sep 21, 2012 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: omap: Remove unnecessary checks from suspend/resume

Drop the check for "up" being valid on suspend/resume callbacks. It should be valid always. Get rid of the "pdata" check also as serial_omap_get_context_loss_count() checks for it.

Tested on omap4 panda and 3630 based Beagle board.

---
 drivers/tty/serial/omap-serial.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)
drivers/tty/serial/omap-serial.c +9 -14
index f175385..3c05c5e 100644
@@ -1222,10 +1222,8 @@ static int serial_omap_suspend(struct device *dev)
 {
 	struct uart_omap_port *up = dev_get_drvdata(dev);
 
-	if (up) {
-		uart_suspend_port(&serial_omap_reg, &up->port);
-		flush_work_sync(&up->qos_work);
-	}
+	uart_suspend_port(&serial_omap_reg, &up->port);
+	flush_work_sync(&up->qos_work);
 
 	return 0;
 }
@@ -1234,8 +1232,8 @@ static int serial_omap_resume(struct device *dev)
 {
 	struct uart_omap_port *up = dev_get_drvdata(dev);
 
-	if (up)
-		uart_resume_port(&serial_omap_reg, &up->port);
+	uart_resume_port(&serial_omap_reg, &up->port);
+
 	return 0;
 }
 #endif
@@ -1553,17 +1551,14 @@ static int serial_omap_runtime_suspend(struct device *dev)
 static int serial_omap_runtime_resume(struct device *dev)
 {
 	struct uart_omap_port *up = dev_get_drvdata(dev);
-	struct omap_uart_port_info *pdata = dev->platform_data;
 
-	if (up && pdata) {
-			u32 loss_cnt = serial_omap_get_context_loss_count(up);
+	u32 loss_cnt = serial_omap_get_context_loss_count(up);
 
-			if (up->context_loss_cnt != loss_cnt)
-				serial_omap_restore_context(up);
+	if (up->context_loss_cnt != loss_cnt)
+		serial_omap_restore_context(up);
 
-		up->latency = up->calc_latency;
-		schedule_work(&up->qos_work);
-	}
+	up->latency = up->calc_latency;
+	schedule_work(&up->qos_work);
 
 	return 0;
 }
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 serial: omap: Remove unnecessary checks from suspend/resume

Quoted 5 lines · Sourav Poddar

Drop the check for "up" being valid on suspend/resume callbacks. It should be valid always. Get rid of the "pdata" check also as serial_omap_get_context_loss_count() checks for it.

Tested on omap4 panda and 3630 based Beagle board.

you need a blank line here. Other than that:

ps: what kind of tests did you run, btw ?

Quoted 59 lines
---
 drivers/tty/serial/omap-serial.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)
drivers/tty/serial/omap-serial.c +9 -14
index f175385..3c05c5e 100644
@@ -1222,10 +1222,8 @@ static int serial_omap_suspend(struct device *dev)
 {
 	struct uart_omap_port *up = dev_get_drvdata(dev);
 
-	if (up) {
-		uart_suspend_port(&serial_omap_reg, &up->port);
-		flush_work_sync(&up->qos_work);
-	}
+	uart_suspend_port(&serial_omap_reg, &up->port);
+	flush_work_sync(&up->qos_work);
 
 	return 0;
 }
@@ -1234,8 +1232,8 @@ static int serial_omap_resume(struct device *dev)
 {
 	struct uart_omap_port *up = dev_get_drvdata(dev);
 
-	if (up)
-		uart_resume_port(&serial_omap_reg, &up->port);
+	uart_resume_port(&serial_omap_reg, &up->port);
+
 	return 0;
 }
 #endif
@@ -1553,17 +1551,14 @@ static int serial_omap_runtime_suspend(struct device *dev)
 static int serial_omap_runtime_resume(struct device *dev)
 {
 	struct uart_omap_port *up = dev_get_drvdata(dev);
-	struct omap_uart_port_info *pdata = dev->platform_data;
 
-	if (up && pdata) {
-			u32 loss_cnt = serial_omap_get_context_loss_count(up);
+	u32 loss_cnt = serial_omap_get_context_loss_count(up);
 
-			if (up->context_loss_cnt != loss_cnt)
-				serial_omap_restore_context(up);
+	if (up->context_loss_cnt != loss_cnt)
+		serial_omap_restore_context(up);
 
-		up->latency = up->calc_latency;
-		schedule_work(&up->qos_work);
-	}
+	up->latency = up->calc_latency;
+	schedule_work(&up->qos_work);
 
 	return 0;
 }
Signature · 1 line
1.7.1
Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120918/c02b5095/attachment-0001.sig>
#2 lore raw

PATCH 1/1 serial: omap: Remove unnecessary checks from suspend/resume

Hi Felipe,

Quoted 5 lines · Felipe Balbi
Quoted 4 lines · Sourav Poddar

Drop the check for "up" being valid on suspend/resume callbacks. It should be valid always. Get rid of the "pdata" check also as serial_omap_get_context_loss_count() checks for it.

Quoted 8 lines
Quoted 1 line

Tested on omap4 panda and 3630 based Beagle board.

you need a blank line here. Other than that:

ps: what kind of tests did you run, btw ?

Boot tested on Panda.
Boot and PM tested(hitiing Off) on Beagle.

Quoted 62 lines
Quoted 57 lines
---
 drivers/tty/serial/omap-serial.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)
drivers/tty/serial/omap-serial.c +9 -15
index f175385..3c05c5e 100644
@@ -1222,10 +1222,8 @@ static int serial_omap_suspend(struct device *dev)
 {
      struct uart_omap_port *up = dev_get_drvdata(dev);
 
-     if (up) {
-             uart_suspend_port(&serial_omap_reg, &up->port);
-             flush_work_sync(&up->qos_work);
-     }
+     uart_suspend_port(&serial_omap_reg, &up->port);
+     flush_work_sync(&up->qos_work);
 
      return 0;
 }
@@ -1234,8 +1232,8 @@ static int serial_omap_resume(struct device *dev)
 {
      struct uart_omap_port *up = dev_get_drvdata(dev);
 
-     if (up)
-             uart_resume_port(&serial_omap_reg, &up->port);
+     uart_resume_port(&serial_omap_reg, &up->port);
+
      return 0;
 }
 #endif
@@ -1553,17 +1551,14 @@ static int serial_omap_runtime_suspend(struct device *dev)
 static int serial_omap_runtime_resume(struct device *dev)
 {
      struct uart_omap_port *up = dev_get_drvdata(dev);
-     struct omap_uart_port_info *pdata = dev->platform_data;
 
-     if (up && pdata) {
-                     u32 loss_cnt = serial_omap_get_context_loss_count(up);
+     u32 loss_cnt = serial_omap_get_context_loss_count(up);
 
-                     if (up->context_loss_cnt != loss_cnt)
-                             serial_omap_restore_context(up);
+     if (up->context_loss_cnt != loss_cnt)
+             serial_omap_restore_context(up);
 
-             up->latency = up->calc_latency;
-             schedule_work(&up->qos_work);
-     }
+     up->latency = up->calc_latency;
+     schedule_work(&up->qos_work);
 
      return 0;
 }
--
Quoted 2 lines

1.7.1

--
balbi

#3 lore raw

PATCH 1/1 serial: omap: Remove unnecessary checks from suspend/resume

Quoted 10 lines · Sourav

Hi Felipe,

Quoted 7 lines · Felipe Balbi
Quoted 5 lines · Sourav Poddar

Drop the check for "up" being valid on suspend/resume callbacks. It should be valid always. Get rid of the "pdata" check also as serial_omap_get_context_loss_count() checks for it.

Tested on omap4 panda and 3630 based Beagle board.

Quoted 8 lines
Quoted 6 lines

you need a blank line here. Other than that:

ps: what kind of tests did you run, btw ?

Boot tested on Panda.
Boot and PM tested(hitiing Off) on Beagle.

What does "PM tested" mean. hitting off in idle? hitting off in suspend? both?

Please clarify.

Thanks,

Kevin

#4 lore raw

PATCH 1/1 serial: omap: Remove unnecessary checks from suspend/resume

Hi Kevin,

Quoted 16 lines · Kevin Hilman
Quoted 14 lines · Sourav

Hi Felipe,

Quoted 11 lines · Felipe Balbi
Quoted 5 lines · Sourav Poddar

Drop the check for "up" being valid on suspend/resume callbacks. It should be valid always. Get rid of the "pdata" check also as serial_omap_get_context_loss_count() checks for it.

Tested on omap4 panda and 3630 based Beagle board.

you need a blank line here. Other than that:

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

ps: what kind of tests did you run, btw ?

Boot tested on Panda.
Boot and PM tested(hitiing Off) on Beagle.

What does "PM tested" mean. hitting off in idle? hitting off in suspend? both?

Hitting off in both idle and suspend.

Quoted 5 lines

Please clarify.

Thanks,

Kevin

~Sourav