Skip to contentSkip to conversation

mfd: menf21bmc: inline i2c_check_functionality check

PATCH Applied Thorsten Blum 2 participants 4 messages Apr 28 – May 14

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: menf21bmc: inline i2c_check_functionality check

Inline the i2c_check_functionality() check, since the function returns a boolean status rather than an error code.

---
 drivers/mfd/menf21bmc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/mfd/menf21bmc.c +3 -5
index 1d36095155e0..0f24de516d72 100644
@@ -54,11 +54,9 @@ menf21bmc_probe(struct i2c_client *client)
 	int rev_major, rev_minor, rev_main;
 	int ret;
 
-	ret = i2c_check_functionality(client->adapter,
-				      I2C_FUNC_SMBUS_BYTE_DATA |
-				      I2C_FUNC_SMBUS_WORD_DATA |
-				      I2C_FUNC_SMBUS_BYTE);
-	if (!ret)
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA |
+						      I2C_FUNC_SMBUS_WORD_DATA |
+						      I2C_FUNC_SMBUS_BYTE))
 		return -ENODEV;
 
 	rev_major = i2c_smbus_read_word_data(client, BMC_CMD_REV_MAJOR);
maintainer
#1 lore raw
Quoted 2 lines · Thorsten Blum

Inline the i2c_check_functionality() check, since the function returns a boolean status rather than an error code.

This my well be a personal thing, but I don't generally like functions being stuffed into if () statements. So this one is a no I'm afraid. Please leave it as it is.

Quoted 24 lines
---
 drivers/mfd/menf21bmc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/mfd/menf21bmc.c +3 -5
index 1d36095155e0..0f24de516d72 100644
@@ -54,11 +54,9 @@ menf21bmc_probe(struct i2c_client *client)
 	int rev_major, rev_minor, rev_main;
 	int ret;
 
-	ret = i2c_check_functionality(client->adapter,
-				      I2C_FUNC_SMBUS_BYTE_DATA |
-				      I2C_FUNC_SMBUS_WORD_DATA |
-				      I2C_FUNC_SMBUS_BYTE);
-	if (!ret)
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA |
+						      I2C_FUNC_SMBUS_WORD_DATA |
+						      I2C_FUNC_SMBUS_BYTE))
 		return -ENODEV;
 
 	rev_major = i2c_smbus_read_word_data(client, BMC_CMD_REV_MAJOR);
Signature · 1 line
Lee Jones
#2 lore raw

Hi Lee,

Quoted 8 lines · Lee Jones
Quoted 2 lines · Thorsten Blum

Inline the i2c_check_functionality() check, since the function returns a boolean status rather than an error code.

This my well be a personal thing, but I don't generally like functions being stuffed into if () statements. So this one is a no I'm afraid. Please leave it as it is.

Wolfram (cc'ed) asked me to change the call sites before applying this patch:

https://lore.kernel.org/lkml/[email protected]/

Also, nearly all i2c_check_functionality() call sites already use it as a boolean value. There are only 2-3 call sites left where it's still used as an int.

Should I send a v2 with a local bool variable, or would you reconsider inlining it?

Thanks,
Thorsten

maintainer Applied
#3 lore raw

Re: (subset) [PATCH] mfd: menf21bmc: inline i2c_check_functionality check

In reply to Thorsten Blum
Quoted 2 lines · Thorsten Blum

Inline the i2c_check_functionality() check, since the function returns a boolean status rather than an error code.

Applied, thanks!

[1/1] mfd: menf21bmc: inline i2c_check_functionality check

      commit: 20a343984ff8daca514325fc208f9f56a4b2d1c0

--
Lee Jones [李琼斯]