Skip to contentSkip to conversation

clean up in tegra clk

PATCH Applied Pei Xiao 3 participants 7 messages Jul 9, 2025 – Jul 24, 2025

Subsystems (3)
lore
Share & tools
lore

Pei Xiao

author
#0 lore raw

cover clean up in tegra clk

1.Fix error handling and resolve unsigned compare
2.Make tegra_clk_periph_ops static

Pei Xiao (2):
clk: tegra: periph: Fix error handling and resolve unsigned compare
warning
clk: tegra: periph: Make tegra_clk_periph_ops static

 drivers/clk/tegra/clk-periph.c | 6 +++---
 drivers/clk/tegra/clk.h        | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 1/2 clk: tegra: periph: Fix error handling and resolve unsigned compare warning

./drivers/clk/tegra/clk-periph.c:59:5-9: WARNING:
Unsigned expression compared with zero: rate < 0

The unsigned long 'rate' variable caused:
- Incorrect handling of negative errors
- Compile warning: "Unsigned expression compared with zero"

Fix by changing to long type and adding req->rate cast.

---
 drivers/clk/tegra/clk-periph.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-periph.c +2 -2
index 0626650a7011..c9fc52a36fce 100644
@@ -51,7 +51,7 @@ static int clk_periph_determine_rate(struct clk_hw *hw,
 	struct tegra_clk_periph *periph = to_clk_periph(hw);
 	const struct clk_ops *div_ops = periph->div_ops;
 	struct clk_hw *div_hw = &periph->divider.hw;
-	unsigned long rate;
+	long rate;
 
 	__clk_hw_set_clk(div_hw, hw);
 
@@ -59,7 +59,7 @@ static int clk_periph_determine_rate(struct clk_hw *hw,
 	if (rate < 0)
 		return rate;
 
-	req->rate = rate;
+	req->rate = (unsigned long)rate;
 	return 0;
 }
 
Signature · 1 line
2.25.1
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] clk: tegra: periph: Fix error handling and resolve unsigned compare warning

Quoted 7 lines · Pei Xiao

./drivers/clk/tegra/clk-periph.c:59:5-9: WARNING:
Unsigned expression compared with zero: rate < 0

The unsigned long 'rate' variable caused:
- Incorrect handling of negative errors
- Compile warning: "Unsigned expression compared with zero"

Quoted 6 lines

Fix by changing to long type and adding req->rate cast.

---
 drivers/clk/tegra/clk-periph.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
maintainer Applied
#3 lore raw

Re: [PATCH 1/2] clk: tegra: periph: Fix error handling and resolve unsigned compare warning

In reply to Pei Xiao

Quoting Pei Xiao (2025-07-09 00:37:13)

Quoted 11 lines

./drivers/clk/tegra/clk-periph.c:59:5-9: WARNING:
Unsigned expression compared with zero: rate < 0

The unsigned long 'rate' variable caused:
- Incorrect handling of negative errors
- Compile warning: "Unsigned expression compared with zero"

Fix by changing to long type and adding req->rate cast.

---

Applied to clk-next

author
#4 lore raw

PATCH 2/2 clk: tegra: periph: Make tegra_clk_periph_ops static

In reply to Pei Xiao

Reduce symbol visibility by converting tegra_clk_periph_ops to static. Removed the extern declaration from clk.h as the symbol is now locally scoped to clk-periph.c.

---
 drivers/clk/tegra/clk-periph.c | 2 +-
 drivers/clk/tegra/clk.h        | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/clk/tegra/clk-periph.c +1 -1
index c9fc52a36fce..fa0cd7bb8ee6 100644
@@ -132,7 +132,7 @@ static void clk_periph_restore_context(struct clk_hw *hw)
 	clk_periph_set_parent(hw, parent_id);
 }
 
-const struct clk_ops tegra_clk_periph_ops = {
+static const struct clk_ops tegra_clk_periph_ops = {
 	.get_parent = clk_periph_get_parent,
 	.set_parent = clk_periph_set_parent,
 	.recalc_rate = clk_periph_recalc_rate,
drivers/clk/tegra/clk.h +0 -1
index 5d80d8b79b8e..9ea839af14bc 100644
@@ -629,7 +629,6 @@ struct tegra_clk_periph {
 
 #define TEGRA_CLK_PERIPH_MAGIC 0x18221223
 
-extern const struct clk_ops tegra_clk_periph_ops;
 struct clk *tegra_clk_register_periph(const char *name,
 		const char * const *parent_names, int num_parents,
 		struct tegra_clk_periph *periph, void __iomem *clk_base,
Signature · 1 line
2.25.1
Acked-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] clk: tegra: periph: Make tegra_clk_periph_ops static

Quoted 9 lines · Pei Xiao

Reduce symbol visibility by converting tegra_clk_periph_ops to static. Removed the extern declaration from clk.h as the symbol is now locally scoped to clk-periph.c.

---
 drivers/clk/tegra/clk-periph.c | 2 +-
 drivers/clk/tegra/clk.h        | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
maintainer Applied
#6 lore raw

Re: [PATCH 2/2] clk: tegra: periph: Make tegra_clk_periph_ops static

In reply to Pei Xiao

Quoting Pei Xiao (2025-07-09 00:37:14)

Quoted 6 lines

Reduce symbol visibility by converting tegra_clk_periph_ops to static. Removed the extern declaration from clk.h as the symbol is now locally scoped to clk-periph.c.

---

Applied to clk-next