[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_3FA290FB5E6F27C37304AEA91143DC0F5408@qq.com>
Date: Tue, 22 Apr 2025 19:32:19 +0800
From: xiaopeitux@...mail.com
To: xiaopeitux@...mail.com
Cc: andriy.shevchenko@...ux.intel.com,
john.g.garry@...cle.com,
linux-kernel@...r.kernel.org,
robh@...nel.org,
xiaopei01@...inos.cn,
xuwei5@...ilicon.com
Subject: [PATCH 3/3 V2] lib: logic_pio: Add detailed comments for find_io_range() and logic_pio_trans_cpuaddr()
From: Pei Xiao <xiaopei01@...inos.cn>
Add comments that we were previously overlooked for find_io_range()
and logic_pio_trans_cpuaddr().
Signed-off-by: Pei Xiao <xiaopei01@...inos.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
Powered by blists - more mailing lists