* [PATCH] i2c: pcf8584: Make pcf_doAddress() function void
@ 2025-10-22 1:54 Cezar Chiru
2025-10-23 10:53 ` Andi Shyti
0 siblings, 1 reply; 2+ messages in thread
From: Cezar Chiru @ 2025-10-22 1:54 UTC (permalink / raw)
To: andi.shyti, wsa+renesas; +Cc: linux-i2c, linux-kernel, Cezar Chiru
Change pcf_doAddress() function's type from int to void as it is always
returns 0. This way there is no need for extra assignment and extra checks
when the function is called.
Remove assignment of pcf_doAddress() and replace it with a simple function
call.
Signed-off-by: Cezar Chiru <chiru.cezar.89@gmail.com>
---
drivers/i2c/algos/i2c-algo-pcf.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-pcf.c
index d1b0e55fd871..7e4a6d19494b 100644
--- a/drivers/i2c/algos/i2c-algo-pcf.c
+++ b/drivers/i2c/algos/i2c-algo-pcf.c
@@ -253,7 +253,7 @@ static int pcf_readbytes(struct i2c_adapter *i2c_adap, char *buf,
}
-static int pcf_doAddress(struct i2c_algo_pcf_data *adap,
+static void pcf_doAddress(struct i2c_algo_pcf_data *adap,
struct i2c_msg *msg)
{
unsigned char addr = i2c_8bit_addr_from_msg(msg);
@@ -261,8 +261,6 @@ static int pcf_doAddress(struct i2c_algo_pcf_data *adap,
if (msg->flags & I2C_M_REV_DIR_ADDR)
addr ^= 1;
i2c_outb(adap, addr);
-
- return 0;
}
static int pcf_xfer(struct i2c_adapter *i2c_adap,
@@ -288,7 +286,7 @@ static int pcf_xfer(struct i2c_adapter *i2c_adap,
int ret;
pmsg = &msgs[i];
- ret = pcf_doAddress(adap, pmsg);
+ pcf_doAddress(adap, pmsg);
/* Send START */
if (i == 0)
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] i2c: pcf8584: Make pcf_doAddress() function void
2025-10-22 1:54 [PATCH] i2c: pcf8584: Make pcf_doAddress() function void Cezar Chiru
@ 2025-10-23 10:53 ` Andi Shyti
0 siblings, 0 replies; 2+ messages in thread
From: Andi Shyti @ 2025-10-23 10:53 UTC (permalink / raw)
To: Cezar Chiru; +Cc: wsa+renesas, linux-i2c, linux-kernel
Hi Cezar,
thanks for taking care of this.
On Wed, Oct 22, 2025 at 04:54:05AM +0300, Cezar Chiru wrote:
> Change pcf_doAddress() function's type from int to void as it is always
The "is" is not needed.
> returns 0. This way there is no need for extra assignment and extra checks
> when the function is called.
> Remove assignment of pcf_doAddress() and replace it with a simple function
> call.
>
> Signed-off-by: Cezar Chiru <chiru.cezar.89@gmail.com>
It's not that I care much myself, but normally when someone
suggests a change, you should recognize it with "Suggested-by".
Please insert this patch in the same series with your
"[PATCH v8 1/1] i2c: pcf8584: Move 'ret' ... "
patch.
> ---
> drivers/i2c/algos/i2c-algo-pcf.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-pcf.c
> index d1b0e55fd871..7e4a6d19494b 100644
> --- a/drivers/i2c/algos/i2c-algo-pcf.c
> +++ b/drivers/i2c/algos/i2c-algo-pcf.c
> @@ -253,7 +253,7 @@ static int pcf_readbytes(struct i2c_adapter *i2c_adap, char *buf,
> }
>
>
> -static int pcf_doAddress(struct i2c_algo_pcf_data *adap,
> +static void pcf_doAddress(struct i2c_algo_pcf_data *adap,
while you are at this you can use the chance to rename this
function to a more kernel style naming. E.g.:
pcf_send_address()
I would accept it in the same patch, but if you prefer you can
send it as a 3/3 patch. Your choice.
In any case, thanks for these cleanups!
Andi
> struct i2c_msg *msg)
> {
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-23 10:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22 1:54 [PATCH] i2c: pcf8584: Make pcf_doAddress() function void Cezar Chiru
2025-10-23 10:53 ` Andi Shyti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox