Skip to contentSkip to conversation

drivers/macintosh: Use true for boolean value

PATCH In review Gustavo A. R. Silva 3 participants 4 messages Jan 23, 2018 – Jan 24, 2018 Linux for power macintosh

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/macintosh: Use true for boolean value

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

---
 drivers/macintosh/windfarm_pm72.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/windfarm_pm72.c +1 -1
index e88cfb3..8330215 100644
@@ -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) {
Signature · 1 line
2.7.4
#1 lore raw
Quoted 8 lines · Gustavo A. R. Silva

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

---
 drivers/macintosh/windfarm_pm72.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

This seems to be common across all those drivers. Can you please send one patch to fix them all to use bool:

  $ git grep "started = " drivers/macintosh/
  drivers/macintosh/therm_adt746x.c:              int started = 0;
  drivers/macintosh/therm_adt746x.c:                      started = 1;
  drivers/macintosh/windfarm_pm112.c:             slots_started = 1;
  drivers/macintosh/windfarm_pm112.c:             started = 1;
  drivers/macintosh/windfarm_pm121.c:             pm121_started = 1;
  drivers/macintosh/windfarm_pm72.c:              started = 1;
  drivers/macintosh/windfarm_pm81.c:              wf_smu_started = 1;
  drivers/macintosh/windfarm_pm91.c:              wf_smu_started = 1;
  drivers/macintosh/windfarm_rm31.c:              started = 1;

cheers

#2 lore raw

Quoting Michael Ellerman <[email protected]>:

Quoted 25 lines
Quoted 8 lines · Gustavo A. R. Silva

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

---
 drivers/macintosh/windfarm_pm72.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

This seems to be common across all those drivers. Can you please send one patch to fix them all to use bool:

  $ git grep "started = " drivers/macintosh/
  drivers/macintosh/therm_adt746x.c:              int started = 0;
  drivers/macintosh/therm_adt746x.c:                      started = 1;
  drivers/macintosh/windfarm_pm112.c:             slots_started = 1;
  drivers/macintosh/windfarm_pm112.c:             started = 1;
  drivers/macintosh/windfarm_pm121.c:             pm121_started = 1;
  drivers/macintosh/windfarm_pm72.c:              started = 1;
  drivers/macintosh/windfarm_pm81.c:              wf_smu_started = 1;
  drivers/macintosh/windfarm_pm91.c:              wf_smu_started = 1;
  drivers/macintosh/windfarm_rm31.c:              started = 1;
Quoted 1 line

cheers

Sure, no problem.

By the way, I've just found the following similar case:

drivers/macintosh/ams/ams-input.c +2 -2
@@ -91,7 +91,7 @@ static int ams_input_enable(void)
 		return error;
 	}
 
-	joystick = 1;
+	joystick = true;
 
 	return 0;
 }
@@ -104,7 +104,7 @@ static void ams_input_disable(void)
 		ams_info.idev = NULL;
 	}
 
-	joystick = 0;
+	joystick = false;
 }
 

Do you want me to include them all in the same patch?

Thanks
--
Gustavo

#3 lore raw

Quoting "Gustavo A. R. Silva" <[email protected]>:

Quoted 52 lines

Quoting Michael Ellerman <[email protected]>:

Quoted 25 lines
Quoted 8 lines · Gustavo A. R. Silva

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

---
drivers/macintosh/windfarm_pm72.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

This seems to be common across all those drivers. Can you please send one patch to fix them all to use bool:

 $ git grep "started = " drivers/macintosh/
 drivers/macintosh/therm_adt746x.c:              int started = 0;
 drivers/macintosh/therm_adt746x.c:                      started = 1;
 drivers/macintosh/windfarm_pm112.c:             slots_started = 1;
 drivers/macintosh/windfarm_pm112.c:             started = 1;
 drivers/macintosh/windfarm_pm121.c:             pm121_started = 1;
 drivers/macintosh/windfarm_pm72.c:              started = 1;
 drivers/macintosh/windfarm_pm81.c:              wf_smu_started = 1;
 drivers/macintosh/windfarm_pm91.c:              wf_smu_started = 1;
 drivers/macintosh/windfarm_rm31.c:              started = 1;
Quoted 1 line

cheers

Sure, no problem.

By the way, I've just found the following similar case:

drivers/macintosh/ams/ams-input.c +2 -2
@@ -91,7 +91,7 @@ static int ams_input_enable(void)
 		return error;
 	}
 
-	joystick = 1;
+	joystick = true;
 
 	return 0;
 }
@@ -104,7 +104,7 @@ static void ams_input_disable(void)
 		ams_info.idev = NULL;
 	}
 
-	joystick = 0;
+	joystick = false;
 }
 
Quoted 2 lines

Do you want me to include them all in the same patch?

I sent separate patches for this.

Thanks
--
Gustavo