mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mfd: menf21bmc: inline i2c_check_functionality check
@ 2026-04-28 16:58 Thorsten Blum
  2026-05-07 13:47 ` Lee Jones
  2026-05-14 13:22 ` (subset) " Lee Jones
  0 siblings, 2 replies; 4+ messages in thread
From: Thorsten Blum @ 2026-04-28 16:58 UTC (permalink / raw)
  To: Andreas Werner, Lee Jones; +Cc: Thorsten Blum, linux-kernel

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);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: menf21bmc: inline i2c_check_functionality check
  2026-04-28 16:58 [PATCH] mfd: menf21bmc: inline i2c_check_functionality check Thorsten Blum
@ 2026-05-07 13:47 ` Lee Jones
  2026-05-07 14:14   ` Thorsten Blum
  2026-05-14 13:22 ` (subset) " Lee Jones
  1 sibling, 1 reply; 4+ messages in thread
From: Lee Jones @ 2026-05-07 13:47 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: Andreas Werner, linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: menf21bmc: inline i2c_check_functionality check
  2026-05-07 13:47 ` Lee Jones
@ 2026-05-07 14:14   ` Thorsten Blum
  0 siblings, 0 replies; 4+ messages in thread
From: Thorsten Blum @ 2026-05-07 14:14 UTC (permalink / raw)
  To: Lee Jones; +Cc: Wolfram Sang, Andreas Werner, linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: (subset) [PATCH] mfd: menf21bmc: inline i2c_check_functionality check
  2026-04-28 16:58 [PATCH] mfd: menf21bmc: inline i2c_check_functionality check Thorsten Blum
  2026-05-07 13:47 ` Lee Jones
@ 2026-05-14 13:22 ` Lee Jones
  1 sibling, 0 replies; 4+ messages in thread
From: Lee Jones @ 2026-05-14 13:22 UTC (permalink / raw)
  To: Andreas Werner, Lee Jones, Thorsten Blum; +Cc: linux-kernel

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 [李琼斯]


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-14 13:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-28 16:58 [PATCH] mfd: menf21bmc: inline i2c_check_functionality check Thorsten Blum
2026-05-07 13:47 ` Lee Jones
2026-05-07 14:14   ` Thorsten Blum
2026-05-14 13:22 ` (subset) " Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®