thermal: Update THERMAL_MAX_TRIPS to 48
Sai Gurrappadi [Fri, 8 Nov 2013 01:51:45 +0000 (17:51 -0800)]
Also changed mask field from int to u64 to support the larger trip point
number.

Change-Id: I5ab2b381de8094ed0477998ec300164b51e81d7f
Signed-off-by: Sai Gurrappadi <sgurrappadi@nvidia.com>
Reviewed-on: http://git-master/r/327982
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>

arch/arm/mach-tegra/tegra11_soctherm.c
drivers/misc/nct1008.c
drivers/misc/therm_est.c
drivers/thermal/thermal_core.c
include/linux/thermal.h

index 0ef2dda..ebe86a5 100644 (file)
@@ -1312,7 +1312,7 @@ static int __init soctherm_thermal_sys_init(void)
                thz[i] = thermal_zone_device_register(
                                        name,
                                        therm->num_trips,
-                                       (1 << therm->num_trips) - 1,
+                                       (1ULL << therm->num_trips) - 1,
                                        (void *)TSENSE_SIZE + i,
                                        &soctherm_ops,
                                        therm->tzp,
index 32a62f4..b25342d 100644 (file)
@@ -1185,7 +1185,7 @@ static int nct1008_probe(struct i2c_client *client,
        struct nct1008_data *data;
        int err;
        int i;
-       int mask = 0;
+       u64 mask = 0;
        char nct_int_name[THERMAL_NAME_LENGTH];
        char nct_ext_name[THERMAL_NAME_LENGTH];
 
@@ -1242,7 +1242,7 @@ static int nct1008_probe(struct i2c_client *client,
        for (i = 0; i < data->plat_data.num_trips; i++)
                if (strcmp(data->plat_data.trips[i].cdev_type,
                                                "shutdown_warning"))
-                       mask |= (1 << i);
+                       mask |= (1ULL << i);
 
        if (data->plat_data.loc_name) {
                strcpy(nct_int_name, "Tboard_");
index b0c09f4..351e949 100644 (file)
@@ -743,7 +743,7 @@ static int therm_est_probe(struct platform_device *pdev)
 
        est->thz = thermal_zone_device_register(dev_name(&pdev->dev),
                                                est->num_trips,
-                                               (1 << est->num_trips) - 1,
+                                               (1ULL << est->num_trips) - 1,
                                                est,
                                                &therm_est_ops,
                                                est->tzp,
index 81c3064..7762509 100644 (file)
@@ -210,13 +210,13 @@ static void print_bind_err_msg(struct thermal_zone_device *tz,
                                tz->type, cdev->type, ret);
 }
 
-static void __bind(struct thermal_zone_device *tz, int mask,
+static void __bind(struct thermal_zone_device *tz, u64 mask,
                        struct thermal_cooling_device *cdev)
 {
        int i, ret;
 
        for (i = 0; i < tz->trips; i++) {
-               if (mask & (1 << i)) {
+               if (mask & (1ULL << i)) {
                        ret = thermal_zone_bind_cooling_device(tz, i, cdev,
                                        THERMAL_NO_LIMIT, THERMAL_NO_LIMIT);
                        if (ret)
@@ -225,13 +225,13 @@ static void __bind(struct thermal_zone_device *tz, int mask,
        }
 }
 
-static void __unbind(struct thermal_zone_device *tz, int mask,
+static void __unbind(struct thermal_zone_device *tz, u64 mask,
                        struct thermal_cooling_device *cdev)
 {
        int i;
 
        for (i = 0; i < tz->trips; i++)
-               if (mask & (1 << i))
+               if (mask & (1ULL << i))
                        thermal_zone_unbind_cooling_device(tz, i, cdev);
 }
 
@@ -1623,7 +1623,7 @@ EXPORT_SYMBOL(thermal_zone_device_find_by_name);
  *
  * Return: 0 on success, the proper error value otherwise.
  */
-static int create_trip_attrs(struct thermal_zone_device *tz, int mask)
+static int create_trip_attrs(struct thermal_zone_device *tz, u64 mask)
 {
        int indx;
        int size = sizeof(struct thermal_attr) * tz->trips;
@@ -1671,7 +1671,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask)
                                                tz->trip_temp_attrs[indx].name;
                tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO;
                tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show;
-               if (mask & (1 << indx)) {
+               if (mask & (1ULL << indx)) {
                        tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR;
                        tz->trip_temp_attrs[indx].attr.store =
                                                        trip_point_temp_store;
@@ -1746,7 +1746,7 @@ static void remove_trip_attrs(struct thermal_zone_device *tz)
  * IS_ERR*() helpers.
  */
 struct thermal_zone_device *thermal_zone_device_register(const char *type,
-       int trips, int mask, void *devdata,
+       int trips, u64 mask, void *devdata,
        const struct thermal_zone_device_ops *ops,
        const struct thermal_zone_params *tzp,
        int passive_delay, int polling_delay)
index bb5c440..1b7c812 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/workqueue.h>
 
 #define THERMAL_TRIPS_NONE     -1
-#define THERMAL_MAX_TRIPS      32
+#define THERMAL_MAX_TRIPS      48
 #define THERMAL_NAME_LENGTH    20
 
 /* invalid cooling state */
@@ -217,7 +217,7 @@ struct thermal_bind_params {
         * thermal zone and cdev, for a particular trip point.
         * See Documentation/thermal/sysfs-api.txt for more information.
         */
-       int trip_mask;
+       u64 trip_mask;
        int (*match) (struct thermal_zone_device *tz,
                        struct thermal_cooling_device *cdev);
 };
@@ -237,7 +237,7 @@ struct thermal_genl_event {
 };
 
 /* Function declarations */
-struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
+struct thermal_zone_device *thermal_zone_device_register(const char *, int, u64,
                void *, const struct thermal_zone_device_ops *,
                const struct thermal_zone_params *, int, int);
 void thermal_zone_device_unregister(struct thermal_zone_device *);