mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] clk: change clk_get_num_parents into clk_hw_get_num_parents
@ 2022-01-14  6:59 Ahmad Fatoum
  2022-01-14  6:59 ` [PATCH 2/2] clk: propagate error pointers in clk_hw_to_clk and clk_to_clk_hw Ahmad Fatoum
  2022-01-14  8:26 ` [PATCH 1/2] clk: change clk_get_num_parents into clk_hw_get_num_parents Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2022-01-14  6:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

There is no clk_get_num_parents in Linux, but clk_hw_get_num_parents.
Our only users uses it with a clk_hw, so adjust the function
accordingly.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 drivers/clk/at91/clk-generated.c | 2 +-
 include/linux/clk.h              | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c
index 628ff407d91e..e639fb3a1a65 100644
--- a/drivers/clk/at91/clk-generated.c
+++ b/drivers/clk/at91/clk-generated.c
@@ -92,7 +92,7 @@ static int clk_generated_set_parent(struct clk_hw *hw, u8 index)
 {
 	struct clk_generated *gck = to_clk_generated(hw);
 
-	if (index >= clk_get_num_parents(clk_hw_to_clk(hw)))
+	if (index >= clk_hw_get_num_parents(hw))
 		return -EINVAL;
 
 	gck->parent_id = index;
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 6565429a9b9f..481c28871258 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -721,9 +721,9 @@ int of_clk_add_provider(struct device_node *np,
 						   void *data),
 			void *data);
 
-static inline unsigned int clk_get_num_parents(const struct clk *hw)
+static inline unsigned int clk_hw_get_num_parents(const struct clk_hw *hw)
 {
-	return hw->num_parents;
+	return hw->clk.num_parents;
 }
 
 #else
-- 
2.33.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* [PATCH 2/2] clk: propagate error pointers in clk_hw_to_clk and clk_to_clk_hw
  2022-01-14  6:59 [PATCH 1/2] clk: change clk_get_num_parents into clk_hw_get_num_parents Ahmad Fatoum
@ 2022-01-14  6:59 ` Ahmad Fatoum
  2022-01-14  8:26 ` [PATCH 1/2] clk: change clk_get_num_parents into clk_hw_get_num_parents Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2022-01-14  6:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

This will make porting helpers easier, because it's harder to miss
error checking.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 include/linux/clk.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/clk.h b/include/linux/clk.h
index 481c28871258..ffc1ac8489b0 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -432,12 +432,12 @@ struct clk_hw {
 
 static inline struct clk *clk_hw_to_clk(struct clk_hw *hw)
 {
-	return &hw->clk;
+	return IS_ERR(hw) ? ERR_CAST(hw) : &hw->clk;
 }
 
 static inline struct clk_hw *clk_to_clk_hw(struct clk *clk)
 {
-	return container_of(clk, struct clk_hw, clk);
+	return IS_ERR(clk) ? ERR_CAST(clk) : container_of(clk, struct clk_hw, clk);
 }
 
 struct clk_div_table {
-- 
2.33.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* Re: [PATCH 1/2] clk: change clk_get_num_parents into clk_hw_get_num_parents
  2022-01-14  6:59 [PATCH 1/2] clk: change clk_get_num_parents into clk_hw_get_num_parents Ahmad Fatoum
  2022-01-14  6:59 ` [PATCH 2/2] clk: propagate error pointers in clk_hw_to_clk and clk_to_clk_hw Ahmad Fatoum
@ 2022-01-14  8:26 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2022-01-14  8:26 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Fri, Jan 14, 2022 at 07:59:52AM +0100, Ahmad Fatoum wrote:
> There is no clk_get_num_parents in Linux, but clk_hw_get_num_parents.
> Our only users uses it with a clk_hw, so adjust the function
> accordingly.
> 
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
>  drivers/clk/at91/clk-generated.c | 2 +-
>  include/linux/clk.h              | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

end of thread, other threads:[~2022-01-14  8:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14  6:59 [PATCH 1/2] clk: change clk_get_num_parents into clk_hw_get_num_parents Ahmad Fatoum
2022-01-14  6:59 ` [PATCH 2/2] clk: propagate error pointers in clk_hw_to_clk and clk_to_clk_hw Ahmad Fatoum
2022-01-14  8:26 ` [PATCH 1/2] clk: change clk_get_num_parents into clk_hw_get_num_parents Sascha Hauer

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git