@@ -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);