]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
arm: tegra12: soctherm: Check and register cdev
authorDiwakar Tundlam <dtundlam@nvidia.com>
Mon, 28 Oct 2013 22:49:32 +0000 (15:49 -0700)
committerDiwakar Tundlam <dtundlam@nvidia.com>
Wed, 30 Oct 2013 19:04:06 +0000 (12:04 -0700)
Save previous reigstration of tegra-shutdown cooling device and check
it to avoid duplicates.

Bug 1342361

Change-Id: I01c7e68c6045d27f8bf2c1173d36245f87cd9342
Reviewed-on: http://git-master/r/304542
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Tested-by: Diwakar Tundlam <dtundlam@nvidia.com>
arch/arm/mach-tegra/tegra11_soctherm.c

index d40b9fe200b46dffc221dac15ffe1a087e261c2c..d874489dd51957b4ef882f3c83c5e873315b9b92 100644 (file)
@@ -900,6 +900,8 @@ static int soctherm_hw_action_set_cur_state(struct thermal_cooling_device *cdev,
        return 0; /* hw sets this state */
 }
 
+static struct thermal_cooling_device *soctherm_hw_critical_cdev;
+static struct thermal_cooling_device *soctherm_hw_hot_cdev;
 static struct thermal_cooling_device_ops soctherm_hw_action_ops = {
        .get_max_state = soctherm_hw_action_get_max_state,
        .get_cur_state = soctherm_hw_action_get_cur_state,
@@ -1237,7 +1239,10 @@ static int __init soctherm_thermal_sys_init(void)
                for (j = 0; j < therm->num_trips; j++) {
                        switch (therm->trips[j].trip_type) {
                        case THERMAL_TRIP_CRITICAL:
-                               thermal_cooling_device_register(
+                               if (soctherm_hw_critical_cdev)
+                                       break;
+                               soctherm_hw_critical_cdev =
+                                       thermal_cooling_device_register(
                                                therm->trips[j].cdev_type,
                                                &therm->trips[j],
                                                &soctherm_hw_action_ops);
@@ -1279,10 +1284,13 @@ static int __init soctherm_thermal_sys_init(void)
                                             && k == THROTTLE_OC5))
                                                continue;
 
-                                       thermal_cooling_device_register(
-                                               therm->trips[j].cdev_type,
-                                               &therm->trips[j],
-                                               &soctherm_hw_action_ops);
+                                       if (soctherm_hw_hot_cdev)
+                                               continue;
+                                       soctherm_hw_hot_cdev =
+                                               thermal_cooling_device_register(
+                                                     therm->trips[j].cdev_type,
+                                                     &therm->trips[j],
+                                                     &soctherm_hw_action_ops);
                                }
                                break;