linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memory: tegra: Fix -Wunused-const-variable
@ 2019-06-13 17:27 Nathan Huckleberry
  2019-06-13 17:57 ` Nick Desaulniers
  0 siblings, 1 reply; 5+ messages in thread
From: Nathan Huckleberry @ 2019-06-13 17:27 UTC (permalink / raw)
  To: thierry.reding, jonathanh
  Cc: linux-tegra, linux-kernel, Nathan Huckleberry, clang-built-linux

Clang produces the following warning

drivers/memory/tegra/tegra124.c:36:28: warning: unused variable
'tegra124_mc_emem_regs' [-Wunused-const-variable]
static const unsigned long tegra124_mc_emem_regs[] = {
                           ^

The only usage of this variable is from within an ifdef.
It seems logical to move the variable into the ifdef as well.

Cc: clang-built-linux@googlegroups.com
Link: https://github.com/ClangBuiltLinux/linux/issues/526
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
---
 drivers/memory/tegra/tegra124.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/memory/tegra/tegra124.c b/drivers/memory/tegra/tegra124.c
index 8f8487bda642..8f2af5614595 100644
--- a/drivers/memory/tegra/tegra124.c
+++ b/drivers/memory/tegra/tegra124.c
@@ -33,6 +33,7 @@
 #define MC_EMEM_ARB_MISC1			0xdc
 #define MC_EMEM_ARB_RING1_THROTTLE		0xe0
 
+#ifdef CONFIG_ARCH_TEGRA_124_SOC
 static const unsigned long tegra124_mc_emem_regs[] = {
 	MC_EMEM_ARB_CFG,
 	MC_EMEM_ARB_OUTSTANDING_REQ,
@@ -54,6 +55,7 @@ static const unsigned long tegra124_mc_emem_regs[] = {
 	MC_EMEM_ARB_MISC1,
 	MC_EMEM_ARB_RING1_THROTTLE
 };
+#endif
 
 static const struct tegra_mc_client tegra124_mc_clients[] = {
 	{
-- 
2.22.0.rc2.383.gf4fbbf30c2-goog


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

* Re: [PATCH] memory: tegra: Fix -Wunused-const-variable
  2019-06-13 17:27 [PATCH] memory: tegra: Fix -Wunused-const-variable Nathan Huckleberry
@ 2019-06-13 17:57 ` Nick Desaulniers
  2019-06-13 18:26   ` [PATCH v2] " Nathan Huckleberry
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Desaulniers @ 2019-06-13 17:57 UTC (permalink / raw)
  To: Nathan Huckleberry
  Cc: Thierry Reding, jonathanh, linux-tegra, LKML, clang-built-linux

On Thu, Jun 13, 2019 at 10:28 AM 'Nathan Huckleberry' via Clang Built
Linux <clang-built-linux@googlegroups.com> wrote:
> The only usage of this variable is from within an ifdef.
> It seems logical to move the variable into the ifdef as well.

Thanks for the patch, I agree but have the same thoughts as in:
https://lkml.org/lkml/2019/6/13/1438

> +#ifdef CONFIG_ARCH_TEGRA_124_SOC
>  static const unsigned long tegra124_mc_emem_regs[] = {
>         MC_EMEM_ARB_CFG,
>         MC_EMEM_ARB_OUTSTANDING_REQ,
> @@ -54,6 +55,7 @@ static const unsigned long tegra124_mc_emem_regs[] = {
>         MC_EMEM_ARB_MISC1,
>         MC_EMEM_ARB_RING1_THROTTLE
>  };
> +#endif
-- 
Thanks,
~Nick Desaulniers

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

* [PATCH v2] memory: tegra: Fix -Wunused-const-variable
  2019-06-13 17:57 ` Nick Desaulniers
@ 2019-06-13 18:26   ` Nathan Huckleberry
  2019-06-13 18:27     ` Nick Desaulniers
  2019-06-14 16:02     ` Thierry Reding
  0 siblings, 2 replies; 5+ messages in thread
From: Nathan Huckleberry @ 2019-06-13 18:26 UTC (permalink / raw)
  To: thierry.reding, jonathanh
  Cc: linux-tegra, linux-kernel, Nathan Huckleberry, clang-built-linux

Clang produces the following warning

drivers/memory/tegra/tegra124.c:36:28: warning: unused variable
'tegra124_mc_emem_regs' [-Wunused-const-variable]
static const unsigned long tegra124_mc_emem_regs[] = {
                           ^

The only usage of this variable is from within an ifdef.
It seems logical to move the variable into the ifdef as well.

Cc: clang-built-linux@googlegroups.com
Link: https://github.com/ClangBuiltLinux/linux/issues/526
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
---
Changes from v1 -> v2:
* Moved definition of tegra124_mc_emem_regs into existing ifdef
 drivers/memory/tegra/tegra124.c | 44 ++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/memory/tegra/tegra124.c b/drivers/memory/tegra/tegra124.c
index 8f8487bda642..6985a4e33325 100644
--- a/drivers/memory/tegra/tegra124.c
+++ b/drivers/memory/tegra/tegra124.c
@@ -33,28 +33,6 @@
 #define MC_EMEM_ARB_MISC1			0xdc
 #define MC_EMEM_ARB_RING1_THROTTLE		0xe0
 
-static const unsigned long tegra124_mc_emem_regs[] = {
-	MC_EMEM_ARB_CFG,
-	MC_EMEM_ARB_OUTSTANDING_REQ,
-	MC_EMEM_ARB_TIMING_RCD,
-	MC_EMEM_ARB_TIMING_RP,
-	MC_EMEM_ARB_TIMING_RC,
-	MC_EMEM_ARB_TIMING_RAS,
-	MC_EMEM_ARB_TIMING_FAW,
-	MC_EMEM_ARB_TIMING_RRD,
-	MC_EMEM_ARB_TIMING_RAP2PRE,
-	MC_EMEM_ARB_TIMING_WAP2PRE,
-	MC_EMEM_ARB_TIMING_R2R,
-	MC_EMEM_ARB_TIMING_W2W,
-	MC_EMEM_ARB_TIMING_R2W,
-	MC_EMEM_ARB_TIMING_W2R,
-	MC_EMEM_ARB_DA_TURNS,
-	MC_EMEM_ARB_DA_COVERS,
-	MC_EMEM_ARB_MISC0,
-	MC_EMEM_ARB_MISC1,
-	MC_EMEM_ARB_RING1_THROTTLE
-};
-
 static const struct tegra_mc_client tegra124_mc_clients[] = {
 	{
 		.id = 0x00,
@@ -1049,6 +1027,28 @@ static const struct tegra_mc_reset tegra124_mc_resets[] = {
 };
 
 #ifdef CONFIG_ARCH_TEGRA_124_SOC
+static const unsigned long tegra124_mc_emem_regs[] = {
+	MC_EMEM_ARB_CFG,
+	MC_EMEM_ARB_OUTSTANDING_REQ,
+	MC_EMEM_ARB_TIMING_RCD,
+	MC_EMEM_ARB_TIMING_RP,
+	MC_EMEM_ARB_TIMING_RC,
+	MC_EMEM_ARB_TIMING_RAS,
+	MC_EMEM_ARB_TIMING_FAW,
+	MC_EMEM_ARB_TIMING_RRD,
+	MC_EMEM_ARB_TIMING_RAP2PRE,
+	MC_EMEM_ARB_TIMING_WAP2PRE,
+	MC_EMEM_ARB_TIMING_R2R,
+	MC_EMEM_ARB_TIMING_W2W,
+	MC_EMEM_ARB_TIMING_R2W,
+	MC_EMEM_ARB_TIMING_W2R,
+	MC_EMEM_ARB_DA_TURNS,
+	MC_EMEM_ARB_DA_COVERS,
+	MC_EMEM_ARB_MISC0,
+	MC_EMEM_ARB_MISC1,
+	MC_EMEM_ARB_RING1_THROTTLE
+};
+
 static const struct tegra_smmu_soc tegra124_smmu_soc = {
 	.clients = tegra124_mc_clients,
 	.num_clients = ARRAY_SIZE(tegra124_mc_clients),
-- 
2.22.0.rc2.383.gf4fbbf30c2-goog


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

* Re: [PATCH v2] memory: tegra: Fix -Wunused-const-variable
  2019-06-13 18:26   ` [PATCH v2] " Nathan Huckleberry
@ 2019-06-13 18:27     ` Nick Desaulniers
  2019-06-14 16:02     ` Thierry Reding
  1 sibling, 0 replies; 5+ messages in thread
From: Nick Desaulniers @ 2019-06-13 18:27 UTC (permalink / raw)
  To: Nathan Huckleberry
  Cc: Thierry Reding, jonathanh, linux-tegra, LKML, clang-built-linux

On Thu, Jun 13, 2019 at 11:26 AM 'Nathan Huckleberry' via Clang Built
Linux <clang-built-linux@googlegroups.com> wrote:
> Changes from v1 -> v2:
> * Moved definition of tegra124_mc_emem_regs into existing ifdef

Thanks for sending the v2, LGTM.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> --- a/drivers/memory/tegra/tegra124.c
> +++ b/drivers/memory/tegra/tegra124.c
> @@ -33,28 +33,6 @@
>  #define MC_EMEM_ARB_MISC1                      0xdc
>  #define MC_EMEM_ARB_RING1_THROTTLE             0xe0
>
> -static const unsigned long tegra124_mc_emem_regs[] = {
> -       MC_EMEM_ARB_CFG,
> -       MC_EMEM_ARB_OUTSTANDING_REQ,
> -       MC_EMEM_ARB_TIMING_RCD,
> -       MC_EMEM_ARB_TIMING_RP,
> -       MC_EMEM_ARB_TIMING_RC,
> -       MC_EMEM_ARB_TIMING_RAS,
> -       MC_EMEM_ARB_TIMING_FAW,
> -       MC_EMEM_ARB_TIMING_RRD,
> -       MC_EMEM_ARB_TIMING_RAP2PRE,
> -       MC_EMEM_ARB_TIMING_WAP2PRE,
> -       MC_EMEM_ARB_TIMING_R2R,
> -       MC_EMEM_ARB_TIMING_W2W,
> -       MC_EMEM_ARB_TIMING_R2W,
> -       MC_EMEM_ARB_TIMING_W2R,
> -       MC_EMEM_ARB_DA_TURNS,
> -       MC_EMEM_ARB_DA_COVERS,
> -       MC_EMEM_ARB_MISC0,
> -       MC_EMEM_ARB_MISC1,
> -       MC_EMEM_ARB_RING1_THROTTLE
> -};
> -
>  static const struct tegra_mc_client tegra124_mc_clients[] = {
>         {
>                 .id = 0x00,
> @@ -1049,6 +1027,28 @@ static const struct tegra_mc_reset tegra124_mc_resets[] = {
>  };
>
>  #ifdef CONFIG_ARCH_TEGRA_124_SOC
> +static const unsigned long tegra124_mc_emem_regs[] = {
> +       MC_EMEM_ARB_CFG,
> +       MC_EMEM_ARB_OUTSTANDING_REQ,
> +       MC_EMEM_ARB_TIMING_RCD,
> +       MC_EMEM_ARB_TIMING_RP,
> +       MC_EMEM_ARB_TIMING_RC,
> +       MC_EMEM_ARB_TIMING_RAS,
> +       MC_EMEM_ARB_TIMING_FAW,
> +       MC_EMEM_ARB_TIMING_RRD,
> +       MC_EMEM_ARB_TIMING_RAP2PRE,
> +       MC_EMEM_ARB_TIMING_WAP2PRE,
> +       MC_EMEM_ARB_TIMING_R2R,
> +       MC_EMEM_ARB_TIMING_W2W,
> +       MC_EMEM_ARB_TIMING_R2W,
> +       MC_EMEM_ARB_TIMING_W2R,
> +       MC_EMEM_ARB_DA_TURNS,
> +       MC_EMEM_ARB_DA_COVERS,
> +       MC_EMEM_ARB_MISC0,
> +       MC_EMEM_ARB_MISC1,
> +       MC_EMEM_ARB_RING1_THROTTLE
> +};
> +

-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH v2] memory: tegra: Fix -Wunused-const-variable
  2019-06-13 18:26   ` [PATCH v2] " Nathan Huckleberry
  2019-06-13 18:27     ` Nick Desaulniers
@ 2019-06-14 16:02     ` Thierry Reding
  1 sibling, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2019-06-14 16:02 UTC (permalink / raw)
  To: Nathan Huckleberry
  Cc: jonathanh, linux-tegra, linux-kernel, clang-built-linux

[-- Attachment #1: Type: text/plain, Size: 875 bytes --]

On Thu, Jun 13, 2019 at 11:26:10AM -0700, Nathan Huckleberry wrote:
> Clang produces the following warning
> 
> drivers/memory/tegra/tegra124.c:36:28: warning: unused variable
> 'tegra124_mc_emem_regs' [-Wunused-const-variable]
> static const unsigned long tegra124_mc_emem_regs[] = {
>                            ^
> 
> The only usage of this variable is from within an ifdef.
> It seems logical to move the variable into the ifdef as well.
> 
> Cc: clang-built-linux@googlegroups.com
> Link: https://github.com/ClangBuiltLinux/linux/issues/526
> Signed-off-by: Nathan Huckleberry <nhuck@google.com>
> ---
> Changes from v1 -> v2:
> * Moved definition of tegra124_mc_emem_regs into existing ifdef
>  drivers/memory/tegra/tegra124.c | 44 ++++++++++++++++-----------------
>  1 file changed, 22 insertions(+), 22 deletions(-)

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2019-06-14 16:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-13 17:27 [PATCH] memory: tegra: Fix -Wunused-const-variable Nathan Huckleberry
2019-06-13 17:57 ` Nick Desaulniers
2019-06-13 18:26   ` [PATCH v2] " Nathan Huckleberry
2019-06-13 18:27     ` Nick Desaulniers
2019-06-14 16:02     ` Thierry Reding

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).