Skip to contentSkip to conversation

regulator: core: Assign bool value to variable has_full_constraints

PATCH In review Baoquan He 2 participants 5 messages Jul 4, 2016 Voltage and current regulator framework

lore
Share & tools
lore

Baoquan He

author
#0 lore raw

PATCH 1/1 regulator: core: Assign bool value to variable has_full_constraints

In commit 21cf891a (regulator: Make regulator_has_full_constraints a bool) type of variable has_full_constraints is changed to bool, so assign 'true' to has_full_constraints here.

---
 drivers/regulator/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/core.c +1 -1
index ec8184d5..a4f28b5 100644
@@ -4193,7 +4193,7 @@ EXPORT_SYMBOL_GPL(regulator_suspend_finish);
  */
 void regulator_has_full_constraints(void)
 {
-	has_full_constraints = 1;
+	has_full_constraints = true;
 }
 EXPORT_SYMBOL_GPL(regulator_has_full_constraints);
 
Signature · 1 line
2.5.5
maintainer
#1 lore raw
Quoted 3 lines · Baoquan He

In commit 21cf891a (regulator: Make regulator_has_full_constraints a bool) type of variable has_full_constraints is changed to bool, so assign 'true' to has_full_constraints here.

There is no need to make changes like this, C has full support for using integers in a boolean context - using true here would've been just as meaningful with an integer variable and using a number for a boolean variable is fully equivalent.

author
#2 lore raw
Quoted 10 lines · Mark Brown
Quoted 3 lines · Baoquan He

In commit 21cf891a (regulator: Make regulator_has_full_constraints a bool) type of variable has_full_constraints is changed to bool, so assign 'true' to has_full_constraints here.

There is no need to make changes like this, C has full support for using integers in a boolean context - using true here would've been just as meaningful with an integer variable and using a number for a boolean variable is fully equivalent.

Well, I am fine with it. I am just going through pci/acpi initialization code because I lack knowledge on them to fix a amd iommu bug. Trying to post patches when some improvement can be made during this code reading journey. If then, NACK it.

Thanks
Baoquan

author
#3 lore raw
In reply to Mark Brown
Quoted 10 lines · Mark Brown
Quoted 3 lines · Baoquan He

In commit 21cf891a (regulator: Make regulator_has_full_constraints a bool) type of variable has_full_constraints is changed to bool, so assign 'true' to has_full_constraints here.

There is no need to make changes like this, C has full support for using integers in a boolean context - using true here would've been just as meaningful with an integer variable and using a number for a boolean variable is fully equivalent.

By the way, I still think it makes code more read-able to assign a bool value to a bool variable. In your words, C truly has full support for using integers in a boolean context, then commit 21cf891a is not necessary to be made to change.

maintainer
#4 lore raw
Quoted 4 lines · Baoquan He

By the way, I still think it makes code more read-able to assign a bool value to a bool variable. In your words, C truly has full support for using integers in a boolean context, then commit 21cf891a is not necessary to be made to change.

The feedback here is largely about the commit message - it's written like it's fixing a bug but it's really just a stylistic change.