Skip to contentSkip to conversation

clk: change return type of clk_get_parent_rate from long long to ulong

PATCH Applied Michal Suchanek 3 participants 4 messages Sep 28, 2022 – Oct 19, 2022 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: change return type of clk_get_parent_rate from long long to ulong

All functions getting and setting clock rate use ulong for rate, only clk_get_parent_rate is an exception. Change the return value to match other clock rate funcrions.

Most users directly assign the rate to unsigned long anyway, and the few users that use u64 (not s64) multiply the rate so they may need the extra bits for the result in their use case.

Fixes 4aa78300a0 ("dm: clk: Define clk_get_parent_rate() for clk operations")

---

 drivers/clk/clk-uclass.c | 2 +-
 include/clk.h            | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/clk/clk-uclass.c +1 -1
index b89c77bf79..4678ed43af 100644
@@ -505,7 +505,7 @@ struct clk *clk_get_parent(struct clk *clk)
 	return pclk;
 }
 
-long long clk_get_parent_rate(struct clk *clk)
+ulong clk_get_parent_rate(struct clk *clk)
 {
 	const struct clk_ops *ops;
 	struct clk *pclk;
include/clk.h +2 -2
index 76bb64bb5e..41a8fb3419 100644
@@ -444,7 +444,7 @@ struct clk *clk_get_parent(struct clk *clk);
  *
  * Return: clock rate in Hz, or -ve error code.
  */
-long long clk_get_parent_rate(struct clk *clk);
+ulong clk_get_parent_rate(struct clk *clk);
 
 /**
  * clk_round_rate() - Adjust a rate to the exact rate a clock can provide
@@ -577,7 +577,7 @@ static inline struct clk *clk_get_parent(struct clk *clk)
 	return ERR_PTR(-ENOSYS);
 }
 
-static inline long long clk_get_parent_rate(struct clk *clk)
+static inline ulong clk_get_parent_rate(struct clk *clk)
 {
 	return -ENOSYS;
 }
Signature · 1 line
2.37.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 43 lines · Michal Suchanek

All functions getting and setting clock rate use ulong for rate, only clk_get_parent_rate is an exception. Change the return value to match other clock rate funcrions.

Most users directly assign the rate to unsigned long anyway, and the few users that use u64 (not s64) multiply the rate so they may need the extra bits for the result in their use case.

Fixes 4aa78300a0 ("dm: clk: Define clk_get_parent_rate() for clk operations")

---

  drivers/clk/clk-uclass.c | 2 +-
  include/clk.h            | 4 ++--
  2 files changed, 3 insertions(+), 3 deletions(-)
drivers/clk/clk-uclass.c +1 -1
index b89c77bf79..4678ed43af 100644
@@ -505,7 +505,7 @@ struct clk *clk_get_parent(struct clk *clk)
  	return pclk;
  }
 
-long long clk_get_parent_rate(struct clk *clk)
+ulong clk_get_parent_rate(struct clk *clk)
  {
  	const struct clk_ops *ops;
  	struct clk *pclk;
include/clk.h +1 -1
index 76bb64bb5e..41a8fb3419 100644
@@ -444,7 +444,7 @@ struct clk *clk_get_parent(struct clk *clk);
   *
   * Return: clock rate in Hz, or -ve error code.
   */
-long long clk_get_parent_rate(struct clk *clk);
+ulong clk_get_parent_rate(struct clk *clk);
 
  /**
   * clk_round_rate() - Adjust a rate to the exact rate a clock can provide

include/clk.h static inline struct clk *clk_get_parent(struct clk *clk) · line 583

Quoted 8 lines
include/clk.h +1 -1
@@ -577,7 +577,7 @@ static inline struct clk *clk_get_parent(struct clk *clk)
  	return ERR_PTR(-ENOSYS);
  }
 
-static inline long long clk_get_parent_rate(struct clk *clk)
+static inline ulong clk_get_parent_rate(struct clk *clk)
  {
  	return -ENOSYS;
  }
Reviewed-by on v1 1/1
#2 lore raw
In reply to Michal Suchanek
Quoted 9 lines · Michal Suchanek

All functions getting and setting clock rate use ulong for rate, only clk_get_parent_rate is an exception. Change the return value to match other clock rate funcrions.

Most users directly assign the rate to unsigned long anyway, and the few users that use u64 (not s64) multiply the rate so they may need the extra bits for the result in their use case.

Quoted 7 lines
Fixes 4aa78300a0 ("dm: clk: Define clk_get_parent_rate() for clk operations")

---

 drivers/clk/clk-uclass.c | 2 +-
 include/clk.h            | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
#3 lore raw
In reply to Michal Suchanek
Quoted 9 lines · Michal Suchanek

All functions getting and setting clock rate use ulong for rate, only clk_get_parent_rate is an exception. Change the return value to match other clock rate funcrions.

Most users directly assign the rate to unsigned long anyway, and the few users that use u64 (not s64) multiply the rate so they may need the extra bits for the result in their use case.

[...]

Applied, thanks!

[1/1] clk: change return type of clk_get_parent_rate from long long to ulong

      commit: bf3afe148ecbc34f096c5f08c7168c64159299d9

Best regards,

Signature · 1 line
Sean Anderson <[email protected]>