Skip to contentSkip to conversation

Drivers:iio:dac: Remove unneeded conversion to bool

PATCH Superseded [email protected] 2 participants 2 messages Jan 4, 2018 – Jan 6, 2018 IIO

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Drivers:iio:dac: Remove unneeded conversion to bool

From: Venkat Prashanth B U <[email protected]>

This is a patch to the mcp4725.c file which
fixes the following coccinelle warning:

WARNING: conversion to bool not needed here

Changes since v1:
-----------------
Instead of inadvertent removal of complete statement, only the conversion to bool is removed.

---
 drivers/iio/dac/mcp4725.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/mcp4725.c +1 -1
index afa856d..8b5aad4 100644
@@ -476,7 +476,7 @@ static int mcp4725_probe(struct i2c_client *client,
 		goto err_disable_vref_reg;
 	}
 	pd = (inbuf[0] >> 1) & 0x3;
-	data->powerdown = pd > 0 ? true : false;
+	data->powerdown = pd > 0;
 	data->powerdown_mode = pd ? pd - 1 : 2; /* largest resistor to gnd */
 	data->dac_value = (inbuf[1] << 4) | (inbuf[2] >> 4);
 	if (data->id == MCP4726)
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 9 lines · On Thu, 4 Jan 2018 21:49:07 +0530 [email protected] wrote:

From: Venkat Prashanth B U <[email protected]>

This is a patch to the mcp4725.c file which
fixes the following coccinelle warning:

WARNING: conversion to bool not needed here

Version log belongs below the --- cut line.
It is very useful when we are reviewing code, but not something we want to have in the git history for ever.

Please send a V3 with that fixed.

Jonathan

Quoted 21 lines

Changes since v1:
-----------------
Instead of inadvertent removal of complete statement, only the conversion to bool is removed.

---
 drivers/iio/dac/mcp4725.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/mcp4725.c +1 -1
index afa856d..8b5aad4 100644
@@ -476,7 +476,7 @@ static int mcp4725_probe(struct i2c_client *client,
 		goto err_disable_vref_reg;
 	}
 	pd = (inbuf[0] >> 1) & 0x3;
-	data->powerdown = pd > 0 ? true : false;
+	data->powerdown = pd > 0;
 	data->powerdown_mode = pd ? pd - 1 : 2; /* largest resistor to gnd */
 	data->dac_value = (inbuf[1] << 4) | (inbuf[2] >> 4);
 	if (data->id == MCP4726)