Skip to contentSkip to conversation

Small adjustments in drivers/clk/clk.c

PATCH In review Murilo Opsfelder Araujo 2 participants 5 messages May 7, 2015 Common clk

lore
Share & tools
lore
#0 lore raw

cover Small adjustments in drivers/clk/clk.c

The first patch just improves code readability by addig comments after #endif statements; the second one gets rid of a warning message during kernel build.

Murilo Opsfelder Araujo (2):
drivers: clk: clk.c: Add comments indicating the matching #ifdef
blocks
drivers: clk: clk.c: Make clk_is_orphan() dependent of CONFIG_OF

 drivers/clk/clk.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

--
2.1.4

#1 lore raw

PATCH 1/2 drivers: clk: clk.c: Add comments indicating the matching #ifdef blocks

---
 drivers/clk/clk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/clk.c +2 -2
index 087a092..a961eb6 100644
@@ -2226,7 +2226,7 @@ static inline void clk_debug_reparent(struct clk_core *core,
 static inline void clk_debug_unregister(struct clk_core *core)
 {
 }
-#endif
+#endif /* CONFIG_DEBUG_FS */
 
 static bool clk_is_orphan(const struct clk *clk)
 {
@@ -3144,4 +3144,4 @@ void __init of_clk_init(const struct of_device_id *matches)
 			force = true;
 	}
 }
-#endif
+#endif /* CONFIG_OF */
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/2 drivers: clk: clk.c: Make clk_is_orphan() dependent of CONFIG_OF

In reply to Murilo Opsfelder Araujo

The function clk_is_orphan() is called only by __of_clk_get_from_provider(), which depends on CONFIG_OF, so it does make sense the move.

This change also gets rid of the following build message when CONFIG_OF is not set:

drivers/clk/clk.c:2231:13: warning: ‘clk_is_orphan’ defined but not used [-Wunused-function]

---
 drivers/clk/clk.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/clk/clk.c +8 -8
index a961eb6..d748aa2 100644
@@ -2228,14 +2228,6 @@ static inline void clk_debug_unregister(struct clk_core *core)
 }
 #endif /* CONFIG_DEBUG_FS */
 
-static bool clk_is_orphan(const struct clk *clk)
-{
-	if (!clk)
-		return false;
-
-	return clk->core->orphan;
-}
-
 /**
  * __clk_init - initialize the data structures in a struct clk
  * @dev:	device initializing this clk, placeholder for now
@@ -2950,6 +2942,14 @@ void of_clk_del_provider(struct device_node *np)
 }
 EXPORT_SYMBOL_GPL(of_clk_del_provider);
 
+static bool clk_is_orphan(const struct clk *clk)
+{
+	if (!clk)
+		return false;
+
+	return clk->core->orphan;
+}
+
 struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec,
 				       const char *dev_id, const char *con_id)
 {
Signature · 1 line
2.1.4
#3 lore raw

Re: [PATCH 2/2] drivers: clk: clk.c: Make clk_is_orphan() dependent of CONFIG_OF

Quoted 10 lines · Murilo Opsfelder Araujo

The function clk_is_orphan() is called only by __of_clk_get_from_provider(), which depends on CONFIG_OF, so it does make sense the move.

This change also gets rid of the following build message when CONFIG_OF is not set:

drivers/clk/clk.c:2231:13: warning: ‘clk_is_orphan’ defined but not used [-Wunused-function]

The patch that introduces this problem is gone now.

Quoted 38 lines
---
 drivers/clk/clk.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/clk/clk.c +8 -8
index a961eb6..d748aa2 100644
@@ -2228,14 +2228,6 @@ static inline void clk_debug_unregister(struct clk_core *core)
 }
 #endif /* CONFIG_DEBUG_FS */
 
-static bool clk_is_orphan(const struct clk *clk)
-{
-	if (!clk)
-		return false;
-
-	return clk->core->orphan;
-}
-
 /**
  * __clk_init - initialize the data structures in a struct clk
  * @dev:	device initializing this clk, placeholder for now
@@ -2950,6 +2942,14 @@ void of_clk_del_provider(struct device_node *np)
 }
 EXPORT_SYMBOL_GPL(of_clk_del_provider);
 
+static bool clk_is_orphan(const struct clk *clk)
+{
+	if (!clk)
+		return false;
+
+	return clk->core->orphan;
+}
+
 struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec,
 				       const char *dev_id, const char *con_id)
 {
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#4 lore raw

Re: [PATCH 2/2] drivers: clk: clk.c: Make clk_is_orphan() dependent of CONFIG_OF

Quoted 9 lines · Stephen Boyd
Quoted 8 lines · Murilo Opsfelder Araujo

The function clk_is_orphan() is called only by __of_clk_get_from_provider(), which depends on CONFIG_OF, so it does make sense the move.

This change also gets rid of the following build message when CONFIG_OF is not set:

drivers/clk/clk.c:2231:13: warning: =E2=80=98clk_is_orphan=E2=80=99 defi=

ned but not used [-Wunused-function]

Quoted 5 lines
Quoted 2 lines

The patch that introduces this problem is gone now.

Nice to know it is gone. I'm using next-20150506 which still contains that. Probably the fix will land a next -next release.

Thanks, Stephen.

--=20
Murilo