Linux I2C development
 help / color / mirror / Atom feed
* [PATCH RESEND] i2c: change return type to bool for i2c_check_functionality
@ 2026-04-21 16:16 Thorsten Blum
  2026-04-22 12:29 ` Mukesh Savaliya
  2026-05-04  9:15 ` Wolfram Sang
  0 siblings, 2 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-04-21 16:16 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Thorsten Blum, linux-i2c, linux-kernel

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

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 include/linux/i2c.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 20fd41b51d5c..6737bcbc5d7a 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -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;
 }

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

* Re: [PATCH RESEND] i2c: change return type to bool for i2c_check_functionality
  2026-04-21 16:16 [PATCH RESEND] i2c: change return type to bool for i2c_check_functionality Thorsten Blum
@ 2026-04-22 12:29 ` Mukesh Savaliya
  2026-05-04  9:15 ` Wolfram Sang
  1 sibling, 0 replies; 6+ messages in thread
From: Mukesh Savaliya @ 2026-04-22 12:29 UTC (permalink / raw)
  To: Thorsten Blum, Wolfram Sang; +Cc: linux-i2c, linux-kernel



On 4/21/2026 9:46 PM, Thorsten Blum wrote:
> i2c_check_functionality() returns a bool - change the return type from
> int to bool and update the comment accordingly.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>   include/linux/i2c.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> index 20fd41b51d5c..6737bcbc5d7a 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -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: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>

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

* Re: [PATCH RESEND] i2c: change return type to bool for i2c_check_functionality
  2026-04-21 16:16 [PATCH RESEND] i2c: change return type to bool for i2c_check_functionality Thorsten Blum
  2026-04-22 12:29 ` Mukesh Savaliya
@ 2026-05-04  9:15 ` Wolfram Sang
  2026-06-06 21:29   ` Thorsten Blum
  1 sibling, 1 reply; 6+ messages in thread
From: Wolfram Sang @ 2026-05-04  9:15 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 511 bytes --]

On Tue, Apr 21, 2026 at 06:16:09PM +0200, Thorsten Blum wrote:
> i2c_check_functionality() returns a bool - change the return type from
> int to bool and update the comment accordingly.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

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.*='


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH RESEND] i2c: change return type to bool for i2c_check_functionality
  2026-05-04  9:15 ` Wolfram Sang
@ 2026-06-06 21:29   ` Thorsten Blum
  2026-06-06 21:58     ` Christophe JAILLET
  0 siblings, 1 reply; 6+ messages in thread
From: Thorsten Blum @ 2026-06-06 21:29 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-kernel

Hi Wolfram,

On Mon, May 04, 2026 at 11:15:19AM +0200, Wolfram Sang wrote:
> On Tue, Apr 21, 2026 at 06:16:09PM +0200, Thorsten Blum wrote:
> > i2c_check_functionality() returns a bool - change the return type from
> > int to bool and update the comment accordingly.
> > 
> > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> 
> 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

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

* Re: [PATCH RESEND] i2c: change return type to bool for i2c_check_functionality
  2026-06-06 21:29   ` Thorsten Blum
@ 2026-06-06 21:58     ` Christophe JAILLET
  2026-06-06 22:12       ` Thorsten Blum
  0 siblings, 1 reply; 6+ messages in thread
From: Christophe JAILLET @ 2026-06-06 21:58 UTC (permalink / raw)
  To: Thorsten Blum, Wolfram Sang; +Cc: linux-i2c, linux-kernel

Le 06/06/2026 à 23:29, Thorsten Blum a écrit :
> Hi Wolfram,
> 
> On Mon, May 04, 2026 at 11:15:19AM +0200, Wolfram Sang wrote:
>> On Tue, Apr 21, 2026 at 06:16:09PM +0200, Thorsten Blum wrote:
>>> i2c_check_functionality() returns a bool - change the return type from
>>> int to bool and update the comment accordingly.
>>>
>>> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
>>
>> 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'.

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

> 
> Thanks,
> Thorsten
> 
> 


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

* Re: [PATCH RESEND] i2c: change return type to bool for i2c_check_functionality
  2026-06-06 21:58     ` Christophe JAILLET
@ 2026-06-06 22:12       ` Thorsten Blum
  0 siblings, 0 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-06-06 22:12 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: Wolfram Sang, linux-i2c, linux-kernel

On Sat, Jun 06, 2026 at 11:58:03PM +0200, Christophe JAILLET wrote:
> Le 06/06/2026 à 23:29, Thorsten Blum a écrit :
> > Hi Wolfram,
> > 
> > On Mon, May 04, 2026 at 11:15:19AM +0200, Wolfram Sang wrote:
> > > On Tue, Apr 21, 2026 at 06:16:09PM +0200, Thorsten Blum wrote:
> > > > i2c_check_functionality() returns a bool - change the return type from
> > > > int to bool and update the comment accordingly.
> > > > 
> > > > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> > > 
> > > 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'.
> 
> > 
> > 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.

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/20260517172136.3321-2-thorsten.blum@linux.dev/
https://lore.kernel.org/lkml/20260517172034.3033-2-thorsten.blum@linux.dev/

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

Thanks,
Thorsten

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

end of thread, other threads:[~2026-06-06 22:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-21 16:16 [PATCH RESEND] i2c: change return type to bool for i2c_check_functionality Thorsten Blum
2026-04-22 12:29 ` Mukesh Savaliya
2026-05-04  9:15 ` Wolfram Sang
2026-06-06 21:29   ` Thorsten Blum
2026-06-06 21:58     ` Christophe JAILLET
2026-06-06 22:12       ` Thorsten Blum

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