[PATCH] logic_pio: Add detailed comments for find_io_range() and logic_pio_trans_cpuaddr()

xiaopeitux@foxmail.com posted 1 patch 8 months, 3 weeks ago
lib/logic_pio.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
[PATCH] logic_pio: Add detailed comments for find_io_range() and logic_pio_trans_cpuaddr()
Posted by xiaopeitux@foxmail.com 8 months, 3 weeks ago
From: Pei Xiao <xiaopei01@kylinos.cn>

As a library file, every function should have comments,so add
comments for any functions that were previously overlooked.

Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
 lib/logic_pio.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/logic_pio.c b/lib/logic_pio.c
index e29496a38d06..3a49f424acc0 100644
--- a/lib/logic_pio.c
+++ b/lib/logic_pio.c
@@ -138,7 +138,15 @@ struct logic_pio_hwaddr *find_io_range_by_fwnode(const struct fwnode_handle *fwn
 	return found_range;
 }
 
-/* Return a registered range given an input PIO token */
+/**
+ * find_io_range - find a registered range by PIO
+ * @pio: logical PIO value
+ *
+ * Return a registered range, NULL otherwise.
+ *
+ * Traverse the io_range_list to find the registered node for @pio.
+ * The input PIO should be unique in the whole logical PIO space.
+ */
 static struct logic_pio_hwaddr *find_io_range(unsigned long pio)
 {
 	struct logic_pio_hwaddr *range, *found_range = NULL;
@@ -204,6 +212,12 @@ unsigned long logic_pio_trans_hwaddr(const struct fwnode_handle *fwnode,
 	return addr - range->hw_start + range->io_start;
 }
 
+/**
+ * logic_pio_trans_cpuaddr - translate CPU address to logical PIO
+ * @addr: Host-relative CPU address
+ *
+ * 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