Skip to contentSkip to conversation

i2c: change return type to bool for i2c_check_functionality

PATCH RESEND In review Thorsten Blum 4 participants 6 messages Apr 21 – Jun 6

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

PATCH RESEND 1/1 i2c: change return type to bool for i2c_check_functionality

i2c_check_functionality() returns a bool - change the return type from int to bool and update the comment accordingly.

---
 include/linux/i2c.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/i2c.h +2 -2
index 20fd41b51d5c..6737bcbc5d7a 100644
@@ -919,8 +919,8 @@ static inline u32 i2c_get_functionality(struct i2c_adapter *adap)
 	return adap->algo->functionality(adap);
 }
 
-/* Return 1 if adapter supports everything we need, 0 if not. */
-static inline int i2c_check_functionality(struct i2c_adapter *adap, u32 func)
+/* Return true if adapter supports everything we need, false if not. */
+static inline bool i2c_check_functionality(struct i2c_adapter *adap, u32 func)
 {
 	return (func & i2c_get_functionality(adap)) == func;
 }
Acked-by on v1 1/1
#1 lore raw
Quoted 14 lines · Thorsten Blum

i2c_check_functionality() returns a bool - change the return type from int to bool and update the comment accordingly.

---
  include/linux/i2c.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/i2c.h +0 -0
index 20fd41b51d5c..6737bcbc5d7a 100644

include/linux/i2c.h static inline u32 i2c_get_functionality(struct i2c_adapter *adap) · line 926

Quoted 10 lines
include/linux/i2c.h +2 -2
@@ -919,8 +919,8 @@ static inline u32 i2c_get_functionality(struct i2c_adapter *adap)
  	return adap->algo->functionality(adap);
  }
 
-/* Return 1 if adapter supports everything we need, 0 if not. */
-static inline int i2c_check_functionality(struct i2c_adapter *adap, u32 func)
+/* Return true if adapter supports everything we need, false if not. */
+static inline bool i2c_check_functionality(struct i2c_adapter *adap, u32 func)
  {
  	return (func & i2c_get_functionality(adap)) == func;
  }
#2 lore raw
In reply to Thorsten Blum
Quoted 4 lines · Thorsten Blum

i2c_check_functionality() returns a bool - change the return type from int to bool and update the comment accordingly.

Basically OK but you need to fix the in-tree user first using the 'int' behaviour [1]. I'd think you can send it with this patch as one series and have it go in via the I2C tree, but Lee has to agree then.

[1] $ git grep 'i2c_check_functionality.*='

#3 lore raw

Hi Wolfram,

Quoted 11 lines · Wolfram Sang
Quoted 4 lines · Thorsten Blum

i2c_check_functionality() returns a bool - change the return type from int to bool and update the comment accordingly.

Basically OK but you need to fix the in-tree user first using the 'int' behaviour [1]. I'd think you can send it with this patch as one series and have it go in via the I2C tree, but Lee has to agree then.

[1] $ git grep 'i2c_check_functionality.*='

In linux-next [1] shows no more results and I believe all have been converted.

Thanks,
Thorsten

#4 lore raw

Le 06/06/2026 à 23:29, Thorsten Blum a écrit :

Quoted 14 lines

Hi Wolfram,

Quoted 11 lines · Wolfram Sang
Quoted 4 lines · Thorsten Blum

i2c_check_functionality() returns a bool - change the return type from int to bool and update the comment accordingly.

Basically OK but you need to fix the in-tree user first using the 'int' behaviour [1]. I'd think you can send it with this patch as one series and have it go in via the I2C tree, but Lee has to agree then.

[1] $ git grep 'i2c_check_functionality.*='

I think it should be git grep '=.*i2c_check_functionality'.

Quoted 3 lines

In linux-next [1] shows no more results and I believe all have been converted.

Looks like:
drivers/gpu/drm/bridge/sii902x.c: ret =
i2c_check_functionality(client->adapter,
drivers/media/i2c/isl7998x.c: ret =
i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA);

need care.

CJ

Quoted 5 lines

Thanks,
Thorsten

#5 lore raw
Quoted 22 lines · Christophe JAILLET

Le 06/06/2026 à 23:29, Thorsten Blum a écrit :

Quoted 14 lines

Hi Wolfram,

Quoted 11 lines · Wolfram Sang
Quoted 4 lines · Thorsten Blum

i2c_check_functionality() returns a bool - change the return type from int to bool and update the comment accordingly.

Basically OK but you need to fix the in-tree user first using the 'int' behaviour [1]. I'd think you can send it with this patch as one series and have it go in via the I2C tree, but Lee has to agree then.

[1] $ git grep 'i2c_check_functionality.*='

I think it should be git grep '=.*i2c_check_functionality'.

Quoted 3 lines

In linux-next [1] shows no more results and I believe all have been converted.

Quoted 7 lines

Looks like:
drivers/gpu/drm/bridge/sii902x.c: ret =
i2c_check_functionality(client->adapter,
drivers/media/i2c/isl7998x.c: ret = i2c_check_functionality(adapter,
I2C_FUNC_SMBUS_WORD_DATA);

need care.

Those have also been taken care of with some Reviewed-by: tags, but they aren't in linux-next yet:

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

And the conversions are not strictly necessary since 0 == false.

Thanks,
Thorsten