[PATCHv3 12/22] OMAP3: PM: Minimizing the passing around of sr id in smartreflex.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch ensures that sr id is passed as a parameter only to
public APIs in smartreflex.c and other APIs in smartreflex.c
uses the omap_sr strucutres.

Signed-off-by: Thara Gopinath <thara@xxxxxx>
---
 arch/arm/mach-omap2/smartreflex.c |   36 +++++++++++++-----------------------
 1 files changed, 13 insertions(+), 23 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index fffd5f7..c6942e9 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -190,16 +190,8 @@ static void sr_configure(struct omap_sr *sr)
 	sr->is_sr_reset = 0;
 }
 
-static void sr_start_vddautocomp(int srid)
+static void sr_start_vddautocomp(struct omap_sr *sr)
 {
-	struct omap_sr *sr = _sr_lookup(srid);
-
-	if (!sr) {
-		pr_warning("omap_sr struct corresponding to SR%d not found\n",
-								srid + 1);
-		return;
-	}
-
 	if (!sr_class || !(sr_class->enable)) {
 		pr_warning("smartreflex class driver not registered\n");
 		return;
@@ -211,30 +203,22 @@ static void sr_start_vddautocomp(int srid)
 	}
 
 	sr->is_autocomp_active = 1;
-	if (!sr_class->enable(srid)) {
+	if (!sr_class->enable(sr->srid)) {
 		sr->is_autocomp_active = 0;
 		if (sr->is_sr_reset == 1)
 			sr_clk_disable(sr);
 	}
 }
 
-static void  sr_stop_vddautocomp(int srid)
+static void  sr_stop_vddautocomp(struct omap_sr *sr)
 {
-	struct omap_sr *sr = _sr_lookup(srid);
-
-	if (!sr) {
-		pr_warning("omap_sr struct corresponding to SR%d not found\n",
-								srid + 1);
-		return;
-	}
-
 	if (!sr_class || !(sr_class->disable)) {
 		pr_warning("smartreflex class driver not registered\n");
 		return;
 	}
 
 	if (sr->is_autocomp_active == 1) {
-		sr_class->disable(srid);
+		sr_class->disable(sr->srid);
 		sr_clk_disable(sr);
 		sr->is_autocomp_active = 0;
 	}
@@ -426,9 +410,9 @@ static int omap_sr_autocomp_store(void *data, u64 val)
 		return 0;
 	}
 	if (val == 0)
-		sr_stop_vddautocomp(sr_info->srid);
+		sr_stop_vddautocomp(sr_info);
 	else
-		sr_start_vddautocomp(sr_info->srid);
+		sr_start_vddautocomp(sr_info);
 	return 0;
 }
 
@@ -468,9 +452,15 @@ static int __devexit omap_smartreflex_remove(struct platform_device *pdev)
 {
 	struct omap_sr *sr_info = _sr_lookup(pdev->id + 1);
 
+	if (!sr_info) {
+		pr_warning("omap_sr struct corresponding to SR%d not found\n",
+							pdev->id + 1);
+		return 0;
+	}
+
 	/* Disable Autocompensation if enabled before removing the module */
 	if (sr_info->is_autocomp_active == 1)
-		sr_stop_vddautocomp(sr_info->srid);
+		sr_stop_vddautocomp(sr_info);
 	list_del(&sr_info->node);
 	kfree(sr_info);
 
-- 
1.7.0.rc1.33.g07cf0f

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

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux