diff mbox

[RFC,3/3] omap3+: sr: Reuse sr_[start|stop]_vddautocomp functions

Message ID 1299081445-27938-4-git-send-email-jhnikula@gmail.com (mailing list archive)
State New, archived
Delegated to: Kevin Hilman
Headers show

Commit Message

Jarkko Nikula March 2, 2011, 3:57 p.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 11741d8..7e6002f 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -227,7 +227,7 @@  static void sr_start_vddautocomp(struct omap_sr *sr)
 		sr->autocomp_active = true;
 }
 
-static void sr_stop_vddautocomp(struct omap_sr *sr)
+static void sr_stop_vddautocomp(struct omap_sr *sr, int is_volt_reset)
 {
 	if (!sr->autocomp_active)
 		return;
@@ -239,7 +239,7 @@  static void sr_stop_vddautocomp(struct omap_sr *sr)
 		return;
 	}
 
-	if (!sr_class->disable(sr->voltdm, 1))
+	if (!sr_class->disable(sr->voltdm, is_volt_reset))
 		sr->autocomp_active = false;
 }
 
@@ -681,16 +681,7 @@  void omap_sr_enable(struct voltagedomain *voltdm)
 		return;
 	}
 
-	if (!sr->autocomp_active)
-		return;
-
-	if (!sr_class || !(sr_class->enable) || !(sr_class->configure)) {
-		dev_warn(&sr->pdev->dev, "%s: smartreflex class driver not"
-			"registered\n", __func__);
-		return;
-	}
-
-	sr_class->enable(voltdm);
+	sr_start_vddautocomp(sr);
 }
 
 /**
@@ -714,16 +705,7 @@  void omap_sr_disable(struct voltagedomain *voltdm)
 		return;
 	}
 
-	if (!sr->autocomp_active)
-		return;
-
-	if (!sr_class || !(sr_class->disable)) {
-		dev_warn(&sr->pdev->dev, "%s: smartreflex class driver not"
-			"registered\n", __func__);
-		return;
-	}
-
-	sr_class->disable(voltdm, 0);
+	sr_stop_vddautocomp(sr, 0);
 }
 
 /**
@@ -747,16 +729,7 @@  void omap_sr_disable_reset_volt(struct voltagedomain *voltdm)
 		return;
 	}
 
-	if (!sr->autocomp_active)
-		return;
-
-	if (!sr_class || !(sr_class->disable)) {
-		dev_warn(&sr->pdev->dev, "%s: smartreflex class driver not"
-			"registered\n", __func__);
-		return;
-	}
-
-	sr_class->disable(voltdm, 1);
+	sr_stop_vddautocomp(sr, 1);
 }
 
 /**
@@ -809,7 +782,7 @@  static int omap_sr_autocomp_store(void *data, u64 val)
 	}
 
 	if (!val)
-		sr_stop_vddautocomp(sr_info);
+		sr_stop_vddautocomp(sr_info, 1);
 	else
 		sr_start_vddautocomp(sr_info);
 
@@ -976,7 +949,7 @@  static int __devexit omap_sr_remove(struct platform_device *pdev)
 	}
 
 	if (sr_info->autocomp_active)
-		sr_stop_vddautocomp(sr_info);
+		sr_stop_vddautocomp(sr_info, 1);
 
 	list_del(&sr_info->node);
 	iounmap(sr_info->base);