diff mbox

OMAP3: PM: Fix Smartreflex when used with PM_NOOP layer

Message ID 1242388547-4241-1-git-send-email-ext-roger.quadros@nokia.com (mailing list archive)
State Accepted
Delegated to: Kevin Hilman
Headers show

Commit Message

Roger Quadros May 15, 2009, 11:55 a.m. UTC
omap_pm_vddX_get_opp() returns 0 if PM layer is PM_NOOP or PM_NONE.
This is not a valid OPP so we must sanity check this correctly before using.

This patch fixes system lockup when we enable smartreflex
"echo 1 > /sys/power/sr_vdd1_autocomp"

Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com>
---
 arch/arm/mach-omap2/smartreflex.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

Comments

Kevin Hilman May 15, 2009, 2:54 p.m. UTC | #1
Roger Quadros <ext-roger.quadros@nokia.com> writes:

> omap_pm_vddX_get_opp() returns 0 if PM layer is PM_NOOP or PM_NONE.
> This is not a valid OPP so we must sanity check this correctly before using.
>
> This patch fixes system lockup when we enable smartreflex
> "echo 1 > /sys/power/sr_vdd1_autocomp"
>
> Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com>

Oops, this looks like a side effect of my merge of Rajendra's and Phil's
patches.   

Thanks, pushing to PM branch.

Kevin

> ---
>  arch/arm/mach-omap2/smartreflex.c |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
> index 42e16a6..b032366 100644
> --- a/arch/arm/mach-omap2/smartreflex.c
> +++ b/arch/arm/mach-omap2/smartreflex.c
> @@ -787,8 +787,10 @@ static ssize_t omap_sr_vdd1_autocomp_store(struct kobject *kobj,
>  		sr_stop_vddautocomap(SR1);
>  	} else {
>  		u32 current_vdd1opp_no = omap_pm_vdd1_get_opp();
> -		if (IS_ERR_VALUE(current_vdd1opp_no))
> -			return -ENODEV;
> +		if (!current_vdd1opp_no) {
> +			pr_err("sr_vdd1_autocomp: Current VDD1 opp unknown\n");
> +			return -EINVAL;
> +		}
>  		sr_start_vddautocomap(SR1, current_vdd1opp_no);
>  	}
>  	return n;
> @@ -825,8 +827,10 @@ static ssize_t omap_sr_vdd2_autocomp_store(struct kobject *kobj,
>  		sr_stop_vddautocomap(SR2);
>  	} else {
>  		u32 current_vdd2opp_no = omap_pm_vdd2_get_opp();
> -		if (IS_ERR_VALUE(current_vdd2opp_no))
> -			return -ENODEV;
> +		if (!current_vdd2opp_no) {
> +			pr_err("sr_vdd2_autocomp: Current VDD2 opp unknown\n");
> +			return -EINVAL;
> +		}
>  		sr_start_vddautocomap(SR2, current_vdd2opp_no);
>  	}
>  	return n;
> -- 
> 1.6.0.4
--
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
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 42e16a6..b032366 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -787,8 +787,10 @@  static ssize_t omap_sr_vdd1_autocomp_store(struct kobject *kobj,
 		sr_stop_vddautocomap(SR1);
 	} else {
 		u32 current_vdd1opp_no = omap_pm_vdd1_get_opp();
-		if (IS_ERR_VALUE(current_vdd1opp_no))
-			return -ENODEV;
+		if (!current_vdd1opp_no) {
+			pr_err("sr_vdd1_autocomp: Current VDD1 opp unknown\n");
+			return -EINVAL;
+		}
 		sr_start_vddautocomap(SR1, current_vdd1opp_no);
 	}
 	return n;
@@ -825,8 +827,10 @@  static ssize_t omap_sr_vdd2_autocomp_store(struct kobject *kobj,
 		sr_stop_vddautocomap(SR2);
 	} else {
 		u32 current_vdd2opp_no = omap_pm_vdd2_get_opp();
-		if (IS_ERR_VALUE(current_vdd2opp_no))
-			return -ENODEV;
+		if (!current_vdd2opp_no) {
+			pr_err("sr_vdd2_autocomp: Current VDD2 opp unknown\n");
+			return -EINVAL;
+		}
 		sr_start_vddautocomap(SR2, current_vdd2opp_no);
 	}
 	return n;