Skip to contentSkip to conversation

iio: dac: mcp4725: Remove unneeded conversions to bool

PATCH In review Andrew F. Davis 2 participants 2 messages Dec 5, 2017 – Dec 10, 2017 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: dac: mcp4725: Remove unneeded conversions to bool

Found with scripts/coccinelle/misc/boolconv.cocci.

---
 drivers/iio/dac/mcp4725.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/mcp4725.c +1 -1
index afa856d10c26..8b5aad4c32d9 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
2.15.0
maintainer
#1 lore raw
Quoted 3 lines · On Tue, 5 Dec 2017 13:12:01 -0600 "Andrew F. Davis" <[email protected]> wrote:

Found with scripts/coccinelle/misc/boolconv.cocci.

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

Quoted 17 lines
---
 drivers/iio/dac/mcp4725.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/mcp4725.c +1 -1
index afa856d10c26..8b5aad4c32d9 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)