linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: add function documentation for clk_hw_round_rate()
@ 2020-06-10 15:17 Sarang Mairal
  2020-06-11  1:08 ` Stephen Boyd
  2020-06-11  2:19 ` Sarang Mairal
  0 siblings, 2 replies; 5+ messages in thread
From: Sarang Mairal @ 2020-06-10 15:17 UTC (permalink / raw)
  To: sboyd, mturquette, linux-clk; +Cc: Sarang Mairal

Information about usage and prerequisites for this API.

Signed-off-by: Sarang Mairal <sarangmairal@gmail.com>
---
 drivers/clk/clk.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 407f6919604c..9cb9bc67a165 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: add function documentation for clk_hw_round_rate()
  2020-06-10 15:17 [PATCH] clk: add function documentation for clk_hw_round_rate() Sarang Mairal
@ 2020-06-11  1:08 ` Stephen Boyd
  2020-06-11  2:19 ` Sarang Mairal
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2020-06-11  1:08 UTC (permalink / raw)
  To: Sarang Mairal, linux-clk, mturquette; +Cc: Sarang Mairal

Quoting Sarang Mairal (2020-06-10 08:17:44)
> Information about usage and prerequisites for this API.
> 
> Signed-off-by: Sarang Mairal <sarangmairal@gmail.com>
> ---
>  drivers/clk/clk.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 407f6919604c..9cb9bc67a165 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -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.

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

> + */
>  unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate)
>  {
>         int ret;

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: add function documentation for clk_hw_round_rate()
  2020-06-10 15:17 [PATCH] clk: add function documentation for clk_hw_round_rate() Sarang Mairal
  2020-06-11  1:08 ` Stephen Boyd
@ 2020-06-11  2:19 ` Sarang Mairal
  2020-06-11  2:19   ` [PATCH v2] " Sarang Mairal
  1 sibling, 1 reply; 5+ messages in thread
From: Sarang Mairal @ 2020-06-11  2:19 UTC (permalink / raw)
  To: sboyd, mturquette, linux-clk; +Cc: Sarang Mairal

> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] clk: add function documentation for clk_hw_round_rate()
  2020-06-11  2:19 ` Sarang Mairal
@ 2020-06-11  2:19   ` Sarang Mairal
  2020-06-22  9:11     ` Stephen Boyd
  0 siblings, 1 reply; 5+ messages in thread
From: Sarang Mairal @ 2020-06-11  2:19 UTC (permalink / raw)
  To: sboyd, mturquette, linux-clk; +Cc: Sarang Mairal

Information about usage and prerequisites for this API.

Signed-off-by: Sarang Mairal <sarangmairal@gmail.com>
---
 drivers/clk/clk.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 407f6919604c..da3182404934 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] clk: add function documentation for clk_hw_round_rate()
  2020-06-11  2:19   ` [PATCH v2] " Sarang Mairal
@ 2020-06-22  9:11     ` Stephen Boyd
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2020-06-22  9:11 UTC (permalink / raw)
  To: Sarang Mairal, linux-clk, mturquette; +Cc: Sarang Mairal

Quoting Sarang Mairal (2020-06-10 19:19:41)
> Information about usage and prerequisites for this API.
> 
> Signed-off-by: Sarang Mairal <sarangmairal@gmail.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-22  9:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10 15:17 [PATCH] clk: add function documentation for clk_hw_round_rate() Sarang Mairal
2020-06-11  1:08 ` Stephen Boyd
2020-06-11  2:19 ` Sarang Mairal
2020-06-11  2:19   ` [PATCH v2] " Sarang Mairal
2020-06-22  9:11     ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).