Skip to contentSkip to conversation

Power: supply: sbs-charger: simplified bool function

PATCH Superseded Daniel Perez 2 participants 2 messages Feb 15, 2017 – Mar 15, 2017 Power supply

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Power: supply: sbs-charger: simplified bool function

v1 -> v2:
- given Joe Perches' comment, I've further simplified the syntax of the bool function, removing the ternary conditional

---
 drivers/power/supply/sbs-charger.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/power/supply/sbs-charger.c +1 -4
index 353765a..15947db 100644
@@ -137,10 +137,7 @@ static enum power_supply_property sbs_properties[] = {
 
 static bool sbs_readable_reg(struct device *dev, unsigned int reg)
 {
-	if (reg < SBS_CHARGER_REG_SPEC_INFO)
-		return false;
-	else
-		return true;
+	return reg >= SBS_CHARGER_REG_SPEC_INFO;
 }
 
 static bool sbs_volatile_reg(struct device *dev, unsigned int reg)
Signature · 1 line
2.7.4
#1 lore raw

Hi Daniel,

Quoted 5 lines · Daniel Perez

v1 -> v2:
- given Joe Perches' comment, I've further simplified the syntax of the bool function, removing the ternary conditional

Thanks, queued. Please move the Version history below ---, so that it does not end up in the commit. I fixed that while applying.

-- Sebastian

Quoted 23 lines
---
 drivers/power/supply/sbs-charger.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/power/supply/sbs-charger.c +1 -4
index 353765a..15947db 100644
@@ -137,10 +137,7 @@ static enum power_supply_property sbs_properties[] = {
 
 static bool sbs_readable_reg(struct device *dev, unsigned int reg)
 {
-	if (reg < SBS_CHARGER_REG_SPEC_INFO)
-		return false;
-	else
-		return true;
+	return reg >= SBS_CHARGER_REG_SPEC_INFO;
 }
 
 static bool sbs_volatile_reg(struct device *dev, unsigned int reg)
Signature · 1 line
2.7.4