Skip to contentSkip to conversation

arm: omap3: pm34xx.c: Some minor fixups

PATCH Superseded Mark A. Greer 2 participants 5 messages Mar 15, 2012 – Mar 16, 2012

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

I found some minor issues when looking through pm34xx.c recently so these patches try to address them. My apologies if they are already fixed in another branch somewhere. Based on latest k.o. master branch.

Mark
--

#1 lore raw

PATCH 1/2 arm: omap3: pm34xx.c: Fix omap3_pm_init() error out paths

From: "Mark A. Greer" <[email protected]>

It appears that the error paths were overlooked when the omap3_pm_init() routine had the prcm chain handler code added. Fix this by adding a goto target and reordering the error handling code. Also fix how the irq argument for free_irq() is determined.

---
 arch/arm/mach-omap2/pm34xx.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/pm34xx.c +10 -6
index 27fc7a2..af8d741 100644
@@ -817,13 +817,13 @@ static int __init omap3_pm_init(void)
 
 	if (ret) {
 		pr_err("pm: Failed to request pm_io irq\n");
-		goto err1;
+		goto err2;
 	}
 
 	ret = pwrdm_for_each(pwrdms_setup, NULL);
 	if (ret) {
 		printk(KERN_ERR "Failed to setup powerdomains\n");
-		goto err2;
+		goto err3;
 	}
 
 	(void) clkdm_for_each(clkdms_setup, NULL);
@@ -831,7 +831,8 @@ static int __init omap3_pm_init(void)
 	mpu_pwrdm = pwrdm_lookup("mpu_pwrdm");
 	if (mpu_pwrdm == NULL) {
 		printk(KERN_ERR "Failed to get mpu_pwrdm\n");
-		goto err2;
+		ret = -EINVAL;
+		goto err3;
 	}
 
 	neon_pwrdm = pwrdm_lookup("neon_pwrdm");
@@ -879,14 +880,17 @@ static int __init omap3_pm_init(void)
 	}
 
 	omap3_save_scratchpad_contents();
-err1:
 	return ret;
-err2:
-	free_irq(INT_34XX_PRCM_MPU_IRQ, NULL);
+
+err3:
 	list_for_each_entry_safe(pwrst, tmp, &pwrst_list, node) {
 		list_del(&pwrst->node);
 		kfree(pwrst);
 	}
+	free_irq(omap_prcm_event_to_irq("io"), omap3_pm_init);
+err2:
+	free_irq(omap_prcm_event_to_irq("wkup"), NULL);
+err1:
 	return ret;
 }
 
Signature · 1 line
1.7.9.4
#2 lore raw

PATCH 2/2 arm: omap3: pm34xx.c: Replace printk() with appropriate pr_*()

In reply to Mark A. Greer

From: "Mark A. Greer" <[email protected]>

Currently, pm34xx.c has a mix of printk() and pr_*() statements so replace the printk() statements with the equivalent pr_*() statements.

---
 arch/arm/mach-omap2/pm34xx.c |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
arch/arm/mach-omap2/pm34xx.c +8 -9
index af8d741..495e509 100644
@@ -166,8 +166,7 @@ static void omap3_save_secure_ram_context(void)
 		pwrdm_set_next_pwrst(mpu_pwrdm, mpu_next_state);
 		/* Following is for error tracking, it should not happen */
 		if (ret) {
-			printk(KERN_ERR "save_secure_sram() returns %08x\n",
-				ret);
+			pr_err("save_secure_sram() returns %08x\n", ret);
 			while (1)
 				;
 		}
@@ -307,7 +306,7 @@ void omap_sram_idle(void)
 		break;
 	default:
 		/* Invalid state */
-		printk(KERN_ERR "Invalid mpu state in sram_idle\n");
+		pr_err("Invalid mpu state in sram_idle\n");
 		return;
 	}
 
@@ -463,7 +462,7 @@ restore:
 	list_for_each_entry(pwrst, &pwrst_list, node) {
 		state = pwrdm_read_prev_pwrst(pwrst->pwrdm);
 		if (state > pwrst->next_state) {
-			printk(KERN_INFO "Powerdomain (%s) didn't enter "
+			pr_info("Powerdomain (%s) didn't enter "
 			       "target state %d\n",
 			       pwrst->pwrdm->name, pwrst->next_state);
 			ret = -1;
@@ -471,9 +470,9 @@ restore:
 		omap_set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state);
 	}
 	if (ret)
-		printk(KERN_ERR "Could not enter target state in pm_suspend\n");
+		pr_err("Could not enter target state in pm_suspend\n");
 	else
-		printk(KERN_INFO "Successfully put all powerdomains "
+		pr_info("Successfully put all powerdomains "
 		       "to target state\n");
 
 	return ret;
@@ -822,7 +821,7 @@ static int __init omap3_pm_init(void)
 
 	ret = pwrdm_for_each(pwrdms_setup, NULL);
 	if (ret) {
-		printk(KERN_ERR "Failed to setup powerdomains\n");
+		pr_err("Failed to setup powerdomains\n");
 		goto err3;
 	}
 
@@ -830,7 +829,7 @@ static int __init omap3_pm_init(void)
 
 	mpu_pwrdm = pwrdm_lookup("mpu_pwrdm");
 	if (mpu_pwrdm == NULL) {
-		printk(KERN_ERR "Failed to get mpu_pwrdm\n");
+		pr_err("Failed to get mpu_pwrdm\n");
 		ret = -EINVAL;
 		goto err3;
 	}
@@ -865,7 +864,7 @@ static int __init omap3_pm_init(void)
 		omap3_secure_ram_storage =
 			kmalloc(0x803F, GFP_KERNEL);
 		if (!omap3_secure_ram_storage)
-			printk(KERN_ERR "Memory allocation failed when"
+			pr_err("Memory allocation failed when"
 					"allocating for secure sram context\n");
 
 		local_irq_disable();
Signature · 1 line
1.7.9.4
#3 lore raw

PATCH 2/2 arm: omap3: pm34xx.c: Replace printk() with appropriate pr_*()

Hello.

Quoted 15 lines · Mark A. Greer

From: "Mark A. Greer" <[email protected]>

Currently, pm34xx.c has a mix of printk() and pr_*() statements so replace the printk() statements with the equivalent pr_*() statements.

---
  arch/arm/mach-omap2/pm34xx.c |   17 ++++++++---------
  1 file changed, 8 insertions(+), 9 deletions(-)
arch/arm/mach-omap2/pm34xx.c +0 -0
index af8d741..495e509 100644

[...]

arch/arm/mach-omap2/pm34xx.c restore: · line 466

Quoted 7 lines
arch/arm/mach-omap2/pm34xx.c +1 -1
@@ -463,7 +462,7 @@ restore:
  	list_for_each_entry(pwrst,&pwrst_list, node) {
  		state = pwrdm_read_prev_pwrst(pwrst->pwrdm);
  		if (state>  pwrst->next_state) {
-			printk(KERN_INFO "Powerdomain (%s) didn't enter "
+			pr_info("Powerdomain (%s) didn't enter "
  			       "target state %d\n",

Last line should have been realigned I think.

arch/arm/mach-omap2/pm34xx.c restore: · line 476

Quoted 12 lines
arch/arm/mach-omap2/pm34xx.c +2 -2
  			       pwrst->pwrdm->name, pwrst->next_state);
  			ret = -1;
@@ -471,9 +470,9 @@ restore:
  		omap_set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state);
  	}
  	if (ret)
-		printk(KERN_ERR "Could not enter target state in pm_suspend\n");
+		pr_err("Could not enter target state in pm_suspend\n");
  	else
-		printk(KERN_INFO "Successfully put all powerdomains "
+		pr_info("Successfully put all powerdomains "
  		       "to target state\n");

Last line should have been realigned I think.

arch/arm/mach-omap2/pm34xx.c static int __init omap3_pm_init(void) · line 867

Quoted 8 lines
arch/arm/mach-omap2/pm34xx.c +1 -1
  	return ret;
@@ -865,7 +864,7 @@ static int __init omap3_pm_init(void)
  		omap3_secure_ram_storage =
  			kmalloc(0x803F, GFP_KERNEL);
  		if (!omap3_secure_ram_storage)
-			printk(KERN_ERR "Memory allocation failed when"
+			pr_err("Memory allocation failed when"

BTW, space after "when" is missing here.

arch/arm/mach-omap2/pm34xx.c static int __init omap3_pm_init(void) · line 868

Quoted 1 line
arch/arm/mach-omap2/pm34xx.c +0 -0
  					"allocating for secure sram context\n");

Should have been realigned I think.

WBR, Sergei

#4 lore raw

PATCH 2/2 arm: omap3: pm34xx.c: Replace printk() with appropriate pr_*()

Quoted 6 lines · Sergei Shtylyov

Hello.

Quoted 1 line · Mark A. Greer

From: "Mark A. Greer" <[email protected]>

Quoted 9 lines

arch/arm/mach-omap2/pm34xx.c restore: · line 466

Quoted 7 lines
arch/arm/mach-omap2/pm34xx.c +1 -1
@@ -463,7 +462,7 @@ restore:
 	list_for_each_entry(pwrst,&pwrst_list, node) {
 		state = pwrdm_read_prev_pwrst(pwrst->pwrdm);
 		if (state>  pwrst->next_state) {
-			printk(KERN_INFO "Powerdomain (%s) didn't enter "
+			pr_info("Powerdomain (%s) didn't enter "
 			       "target state %d\n",

Last line should have been realigned I think.

Okay, I'll fix this and the others in a bit.

Mark
--