clk: sifive: Fix W=1 kernel build warning
Subsystems (3)
PATCH v4 1/1 clk: sifive: Fix W=1 kernel build warning
This commit reverts commit 487dc7bb6a0c ("clk: sifive: fu540-prci:
Declare static const variable 'prci_clk_fu540' where it's used"). For fixing W=1 kernel build warning(s) about ‘prci_clk_fu540’ defined but not used [-Wunused-const-variable=], the problem is that the C file of fu540 and fu740 doesn't use these variables, but they include the header files. We could refine the code by moving the definition of these variables into fu540 and fu740 implementation respectively instead of common core code, then we could still separate the SoCs-dependent data in their own implementation.
---
Changed in v4:
- Rebase on v5.16
- Modify fixes tag
Changed in v3:
- Rebase on v5.16-rc8
- Add fixes tag
Changed in v2:
- Move definition of variable to C file from header
--- drivers/clk/sifive/fu540-prci.c | 6 +++++- drivers/clk/sifive/fu540-prci.h | 6 +----- drivers/clk/sifive/fu740-prci.c | 6 +++++- drivers/clk/sifive/fu740-prci.h | 11 +---------- drivers/clk/sifive/sifive-prci.c | 5 ----- 5 files changed, 12 insertions(+), 22 deletions(-)
drivers/clk/sifive/fu540-prci.c +5 -1
@@ -20,7 +20,6 @@#include <dt-bindings/clock/sifive-fu540-prci.h> -#include "fu540-prci.h" #include "sifive-prci.h" /* PRCI integration data for each WRPLL instance */
@@ -87,3 +86,8 @@ struct __prci_clock __prci_init_clocks_fu540[] = { .ops = &sifive_fu540_prci_tlclksel_clk_ops, }, }; + +struct prci_clk_desc prci_clk_fu540 = { + .clks = __prci_init_clocks_fu540, + .num_clks =ARRAY_SIZE (__prci_init_clocks_fu540), +};
drivers/clk/sifive/fu540-prci.h +1 -5
@@ -7,10 +7,6 @@#ifndef __SIFIVE_CLK_FU540_PRCI_H#define __SIFIVE_CLK_FU540_PRCI_H -#include "sifive-prci.h" - -#define NUM_CLOCK_FU540 4 - -extern struct __prci_clock __prci_init_clocks_fu540[NUM_CLOCK_FU540 ]; +extern struct prci_clk_desc prci_clk_fu540;#endif /* __SIFIVE_CLK_FU540_PRCI_H */
drivers/clk/sifive/fu740-prci.c +5 -1
@@ -8,7 +8,6 @@#include <dt-bindings/clock/sifive-fu740-prci.h> -#include "fu540-prci.h" #include "sifive-prci.h" /* PRCI integration data for each WRPLL instance */
@@ -132,3 +131,8 @@ struct __prci_clock __prci_init_clocks_fu740[] = { .ops = &sifive_fu740_prci_pcie_aux_clk_ops, }, }; + +struct prci_clk_desc prci_clk_fu740 = { + .clks = __prci_init_clocks_fu740, + .num_clks =ARRAY_SIZE (__prci_init_clocks_fu740), +};
drivers/clk/sifive/fu740-prci.h +1 -10
@@ -7,15 +7,6 @@#ifndef __SIFIVE_CLK_FU740_PRCI_H#define __SIFIVE_CLK_FU740_PRCI_H -#include "sifive-prci.h" - -#define NUM_CLOCK_FU740 9 - -extern struct __prci_clock __prci_init_clocks_fu740[NUM_CLOCK_FU740 ]; - -static const struct prci_clk_desc prci_clk_fu740 = { - .clks = __prci_init_clocks_fu740, - .num_clks =ARRAY_SIZE (__prci_init_clocks_fu740), -}; +extern struct prci_clk_desc prci_clk_fu740;#endif /* __SIFIVE_CLK_FU740_PRCI_H */
drivers/clk/sifive/sifive-prci.c +0 -5
@@ -12,11 +12,6 @@#include "fu540-prci.h" #include "fu740-prci.h" -static const struct prci_clk_desc prci_clk_fu540 = { - .clks = __prci_init_clocks_fu540, - .num_clks =ARRAY_SIZE (__prci_init_clocks_fu540), -}; -/* * Private functions */
Signature · 1 line
2.31.1
Quoted 11 lines · Zong Li
This commit reverts commit
487dc7bb6a0c("clk: sifive: fu540-prci:
Declare static const variable 'prci_clk_fu540' where it's used"). For fixing W=1 kernel build warning(s) about ‘prci_clk_fu540’ defined but not used [-Wunused-const-variable=], the problem is that the C file of fu540 and fu740 doesn't use these variables, but they include the header files. We could refine the code by moving the definition of these variables into fu540 and fu740 implementation respectively instead of common core code, then we could still separate the SoCs-dependent data in their own implementation.Fixes 487dc7bb6a0c ("clk: sifive: fu540-prci: Declare static const variable 'prci_clk_fu540' where it's used")
Okay, that's good.
My other comments still apply here though.
Quoted 20 lines
Signed-off-by Zong Li <[email protected]>---
Changed in v4:
- Rebase on v5.16
- Modify fixes tagChanged in v3:
- Rebase on v5.16-rc8
- Add fixes tagChanged in v2:
- Move definition of variable to C file from header--- drivers/clk/sifive/fu540-prci.c | 6 +++++- drivers/clk/sifive/fu540-prci.h | 6 +----- drivers/clk/sifive/fu740-prci.c | 6 +++++- drivers/clk/sifive/fu740-prci.h | 11 +---------- drivers/clk/sifive/sifive-prci.c | 5 ----- 5 files changed, 12 insertions(+), 22 deletions(-)
Signature · 4 lines
Lee Jones [李琼斯] Principal Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog