linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] macintosh: change some data types from int to bool
@ 2018-01-24  1:42 Gustavo A. R. Silva
  2018-01-29  4:13 ` Michael Ellerman
  0 siblings, 1 reply; 5+ messages in thread
From: Gustavo A. R. Silva @ 2018-01-24  1:42 UTC (permalink / raw)
  To: Michael Ellerman, Colin Leroy, Benjamin Herrenschmidt
  Cc: linuxppc-dev, linux-kernel, Gustavo A. R. Silva

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>
---
 drivers/macintosh/therm_adt746x.c  | 4 ++--
 drivers/macintosh/windfarm_pm112.c | 8 ++++----
 drivers/macintosh/windfarm_pm121.c | 5 +++--
 drivers/macintosh/windfarm_pm72.c  | 2 +-
 drivers/macintosh/windfarm_pm81.c  | 5 +++--
 drivers/macintosh/windfarm_pm91.c  | 5 +++--
 drivers/macintosh/windfarm_rm31.c  | 2 +-
 7 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
index f433521..d7cd5af 100644
--- a/drivers/macintosh/therm_adt746x.c
+++ b/drivers/macintosh/therm_adt746x.c
@@ -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)
diff --git a/drivers/macintosh/windfarm_pm112.c b/drivers/macintosh/windfarm_pm112.c
index 96d16fc..fec91db 100644
--- a/drivers/macintosh/windfarm_pm112.c
+++ b/drivers/macintosh/windfarm_pm112.c
@@ -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) {
diff --git a/drivers/macintosh/windfarm_pm121.c b/drivers/macintosh/windfarm_pm121.c
index b350fb8..4d72d8f 100644
--- a/drivers/macintosh/windfarm_pm121.c
+++ b/drivers/macintosh/windfarm_pm121.c
@@ -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 */
diff --git a/drivers/macintosh/windfarm_pm72.c b/drivers/macintosh/windfarm_pm72.c
index e88cfb3..8330215 100644
--- a/drivers/macintosh/windfarm_pm72.c
+++ b/drivers/macintosh/windfarm_pm72.c
@@ -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) {
diff --git a/drivers/macintosh/windfarm_pm81.c b/drivers/macintosh/windfarm_pm81.c
index 93faf29..d9ea455 100644
--- a/drivers/macintosh/windfarm_pm81.c
+++ b/drivers/macintosh/windfarm_pm81.c
@@ -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 */
diff --git a/drivers/macintosh/windfarm_pm91.c b/drivers/macintosh/windfarm_pm91.c
index 81fdf40..7fd73dc 100644
--- a/drivers/macintosh/windfarm_pm91.c
+++ b/drivers/macintosh/windfarm_pm91.c
@@ -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 */
diff --git a/drivers/macintosh/windfarm_rm31.c b/drivers/macintosh/windfarm_rm31.c
index a0cd9c7..9ce87cc 100644
--- a/drivers/macintosh/windfarm_rm31.c
+++ b/drivers/macintosh/windfarm_rm31.c
@@ -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) {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: macintosh: change some data types from int to bool
  2018-01-24  1:42 [PATCH] macintosh: change some data types from int to bool Gustavo A. R. Silva
@ 2018-01-29  4:13 ` Michael Ellerman
  2018-01-29 11:09   ` Gustavo A. R. Silva
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2018-01-29  4:13 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Colin Leroy, Benjamin Herrenschmidt
  Cc: Gustavo A. R. Silva, linuxppc-dev, linux-kernel

On Wed, 2018-01-24 at 01:42:28 UTC, "Gustavo A. R. Silva" wrote:
> 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>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/4f256d561447c6e1bf8b70e19daae0

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: macintosh: change some data types from int to bool
  2018-01-29  4:13 ` Michael Ellerman
@ 2018-01-29 11:09   ` Gustavo A. R. Silva
  2018-01-29 23:18     ` Michael Ellerman
  0 siblings, 1 reply; 5+ messages in thread
From: Gustavo A. R. Silva @ 2018-01-29 11:09 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Gustavo A. R. Silva, Colin Leroy, Benjamin Herrenschmidt,
	linuxppc-dev, linux-kernel

Hi Michael,

Quoting Michael Ellerman <patch-notifications@ellerman.id.au>:

> On Wed, 2018-01-24 at 01:42:28 UTC, "Gustavo A. R. Silva" wrote:
>> 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>
>
> Applied to powerpc next, thanks.
>
> https://git.kernel.org/powerpc/c/4f256d561447c6e1bf8b70e19daae0
>
> cheers

Awesome.

If I can help out with anything else, please let me know.

Thank you
--
Gustavo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: macintosh: change some data types from int to bool
  2018-01-29 11:09   ` Gustavo A. R. Silva
@ 2018-01-29 23:18     ` Michael Ellerman
  2018-02-03 12:11       ` Gustavo A. R. Silva
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2018-01-29 23:18 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Michael Ellerman
  Cc: Colin Leroy, linuxppc-dev, linux-kernel, Gustavo A. R. Silva

"Gustavo A. R. Silva" <garsilva@embeddedor.com> writes:

> Hi Michael,
>
> Quoting Michael Ellerman <patch-notifications@ellerman.id.au>:
>
>> On Wed, 2018-01-24 at 01:42:28 UTC, "Gustavo A. R. Silva" wrote:
>>> 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>
>>
>> Applied to powerpc next, thanks.
>>
>> https://git.kernel.org/powerpc/c/4f256d561447c6e1bf8b70e19daae0
>>
>> cheers
>
> Awesome.
>
> If I can help out with anything else, please let me know.

Sure thing.

We have a TODO list of sorts on github, some of them are easy, some are
not, feel free to ask here or on an individual issue for help:

  https://github.com/linuxppc/linux/issues

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: macintosh: change some data types from int to bool
  2018-01-29 23:18     ` Michael Ellerman
@ 2018-02-03 12:11       ` Gustavo A. R. Silva
  0 siblings, 0 replies; 5+ messages in thread
From: Gustavo A. R. Silva @ 2018-02-03 12:11 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Michael Ellerman, Colin Leroy, linuxppc-dev, linux-kernel,
	Gustavo A. R. Silva

Hi Michael,

Quoting Michael Ellerman <mpe@ellerman.id.au>:

> "Gustavo A. R. Silva" <garsilva@embeddedor.com> writes:
>
>> Hi Michael,
>>
>> Quoting Michael Ellerman <patch-notifications@ellerman.id.au>:
>>
>>> On Wed, 2018-01-24 at 01:42:28 UTC, "Gustavo A. R. Silva" wrote:
>>>> 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>
>>>
>>> Applied to powerpc next, thanks.
>>>
>>> https://git.kernel.org/powerpc/c/4f256d561447c6e1bf8b70e19daae0
>>>
>>> cheers
>>
>> Awesome.
>>
>> If I can help out with anything else, please let me know.
>
> Sure thing.
>
> We have a TODO list of sorts on github, some of them are easy, some are
> not, feel free to ask here or on an individual issue for help:
>
>   https://github.com/linuxppc/linux/issues
>

I'm sorry for the late reply. I was addressing some issues on DRM and  
NET components.

I already took a look into the TODO list. I'll ask you about some of  
the issues on github.

Thanks!
--
Gustavo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-03 12:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-24  1:42 [PATCH] macintosh: change some data types from int to bool Gustavo A. R. Silva
2018-01-29  4:13 ` Michael Ellerman
2018-01-29 11:09   ` Gustavo A. R. Silva
2018-01-29 23:18     ` Michael Ellerman
2018-02-03 12:11       ` Gustavo A. R. Silva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).