Skip to contentSkip to conversation

clk: declare clk_core_reparent_orphans() inline

PATCH Superseded Olof Johansson 2 participants 6 messages Dec 17, 2019 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: declare clk_core_reparent_orphans() inline

A recent addition exposed a helper that is only used for CONFIG_OF. Instead of figuring out best place to have it in the order of various functions, just declare it as explicitly inline, and the compiler will happily handle it without warning.

(Also fixup of a single stray empty line while I was looking at the code)

Fixes 66d9506440bb ("clk: walk orphan list on clock provider registration")
---
 drivers/clk/clk.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/clk.c +1 -2
index ae2795b30e060..dc1e6481f6b33 100644
@@ -3277,7 +3277,7 @@ static void clk_core_reparent_orphans_nolock(void)
 	}
 }
 
-static void clk_core_reparent_orphans(void)
+static void __maybe_unused clk_core_reparent_orphans(void)
 {
 	clk_prepare_lock();
 	clk_core_reparent_orphans_nolock();
@@ -3442,7 +3442,6 @@ static int __clk_core_init(struct clk_core *core)
 
 	clk_core_reparent_orphans_nolock();
 
-
 	kref_init(&core->ref);
 out:
 	clk_pm_runtime_put(core);
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 1/1 clk: declare clk_core_reparent_orphans() inline

A recent addition exposed a helper that is only used for CONFIG_OF. Instead of figuring out best place to have it in the order of various functions, just declare it as explicitly inline, and the compiler will happily handle it without warning.

(Also fixup of a single stray empty line while I was looking at the code)

Fixes 66d9506440bb ("clk: walk orphan list on clock provider registration")

---

v2: Forgot to amend when I switched from __maybe_unused to inline. Use either version, your choice.

 drivers/clk/clk.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/clk.c +1 -2
index ae2795b30e060..dc1e6481f6b33 100644
@@ -3277,7 +3277,7 @@ static void clk_core_reparent_orphans_nolock(void)
 	}
 }
 
-static void clk_core_reparent_orphans(void)
+static void __maybe_unused clk_core_reparent_orphans(void)
 {
 	clk_prepare_lock();
 	clk_core_reparent_orphans_nolock();
@@ -3442,7 +3442,6 @@ static int __clk_core_init(struct clk_core *core)
 
 	clk_core_reparent_orphans_nolock();
 
-
 	kref_init(&core->ref);
 out:
 	clk_pm_runtime_put(core);
Signature · 1 line
2.11.0
#2 lore raw

PATCH v3 1/1 clk: declare clk_core_reparent_orphans() inline

In reply to Olof Johansson

A recent addition exposed a helper that is only used for CONFIG_OF. Instead of figuring out best place to have it in the order of various functions, just declare it as explicitly inline, and the compiler will happily handle it without warning.

(Also fixup of a single stray empty line while I was looking at the code)

Fixes 66d9506440bb ("clk: walk orphan list on clock provider registration")

---

v3: ACTUALLY amend this time. Sigh. Time to go home.

 drivers/clk/clk.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/clk.c +1 -2
index ae2795b30e060..2b0f54b6af9d5 100644
@@ -3277,7 +3277,7 @@ static void clk_core_reparent_orphans_nolock(void)
 	}
 }
 
-static void clk_core_reparent_orphans(void)
+static void inline clk_core_reparent_orphans(void)
 {
 	clk_prepare_lock();
 	clk_core_reparent_orphans_nolock();
@@ -3442,7 +3442,6 @@ static int __clk_core_init(struct clk_core *core)
 
 	clk_core_reparent_orphans_nolock();
 
-
 	kref_init(&core->ref);
 out:
 	clk_pm_runtime_put(core);
Signature · 1 line
2.11.0
maintainer
#3 lore raw

Quoting Olof Johansson (2019-12-16 20:46:35)

Quoted 5 lines

A recent addition exposed a helper that is only used for CONFIG_OF. Instead of figuring out best place to have it in the order of various functions, just declare it as explicitly inline, and the compiler will happily handle it without warning.

Quoted 8 lines

(Also fixup of a single stray empty line while I was looking at the code)

Fixes 66d9506440bb ("clk: walk orphan list on clock provider registration")

---

v3: ACTUALLY amend this time. Sigh. Time to go home.

Isn't it simple enough to just move the function down to CONFIG_OF in drivers/clk/clk.c?

----8<----

drivers/clk/clk.c +7 -7
index ae2795b30e06..6a11239ccde3 100644
@@ -3277,13 +3277,6 @@ static void clk_core_reparent_orphans_nolock(void)
 	}
 }
 
-static void clk_core_reparent_orphans(void)
-{
-	clk_prepare_lock();
-	clk_core_reparent_orphans_nolock();
-	clk_prepare_unlock();
-}
-
 /**
  * __clk_core_init - initialize the data structures in a struct clk_core
  * @core:	clk_core being initialized
@@ -4193,6 +4186,13 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb)
 EXPORT_SYMBOL_GPL(clk_notifier_unregister);
 
 #ifdef CONFIG_OF
+static void clk_core_reparent_orphans(void)
+{
+	clk_prepare_lock();
+	clk_core_reparent_orphans_nolock();
+	clk_prepare_unlock();
+}
+
 /**
  * struct of_clk_provider - Clock provider registration structure
  * @link: Entry in global list of clock providers
#4 lore raw
Quoted 13 lines · Stephen Boyd

Quoting Olof Johansson (2019-12-16 20:46:35)

Quoted 11 lines

A recent addition exposed a helper that is only used for CONFIG_OF. Instead of figuring out best place to have it in the order of various functions, just declare it as explicitly inline, and the compiler will happily handle it without warning.

(Also fixup of a single stray empty line while I was looking at the code)

Fixes 66d9506440bb ("clk: walk orphan list on clock provider registration")

---

Quoted 5 lines
Quoted 2 lines

v3: ACTUALLY amend this time. Sigh. Time to go home.

Isn't it simple enough to just move the function down to CONFIG_OF in drivers/clk/clk.c?

"Simple" in a 5000 line file is maybe not the right word to use, but yeah, sure, do with it what you want.

Seems like clk.c could do with some refactoring? :)

-Olof

maintainer
#5 lore raw

Quoting Olof Johansson (2019-12-17 10:01:15)

Quoted 17 lines · Stephen Boyd
Quoted 16 lines

Quoting Olof Johansson (2019-12-16 20:46:35)

Quoted 13 lines

A recent addition exposed a helper that is only used for CONFIG_OF. Instead of figuring out best place to have it in the order of various functions, just declare it as explicitly inline, and the compiler will happily handle it without warning.

(Also fixup of a single stray empty line while I was looking at the code)

Fixes 66d9506440bb ("clk: walk orphan list on clock provider registration")

---

v3: ACTUALLY amend this time. Sigh. Time to go home.

Quoted 8 lines
Quoted 2 lines

Isn't it simple enough to just move the function down to CONFIG_OF in drivers/clk/clk.c?

"Simple" in a 5000 line file is maybe not the right word to use, but yeah, sure, do with it what you want.

Seems like clk.c could do with some refactoring? :)

Ok.