]> git.baikalelectronics.ru Git - kernel.git/commitdiff
macintosh: change some data types from int to bool
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Wed, 24 Jan 2018 01:42:28 +0000 (19:42 -0600)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 28 Jan 2018 06:21:09 +0000 (17:21 +1100)
Change the data type of the following variables from int to bool
across all macintosh drivers:

started
slots_started
pm121_started
wf_smu_started

Some of these issues were detected with the help of Coccinelle.

Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
drivers/macintosh/therm_adt746x.c
drivers/macintosh/windfarm_pm112.c
drivers/macintosh/windfarm_pm121.c
drivers/macintosh/windfarm_pm72.c
drivers/macintosh/windfarm_pm81.c
drivers/macintosh/windfarm_pm91.c
drivers/macintosh/windfarm_rm31.c

index f433521a6f9d91d9ad6c5563866b3b3f30ee09ac..d7cd5afa38cd16ffd3d2906d5dfc957ec1369b2f 100644 (file)
@@ -230,7 +230,7 @@ static void update_fans_speed (struct thermostat *th)
 
        /* we don't care about local sensor, so we start at sensor 1 */
        for (i = 1; i < 3; i++) {
-               int started = 0;
+               bool started = false;
                int fan_number = (th->type == ADT7460 && i == 2);
                int var = th->temps[i] - th->limits[i];
 
@@ -243,7 +243,7 @@ static void update_fans_speed (struct thermostat *th)
                        if (abs(var - th->last_var[fan_number]) < 2)
                                continue;
 
-                       started = 1;
+                       started = true;
                        new_speed = fan_speed + ((var-1)*step);
 
                        if (new_speed < fan_speed)
index 96d16fca68b2469f5a73c57369deaac3ed04e8ec..fec91db1142ec298de407917437f0db0072e086f 100644 (file)
@@ -96,14 +96,14 @@ static int cpu_last_target;
 static struct wf_pid_state backside_pid;
 static int backside_tick;
 static struct wf_pid_state slots_pid;
-static int slots_started;
+static bool slots_started;
 static struct wf_pid_state drive_bay_pid;
 static int drive_bay_tick;
 
 static int nr_cores;
 static int have_all_controls;
 static int have_all_sensors;
-static int started;
+static bool started;
 
 static int failure_state;
 #define FAILURE_SENSOR         1
@@ -462,7 +462,7 @@ static void slots_fan_tick(void)
                /* first time; initialize things */
                printk(KERN_INFO "windfarm: Slots control loop started.\n");
                wf_pid_init(&slots_pid, &slots_param);
-               slots_started = 1;
+               slots_started = true;
        }
 
        err = slots_power->ops->get_value(slots_power, &power);
@@ -506,7 +506,7 @@ static void pm112_tick(void)
        int i, last_failure;
 
        if (!started) {
-               started = 1;
+               started = true;
                printk(KERN_INFO "windfarm: CPUs control loops started.\n");
                for (i = 0; i < nr_cores; ++i) {
                        if (create_cpu_loop(i) < 0) {
index b350fb86ff08c93f9bc11c43d642d4c3feed765d..4d72d8f58cb6388d3e7f89111273d77d40816823 100644 (file)
@@ -246,7 +246,8 @@ enum {
 static struct wf_control *controls[N_CONTROLS] = {};
 
 /* Set to kick the control loop into life */
-static int pm121_all_controls_ok, pm121_all_sensors_ok, pm121_started;
+static int pm121_all_controls_ok, pm121_all_sensors_ok;
+static bool pm121_started;
 
 enum {
        FAILURE_FAN             = 1 << 0,
@@ -806,7 +807,7 @@ static void pm121_tick(void)
                        pm121_create_sys_fans(i);
 
                pm121_create_cpu_fans();
-               pm121_started = 1;
+               pm121_started = true;
        }
 
        /* skipping ticks */
index e88cfb36a74d139b035574a9b078e16a13f7d35b..833021508c05c879b2a8c929105bb2e90b0353cd 100644 (file)
@@ -611,7 +611,7 @@ static void pm72_tick(void)
        int i, last_failure;
 
        if (!started) {
-               started = 1;
+               started = true;
                printk(KERN_INFO "windfarm: CPUs control loops started.\n");
                for (i = 0; i < nr_chips; ++i) {
                        if (cpu_setup_pid(i) < 0) {
index 93faf298a3c56e39a5703eb014ea1512af06fc28..d9ea45581b9e879350a0b791f9f8c28ea07cc856 100644 (file)
@@ -140,7 +140,8 @@ static struct wf_control *fan_system;
 static struct wf_control *cpufreq_clamp;
 
 /* Set to kick the control loop into life */
-static int wf_smu_all_controls_ok, wf_smu_all_sensors_ok, wf_smu_started;
+static int wf_smu_all_controls_ok, wf_smu_all_sensors_ok;
+static bool wf_smu_started;
 
 /* Failure handling.. could be nicer */
 #define FAILURE_FAN            0x01
@@ -549,7 +550,7 @@ static void wf_smu_tick(void)
                DBG("wf: creating control loops !\n");
                wf_smu_create_sys_fans();
                wf_smu_create_cpu_fans();
-               wf_smu_started = 1;
+               wf_smu_started = true;
        }
 
        /* Skipping ticks */
index 81fdf40c5b82b6ee460de4008cf7a661ebc35de7..7fd73dcb2b0a43f1ce50407d4485e033e0862c2b 100644 (file)
@@ -75,7 +75,8 @@ static struct wf_control *fan_slots;
 static struct wf_control *cpufreq_clamp;
 
 /* Set to kick the control loop into life */
-static int wf_smu_all_controls_ok, wf_smu_all_sensors_ok, wf_smu_started;
+static int wf_smu_all_controls_ok, wf_smu_all_sensors_ok;
+static bool wf_smu_started;
 static bool wf_smu_overtemp;
 
 /* Failure handling.. could be nicer */
@@ -467,7 +468,7 @@ static void wf_smu_tick(void)
                wf_smu_create_drive_fans();
                wf_smu_create_slots_fans();
                wf_smu_create_cpu_fans();
-               wf_smu_started = 1;
+               wf_smu_started = true;
        }
 
        /* Skipping ticks */
index a0cd9c7f98351553625b62f63f5dcd03c8b95df5..9ce87cc0597f086204a8f8fc078e7344776f2322 100644 (file)
@@ -514,7 +514,7 @@ static void rm31_tick(void)
        int i, last_failure;
 
        if (!started) {
-               started = 1;
+               started = true;
                printk(KERN_INFO "windfarm: CPUs control loops started.\n");
                for (i = 0; i < nr_chips; ++i) {
                        if (cpu_setup_pid(i) < 0) {