From: xiaopeitux@foxmail.com
To: xiaopeitux@foxmail.com
Cc: andriy.shevchenko@linux.intel.com, john.g.garry@oracle.com,
linux-kernel@vger.kernel.org, robh@kernel.org,
xiaopei01@kylinos.cn, xuwei5@hisilicon.com
Subject: [PATCH 3/3 V2] lib: logic_pio: Add detailed comments for find_io_range() and logic_pio_trans_cpuaddr()
Date: Tue, 22 Apr 2025 19:32:19 +0800 [thread overview]
Message-ID: <tencent_3FA290FB5E6F27C37304AEA91143DC0F5408@qq.com> (raw)
In-Reply-To: <cover.1745320689.git.xiaopei01@kylinos.cn>
From: Pei Xiao <xiaopei01@kylinos.cn>
Add comments that we were previously overlooked for find_io_range()
and logic_pio_trans_cpuaddr().
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
changes in v2: fix returns differ
---
lib/logic_pio.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/lib/logic_pio.c b/lib/logic_pio.c
index db3ad65ccc48..44ba50386714 100644
--- a/lib/logic_pio.c
+++ b/lib/logic_pio.c
@@ -141,7 +141,15 @@ struct logic_pio_hwaddr *find_io_range_by_fwnode(const struct fwnode_handle *fwn
}
EXPORT_SYMBOL(find_io_range_by_fwnode);
-/* Return a registered range given an input PIO token */
+/**
+ * find_io_range - find a registered range by PIO
+ * @pio: logical PIO value
+ *
+ * Traverse the io_range_list to find the registered node for @pio.
+ * The input PIO should be unique in the whole logical PIO space.
+ *
+ * Returns a registered range, NULL otherwise.
+ */
static struct logic_pio_hwaddr *find_io_range(unsigned long pio)
{
struct logic_pio_hwaddr *range, *found_range = NULL;
@@ -209,6 +217,14 @@ unsigned long logic_pio_trans_hwaddr(const struct fwnode_handle *fwnode,
}
EXPORT_SYMBOL(logic_pio_trans_hwaddr);
+/**
+ * logic_pio_trans_cpuaddr - translate CPU address to logical PIO
+ * @addr: Host-relative CPU address
+ *
+ * translate CPU address to logical PIO
+ *
+ * Returns Logical PIO value if successful, ~0UL otherwise
+ */
unsigned long logic_pio_trans_cpuaddr(resource_size_t addr)
{
struct logic_pio_hwaddr *range;
--
2.25.1
next prev parent reply other threads:[~2025-04-22 11:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1745320689.git.xiaopei01@kylinos.cn>
2025-04-22 11:31 ` [PATCH 1/3 V2] bus: hisi_lpc: remove unused head file in hisi_lpc.c xiaopeitux
2025-04-22 15:47 ` Andy Shevchenko
2025-04-23 3:30 ` Pei Xiao
2025-04-22 11:31 ` [PATCH 2/3 V1] lib: logic_pio: export function symbol in logic_pio xiaopeitux
2025-04-22 15:27 ` Andy Shevchenko
2025-04-22 15:30 ` Andy Shevchenko
2025-04-22 16:05 ` John Garry
2025-04-23 3:36 ` Pei Xiao
2025-04-23 7:18 ` John Garry
2025-04-22 11:32 ` xiaopeitux [this message]
2025-04-22 15:47 ` [PATCH 3/3 V2] lib: logic_pio: Add detailed comments for find_io_range() and logic_pio_trans_cpuaddr() Andy Shevchenko
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=tencent_3FA290FB5E6F27C37304AEA91143DC0F5408@qq.com \
--to=xiaopeitux@foxmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=john.g.garry@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=xiaopei01@kylinos.cn \
--cc=xuwei5@hisilicon.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
all inboxes | Powered by JetHome®