From: Cezar Chiru <chiru.cezar.89@gmail.com>
To: andi.shyti@kernel.org, wsa+renesas@sang-engineering.com
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
Cezar Chiru <chiru.cezar.89@gmail.com>
Subject: [PATCH v9 2/3] i2c: pcf8584: Make pcf_doAddress() function void
Date: Thu, 23 Oct 2025 15:00:42 +0300 [thread overview]
Message-ID: <20251023120043.8661-3-chiru.cezar.89@gmail.com> (raw)
In-Reply-To: <20251023120043.8661-1-chiru.cezar.89@gmail.com>
Change pcf_doAddress() function's type from int to void as it 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>
Suggested-by: Andi Shyti <andi.shyti@kernel.org>
---
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 06b9fd355bff..6352314e48ed 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
next prev parent reply other threads:[~2025-10-23 12:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-23 12:00 [PATCH v9 0/3] Improve usage of 'ret' variable and make pcf_doAdress() void Cezar Chiru
2025-10-23 12:00 ` [PATCH v9 1/3] i2c: pcf8584: Move 'ret' variable inside for loop, goto out if ret < 0 Cezar Chiru
2025-10-23 18:34 ` Andy Shevchenko
2025-10-24 10:57 ` Andi Shyti
2025-10-24 13:55 ` Cezar Chiru
2025-10-27 16:28 ` Andi Shyti
2025-10-23 12:00 ` Cezar Chiru [this message]
2025-10-23 12:00 ` [PATCH v9 3/3] i2c: pcf8584: Change pcf_doAdress() to pcf_send_address() Cezar Chiru
2025-10-28 17:39 ` [PATCH v9 0/3] Improve usage of 'ret' variable and make pcf_doAdress() void Andi Shyti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251023120043.8661-3-chiru.cezar.89@gmail.com \
--to=chiru.cezar.89@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox