linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] clk: qcom: gpucc-sm8350: Fix "initializer element is not constant" error
@ 2022-07-11 17:40 Nathan Chancellor
  2022-07-11 17:42 ` Dmitry Baryshkov
  2022-07-11 20:34 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2022-07-11 17:40 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson
  Cc: Konrad Dybcio, Michael Turquette, Stephen Boyd, Nick Desaulniers,
	Tom Rix, Robert Foss, linux-arm-msm, linux-clk, linux-kernel,
	llvm, Nathan Chancellor, kernel test robot

When building with clang or GCC older than 8, errors along the following
lines occur:

  drivers/clk/qcom/gpucc-sm8350.c:111:2: error: initializer element is not a compile-time constant
          gpu_cc_parent,
          ^~~~~~~~~~~~~
  drivers/clk/qcom/gpucc-sm8350.c:126:2: error: initializer element is not a compile-time constant
          gpu_cc_parent,
          ^~~~~~~~~~~~~
  2 errors generated.

The C standard allows an implementation to accept other forms of
constant expressions, which GCC 8+ has chosen to do, but it is not
required. Just inline the initializer to resolve the error.

Fixes: 160758b05ab1 ("clk: qcom: add support for SM8350 GPUCC")
Link: https://github.com/ClangBuiltLinux/linux/issues/1660
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---

v1 -> v2: https://lore.kernel.org/20220711163021.152578-1-nathan@kernel.org/

* Just inline the initializer, rather than using a macro (Dmitry).

 drivers/clk/qcom/gpucc-sm8350.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/qcom/gpucc-sm8350.c b/drivers/clk/qcom/gpucc-sm8350.c
index d13fa813d190..5367ce654ac9 100644
--- a/drivers/clk/qcom/gpucc-sm8350.c
+++ b/drivers/clk/qcom/gpucc-sm8350.c
@@ -108,7 +108,7 @@ static const struct parent_map gpu_cc_parent_map_0[] = {
 };
 
 static const struct clk_parent_data gpu_cc_parent_data_0[] = {
-	gpu_cc_parent,
+	{ .fw_name = "bi_tcxo" },
 	{ .hw = &gpu_cc_pll0.clkr.hw },
 	{ .hw = &gpu_cc_pll1.clkr.hw },
 	{ .fw_name = "gcc_gpu_gpll0_clk_src" },
@@ -123,7 +123,7 @@ static const struct parent_map gpu_cc_parent_map_1[] = {
 };
 
 static const struct clk_parent_data gpu_cc_parent_data_1[] = {
-	gpu_cc_parent,
+	{ .fw_name = "bi_tcxo" },
 	{ .hw = &gpu_cc_pll1.clkr.hw },
 	{ .fw_name = "gcc_gpu_gpll0_clk_src" },
 	{ .fw_name = "gcc_gpu_gpll0_div_clk_src" },

base-commit: 0dd8e16bfbc003b009f843e75fae4046daa08fe9
-- 
2.37.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] clk: qcom: gpucc-sm8350: Fix "initializer element is not constant" error
  2022-07-11 17:40 [PATCH v2] clk: qcom: gpucc-sm8350: Fix "initializer element is not constant" error Nathan Chancellor
@ 2022-07-11 17:42 ` Dmitry Baryshkov
  2022-07-11 20:34 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Baryshkov @ 2022-07-11 17:42 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Michael Turquette,
	Stephen Boyd, Nick Desaulniers, Tom Rix, Robert Foss,
	linux-arm-msm, linux-clk, linux-kernel, llvm, kernel test robot

On Mon, 11 Jul 2022 at 20:41, Nathan Chancellor <nathan@kernel.org> wrote:
>
> When building with clang or GCC older than 8, errors along the following
> lines occur:
>
>   drivers/clk/qcom/gpucc-sm8350.c:111:2: error: initializer element is not a compile-time constant
>           gpu_cc_parent,
>           ^~~~~~~~~~~~~
>   drivers/clk/qcom/gpucc-sm8350.c:126:2: error: initializer element is not a compile-time constant
>           gpu_cc_parent,
>           ^~~~~~~~~~~~~
>   2 errors generated.
>
> The C standard allows an implementation to accept other forms of
> constant expressions, which GCC 8+ has chosen to do, but it is not
> required. Just inline the initializer to resolve the error.
>
> Fixes: 160758b05ab1 ("clk: qcom: add support for SM8350 GPUCC")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1660
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

> ---
>
> v1 -> v2: https://lore.kernel.org/20220711163021.152578-1-nathan@kernel.org/
>
> * Just inline the initializer, rather than using a macro (Dmitry).
>
>  drivers/clk/qcom/gpucc-sm8350.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/qcom/gpucc-sm8350.c b/drivers/clk/qcom/gpucc-sm8350.c
> index d13fa813d190..5367ce654ac9 100644
> --- a/drivers/clk/qcom/gpucc-sm8350.c
> +++ b/drivers/clk/qcom/gpucc-sm8350.c
> @@ -108,7 +108,7 @@ static const struct parent_map gpu_cc_parent_map_0[] = {
>  };
>
>  static const struct clk_parent_data gpu_cc_parent_data_0[] = {
> -       gpu_cc_parent,
> +       { .fw_name = "bi_tcxo" },
>         { .hw = &gpu_cc_pll0.clkr.hw },
>         { .hw = &gpu_cc_pll1.clkr.hw },
>         { .fw_name = "gcc_gpu_gpll0_clk_src" },
> @@ -123,7 +123,7 @@ static const struct parent_map gpu_cc_parent_map_1[] = {
>  };
>
>  static const struct clk_parent_data gpu_cc_parent_data_1[] = {
> -       gpu_cc_parent,
> +       { .fw_name = "bi_tcxo" },
>         { .hw = &gpu_cc_pll1.clkr.hw },
>         { .fw_name = "gcc_gpu_gpll0_clk_src" },
>         { .fw_name = "gcc_gpu_gpll0_div_clk_src" },
>
> base-commit: 0dd8e16bfbc003b009f843e75fae4046daa08fe9
> --
> 2.37.0
>


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] clk: qcom: gpucc-sm8350: Fix "initializer element is not constant" error
  2022-07-11 17:40 [PATCH v2] clk: qcom: gpucc-sm8350: Fix "initializer element is not constant" error Nathan Chancellor
  2022-07-11 17:42 ` Dmitry Baryshkov
@ 2022-07-11 20:34 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2022-07-11 20:34 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Nathan Chancellor
  Cc: Konrad Dybcio, Michael Turquette, Nick Desaulniers, Tom Rix,
	Robert Foss, linux-arm-msm, linux-clk, linux-kernel, llvm,
	Nathan Chancellor, kernel test robot

Quoting Nathan Chancellor (2022-07-11 10:40:05)
> When building with clang or GCC older than 8, errors along the following
> lines occur:
> 
>   drivers/clk/qcom/gpucc-sm8350.c:111:2: error: initializer element is not a compile-time constant
>           gpu_cc_parent,
>           ^~~~~~~~~~~~~
>   drivers/clk/qcom/gpucc-sm8350.c:126:2: error: initializer element is not a compile-time constant
>           gpu_cc_parent,
>           ^~~~~~~~~~~~~
>   2 errors generated.
> 
> The C standard allows an implementation to accept other forms of
> constant expressions, which GCC 8+ has chosen to do, but it is not
> required. Just inline the initializer to resolve the error.
> 
> Fixes: 160758b05ab1 ("clk: qcom: add support for SM8350 GPUCC")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1660
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---

Reviewed-by: Stephen Boyd <sboyd@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-11 20:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11 17:40 [PATCH v2] clk: qcom: gpucc-sm8350: Fix "initializer element is not constant" error Nathan Chancellor
2022-07-11 17:42 ` Dmitry Baryshkov
2022-07-11 20:34 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).