Skip to contentSkip to conversation

clk: add function documentation for clk_hw_round_rate()

PATCH Superseded Sarang Mairal 2 participants 5 messages Jun 10, 2020 – Jun 22, 2020 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: add function documentation for clk_hw_round_rate()

Information about usage and prerequisites for this API.

---
 drivers/clk/clk.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/clk/clk.c +13 -0
index 407f6919604c..9cb9bc67a165 100644
@@ -1400,6 +1400,19 @@ int __clk_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
 }
 EXPORT_SYMBOL_GPL(__clk_determine_rate);
 
+/**
+ * clk_hw_round_rate - round the given rate for a hw clk
+ * @hw: the hw clk for which we are rounding a rate
+ * @rate: the rate which is to be rounded
+ *
+ * Takes in a rate as input and rounds it to a rate that the clk can actually
+ * use which is then returned. If clk doesn't support round_rate operation
+ * then the parent rate is returned.
+ *
+ * Useful for clk providers to call from within clk_ops such as .round_rate,
+ * .determine_rate. Requires prepare_lock to be held before calling this
+ * function.
+ */
 unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate)
 {
 	int ret;
Signature · 1 line
2.17.1
maintainer
#1 lore raw

Quoting Sarang Mairal (2020-06-10 08:17:44)

Quoted 17 lines

Information about usage and prerequisites for this API.

---
 drivers/clk/clk.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/clk/clk.c +2 -0
index 407f6919604c..9cb9bc67a165 100644
@@ -1400,6 +1400,19 @@ int __clk_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
 }
 EXPORT_SYMBOL_GPL(__clk_determine_rate);
 
+/**
+ * clk_hw_round_rate - round the given rate for a hw clk

drivers/clk/clk.c int __clk_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) · line 1414

Quoted 10 lines
drivers/clk/clk.c +10 -0
+ * @hw: the hw clk for which we are rounding a rate
+ * @rate: the rate which is to be rounded
+ *
+ * Takes in a rate as input and rounds it to a rate that the clk can actually
+ * use which is then returned. If clk doesn't support round_rate operation
+ * then the parent rate is returned.
+ *
+ * Useful for clk providers to call from within clk_ops such as .round_rate,
+ * .determine_rate. Requires prepare_lock to be held before calling this
+ * function.

I think we can use the 'Return:' and the 'Context:' sections in kernel-doc[1]. Can you reword using those please?

drivers/clk/clk.c int __clk_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) · line 1418

Quoted 4 lines
drivers/clk/clk.c +1 -0
+ */
 unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate)
 {
        int ret;

[1] Documentation/doc-guide/kernel-doc.rst

#2 lore raw
In reply to Sarang Mairal
Quoted 2 lines

I think we can use the 'Return:' and the 'Context:' sections in kernel-doc[1]. Can you reword using those please?

Yes, nice suggestion! Thanks.

Hopefully v2 addresses your expectation.

-Regards,
Sarang.

#3 lore raw

PATCH v2 1/1 clk: add function documentation for clk_hw_round_rate()

Information about usage and prerequisites for this API.

---
 drivers/clk/clk.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/clk/clk.c +15 -0
index 407f6919604c..da3182404934 100644
@@ -1400,6 +1400,21 @@ int __clk_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
 }
 EXPORT_SYMBOL_GPL(__clk_determine_rate);
 
+/**
+ * clk_hw_round_rate() - round the given rate for a hw clk
+ * @hw: the hw clk for which we are rounding a rate
+ * @rate: the rate which is to be rounded
+ *
+ * Takes in a rate as input and rounds it to a rate that the clk can actually
+ * use.
+ *
+ * Context: prepare_lock must be held.
+ *          For clk providers to call from within clk_ops such as .round_rate,
+ *          .determine_rate.
+ *
+ * Return: returns rounded rate of hw clk if clk supports round_rate operation
+ *         else returns the parent rate.
+ */
 unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate)
 {
 	int ret;
Signature · 1 line
2.17.1