drivers/mfd/menf21bmc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
Inline the i2c_check_functionality() check, since the function returns a
boolean status rather than an error code.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/mfd/menf21bmc.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/menf21bmc.c b/drivers/mfd/menf21bmc.c
index 1d36095155e0..0f24de516d72 100644
--- a/drivers/mfd/menf21bmc.c
+++ b/drivers/mfd/menf21bmc.c
@@ -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);
On Tue, 28 Apr 2026 18:58:01 +0200, Thorsten Blum wrote:
> 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 [李琼斯]
On Tue, 28 Apr 2026, Thorsten Blum wrote: > 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. > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> > --- > drivers/mfd/menf21bmc.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/mfd/menf21bmc.c b/drivers/mfd/menf21bmc.c > index 1d36095155e0..0f24de516d72 100644 > --- a/drivers/mfd/menf21bmc.c > +++ b/drivers/mfd/menf21bmc.c > @@ -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); -- Lee Jones
Hi Lee, On Thu, May 07, 2026 at 02:47:08PM +0100, Lee Jones wrote: > On Tue, 28 Apr 2026, Thorsten Blum wrote: > > > 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/20260421161607.61314-3-thorsten.blum@linux.dev/ 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
© 2016 - 2026 Red Hat, Inc.