From: Cosmin Tanislav <demonsingur@gmail.com>
Cc: Romain Gantois <romain.gantois@bootlin.com>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
Cosmin Tanislav <demonsingur@gmail.com>
Subject: [PATCH v2 3/9] i2c: atr: find_mapping() -> get_mapping()
Date: Tue, 25 Feb 2025 13:39:31 +0200 [thread overview]
Message-ID: <20250225113939.49811-4-demonsingur@gmail.com> (raw)
In-Reply-To: <20250225113939.49811-1-demonsingur@gmail.com>
A find operation implies that a null result is not an error.
Use get naming to clarify things and to prepare for splitting up the
logic inside this function.
Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com>
---
drivers/i2c/i2c-atr.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/i2c-atr.c b/drivers/i2c/i2c-atr.c
index f6033c99f474..f2485d1670a2 100644
--- a/drivers/i2c/i2c-atr.c
+++ b/drivers/i2c/i2c-atr.c
@@ -241,7 +241,7 @@ static void i2c_atr_release_alias(struct i2c_atr_alias_pool *alias_pool, u16 ali
/* Must be called with alias_pairs_lock held */
static struct i2c_atr_alias_pair *
-i2c_atr_find_mapping_by_addr(struct i2c_atr_chan *chan, u16 addr)
+i2c_atr_get_mapping_by_addr(struct i2c_atr_chan *chan, u16 addr)
{
struct i2c_atr *atr = chan->atr;
struct i2c_atr_alias_pair *c2a;
@@ -335,7 +335,7 @@ static int i2c_atr_map_msgs(struct i2c_atr_chan *chan, struct i2c_msg *msgs,
for (i = 0; i < num; i++) {
chan->orig_addrs[i] = msgs[i].addr;
- c2a = i2c_atr_find_mapping_by_addr(chan, msgs[i].addr);
+ c2a = i2c_atr_get_mapping_by_addr(chan, msgs[i].addr);
if (!c2a) {
dev_err(atr->dev, "client 0x%02x not mapped!\n",
@@ -428,7 +428,7 @@ static int i2c_atr_smbus_xfer(struct i2c_adapter *adap, u16 addr,
mutex_lock(&chan->alias_pairs_lock);
- c2a = i2c_atr_find_mapping_by_addr(chan, addr);
+ c2a = i2c_atr_get_mapping_by_addr(chan, addr);
if (!c2a) {
dev_err(atr->dev, "client 0x%02x not mapped!\n", addr);
@@ -536,7 +536,7 @@ static void i2c_atr_detach_addr(struct i2c_adapter *adapter,
mutex_lock(&chan->alias_pairs_lock);
- c2a = i2c_atr_find_mapping_by_addr(chan, addr);
+ c2a = i2c_atr_get_mapping_by_addr(chan, addr);
if (!c2a) {
/* This should never happen */
dev_warn(atr->dev, "Unable to find address mapping\n");
--
2.48.1
next prev parent reply other threads:[~2025-02-25 11:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 11:39 [PATCH v2 0/9] i2c: atr: allow usage of nested ATRs Cosmin Tanislav
2025-02-25 11:39 ` [PATCH v2 1/9] i2c: atr: Fix lockdep for " Cosmin Tanislav
2025-02-25 11:39 ` [PATCH v2 2/9] i2c: atr: unlock mutex after c2a access Cosmin Tanislav
2025-02-27 10:43 ` Romain Gantois
2025-02-25 11:39 ` Cosmin Tanislav [this message]
2025-02-27 13:25 ` [PATCH v2 3/9] i2c: atr: find_mapping() -> get_mapping() Romain Gantois
2025-02-25 11:39 ` [PATCH v2 4/9] i2c: atr: split up i2c_atr_get_mapping_by_addr() Cosmin Tanislav
2025-02-27 13:29 ` Romain Gantois
2025-02-27 13:43 ` Romain Gantois
2025-02-25 11:39 ` [PATCH v2 5/9] i2c: atr: do not create mapping in detach_addr() Cosmin Tanislav
2025-02-27 13:33 ` Romain Gantois
2025-02-25 11:39 ` [PATCH v2 6/9] i2c: atr: deduplicate logic in attach_addr() Cosmin Tanislav
2025-02-27 13:36 ` Romain Gantois
2025-02-28 12:22 ` Cosmin Tanislav
2025-02-25 11:39 ` [PATCH v2 7/9] i2c: atr: allow replacing mappings " Cosmin Tanislav
2025-02-25 11:39 ` [PATCH v2 8/9] i2c: atr: add static flag Cosmin Tanislav
2025-02-27 13:58 ` Romain Gantois
2025-02-25 11:39 ` [PATCH v2 9/9] i2c: atr: add passthrough flag Cosmin Tanislav
2025-02-27 14:03 ` Romain Gantois
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=20250225113939.49811-4-demonsingur@gmail.com \
--to=demonsingur@gmail.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=romain.gantois@bootlin.com \
--cc=tomi.valkeinen@ideasonboard.com \
--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