* [PATCH v3] staging: sm750fb: Convert sw_i2c_read_sda to return bool
@ 2026-01-14 17:17 Karthikey Kadati
2026-01-15 11:32 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Karthikey Kadati @ 2026-01-14 17:17 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh
Cc: linux-fbdev, linux-staging, linux-kernel, karthikey3608
The sw_i2c_read_sda() function currently returns unsigned char (1 or 0).
Standardize it to return bool (true or false) to match kernel standards.
Signed-off-by: Karthikey Kadati <karthikey3608@gmail.com>
---
v3:
- Add version history (Reported by kernel test robot).
v2:
- Fix invalid "Unix Antigravity" Signed-off-by.
- Submit as standalone patch (detached from unrelated series).
drivers/staging/sm750fb/ddk750_swi2c.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index 0ef8d4ff2..9d48673d3 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -180,7 +180,7 @@ static void sw_i2c_sda(unsigned char value)
* Return Value:
* The SDA data bit sent by the Slave
*/
-static unsigned char sw_i2c_read_sda(void)
+static bool sw_i2c_read_sda(void)
{
unsigned long gpio_dir;
unsigned long gpio_data;
@@ -196,9 +196,9 @@ static unsigned char sw_i2c_read_sda(void)
/* Now read the SDA line */
gpio_data = peek32(sw_i2c_data_gpio_data_reg);
if (gpio_data & (1 << sw_i2c_data_gpio))
- return 1;
+ return true;
else
- return 0;
+ return false;
}
/*
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] staging: sm750fb: Convert sw_i2c_read_sda to return bool
2026-01-14 17:17 [PATCH v3] staging: sm750fb: Convert sw_i2c_read_sda to return bool Karthikey Kadati
@ 2026-01-15 11:32 ` Greg KH
2026-01-15 12:50 ` Karthikey Kadati
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2026-01-15 11:32 UTC (permalink / raw)
To: Karthikey Kadati
Cc: sudipm.mukherjee, teddy.wang, linux-fbdev, linux-staging,
linux-kernel
On Wed, Jan 14, 2026 at 10:47:48PM +0530, Karthikey Kadati wrote:
> The sw_i2c_read_sda() function currently returns unsigned char (1 or 0).
> Standardize it to return bool (true or false) to match kernel standards.
>
> Signed-off-by: Karthikey Kadati <karthikey3608@gmail.com>
> ---
> v3:
> - Add version history (Reported by kernel test robot).
> v2:
> - Fix invalid "Unix Antigravity" Signed-off-by.
> - Submit as standalone patch (detached from unrelated series).
>
> drivers/staging/sm750fb/ddk750_swi2c.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
> index 0ef8d4ff2..9d48673d3 100644
> --- a/drivers/staging/sm750fb/ddk750_swi2c.c
> +++ b/drivers/staging/sm750fb/ddk750_swi2c.c
> @@ -180,7 +180,7 @@ static void sw_i2c_sda(unsigned char value)
> * Return Value:
> * The SDA data bit sent by the Slave
> */
> -static unsigned char sw_i2c_read_sda(void)
> +static bool sw_i2c_read_sda(void)
So how does this call:
data |= (sw_i2c_read_sda() << i);
work with a boolean?
confused,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] staging: sm750fb: Convert sw_i2c_read_sda to return bool
2026-01-15 11:32 ` Greg KH
@ 2026-01-15 12:50 ` Karthikey Kadati
0 siblings, 0 replies; 3+ messages in thread
From: Karthikey Kadati @ 2026-01-15 12:50 UTC (permalink / raw)
To: Greg KH
Cc: sudipm.mukherjee, teddy.wang, linux-fbdev, linux-staging,
linux-kernel
You are right. I overlooked that the return value is used in bitwise
shift operations used to construct the data byte.
Since `sw_i2c_read_sda()` returns a raw data bit (0 or 1) intended for
shifting, `bool` is semantically incorrect here.
I will drop this patch.
Thanks,
Karthikey
On Thu, 15 Jan 2026 at 17:02, Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Wed, Jan 14, 2026 at 10:47:48PM +0530, Karthikey Kadati wrote:
> > The sw_i2c_read_sda() function currently returns unsigned char (1 or 0).
> > Standardize it to return bool (true or false) to match kernel standards.
> >
> > Signed-off-by: Karthikey Kadati <karthikey3608@gmail.com>
> > ---
> > v3:
> > - Add version history (Reported by kernel test robot).
> > v2:
> > - Fix invalid "Unix Antigravity" Signed-off-by.
> > - Submit as standalone patch (detached from unrelated series).
> >
> > drivers/staging/sm750fb/ddk750_swi2c.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
> > index 0ef8d4ff2..9d48673d3 100644
> > --- a/drivers/staging/sm750fb/ddk750_swi2c.c
> > +++ b/drivers/staging/sm750fb/ddk750_swi2c.c
> > @@ -180,7 +180,7 @@ static void sw_i2c_sda(unsigned char value)
> > * Return Value:
> > * The SDA data bit sent by the Slave
> > */
> > -static unsigned char sw_i2c_read_sda(void)
> > +static bool sw_i2c_read_sda(void)
>
> So how does this call:
> data |= (sw_i2c_read_sda() << i);
> work with a boolean?
>
> confused,
>
> greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-15 12:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-14 17:17 [PATCH v3] staging: sm750fb: Convert sw_i2c_read_sda to return bool Karthikey Kadati
2026-01-15 11:32 ` Greg KH
2026-01-15 12:50 ` Karthikey Kadati
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox