clean up in tegra clk
Subsystems (3)
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
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
@@ -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
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 < 0The 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->ratecast.Signed-off-by Pei Xiao <[email protected]>--- drivers/clk/tegra/clk-periph.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Re: [PATCH 1/2] clk: tegra: periph: Fix error handling and resolve unsigned compare warning
In reply to Pei XiaoQuoting 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 < 0The 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->ratecast.Signed-off-by Pei Xiao <[email protected]>---
Applied to clk-next
PATCH 2/2 clk: tegra: periph: Make tegra_clk_periph_ops static
In reply to Pei XiaoReduce 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
@@ -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
@@ -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
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_opsto static. Removed the extern declaration fromclk.has the symbol is now locally scoped toclk-periph.c.Signed-off-by Pei Xiao <[email protected]>--- drivers/clk/tegra/clk-periph.c | 2 +- drivers/clk/tegra/clk.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
Re: [PATCH 2/2] clk: tegra: periph: Make tegra_clk_periph_ops static
In reply to Pei XiaoQuoting Pei Xiao (2025-07-09 00:37:14)
Quoted 6 lines
Reduce symbol visibility by converting
tegra_clk_periph_opsto static. Removed the extern declaration fromclk.has the symbol is now locally scoped toclk-periph.c.Signed-off-by Pei Xiao <[email protected]>---
Applied to clk-next