Re: [PATCH 01/40] drm/amd/include/vega10_ip_offset: Mark _BASE structs as __maybe_unused

2020-11-16 Thread Joe Perches
On Fri, 2020-11-13 at 13:48 +, Lee Jones wrote:
> This patch fixes nearly 400 warnings!
> 
> These structures are too widely used in too many varying
> configurations to be split-up into different headers or moved into
> source files.
> 
> Instead, we'll mark them as __maybe_unused which tells the compiler
> that we're aware they're being included into source files which do not
> make use of them - but we've looked into it, and it's okay.

https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Type-Attributes.html#Type-Attributes

Wouldn't it be simpler to mark the struct definitions as maybe_unused
instead of the declarations?

And perhaps remove all the unnecessary zeroed declarations?

Something like this example?
---
 drivers/gpu/drm/amd/include/arct_ip_offset.h | 353 +++
 1 file changed, 145 insertions(+), 208 deletions(-)

diff --git a/drivers/gpu/drm/amd/include/arct_ip_offset.h 
b/drivers/gpu/drm/amd/include/arct_ip_offset.h
index a7791a9e1f90..9f2d6b832dd9 100644
--- a/drivers/gpu/drm/amd/include/arct_ip_offset.h
+++ b/drivers/gpu/drm/amd/include/arct_ip_offset.h
@@ -33,215 +33,152 @@ struct IP_BASE_INSTANCE
 struct IP_BASE
 {
 struct IP_BASE_INSTANCE instance[MAX_INSTANCE];
-};
-
-
-static const struct IP_BASE ATHUB_BASE={ { { { 0x0C20, 
0x00012460, 0x00408C00, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } } } };
-static const struct IP_BASE CLK_BASE={ { { { 0x000120C0, 
0x00016C00, 0x00401800, 0, 0, 0 } },
-{ { 0x000120E0, 0x00016E00, 
0x00401C00, 0, 0, 0 } },
-{ { 0x00012100, 0x00017000, 
0x00402000, 0, 0, 0 } },
-{ { 0x00012120, 0x00017200, 
0x00402400, 0, 0, 0 } },
-{ { 0x000136C0, 0x0001B000, 
0x0042D800, 0, 0, 0 } },
-{ { 0x00013720, 0x0001B200, 
0x0042E400, 0, 0, 0 } },
-{ { 0x000125E0, 0x00017E00, 
0x0040BC00, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } } } };
-static const struct IP_BASE DF_BASE={ { { { 0x7000, 
0x000125C0, 0x0040B800, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } } } };
-static const struct IP_BASE FUSE_BASE={ { { { 0x000120A0, 
0x00017400, 0x00401400, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } } } };
-static const struct IP_BASE GC_BASE={ { { { 0x2000, 
0xA000, 0x00012160, 0x00402C00, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } } } };
-static const struct IP_BASE HDP_BASE={ { { { 0x0F20, 
0x00012520, 0x0040A400, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } },
-{ { 0, 0, 0, 0, 0, 0 } } } };
-static const struct IP_BASE MMHUB_BASE={ { { { 0x00012440, 
0x0001A000, 0x00408800, 0, 

Re: [PATCH 01/40] drm/amd/include/vega10_ip_offset: Mark _BASE structs as __maybe_unused

2020-11-13 Thread Alex Deucher
On Fri, Nov 13, 2020 at 8:49 AM Lee Jones  wrote:
>
> This patch fixes nearly 400 warnings!
>
> These structures are too widely used in too many varying
> configurations to be split-up into different headers or moved into
> source files.
>
> Instead, we'll mark them as __maybe_unused which tells the compiler
> that we're aware they're being included into source files which do not
> make use of them - but we've looked into it, and it's okay.
>
> Let's tidy-up whilst were here.  Just alignment stuff.
>
> Fixes the following W=1 kernel build warning(s):
>
>  In file included from drivers/gpu/drm/amd/amdgpu/navi14_reg_init.c:27:
>  drivers/gpu/drm/amd/amdgpu/../include/navi14_ip_offset.h:179:29: warning: 
> ‘USB0_BASE’ defined but not used [-Wunused-const-variable=]
>  179 | static const struct IP_BASE USB0_BASE ={ { { { 0x0242A800, 0x05B0, 
> 0, 0, 0 } },
>  | ^
>  drivers/gpu/drm/amd/amdgpu/../include/navi14_ip_offset.h:172:29: warning: 
> ‘UMC_BASE’ defined but not used [-Wunused-const-variable=]
>  172 | static const struct IP_BASE UMC_BASE ={ { { { 0x00014000, 0x02425800, 
> 0, 0, 0 } },
>  | ^~~~
>  drivers/gpu/drm/amd/amdgpu/../include/navi14_ip_offset.h:151:29: warning: 
> ‘SDMA_BASE’ defined but not used [-Wunused-const-variable=]
>  151 | static const struct IP_BASE SDMA_BASE ={ { { { 0x1260, 0xA000, 
> 0x02402C00, 0, 0 } },
>  | ^
>  drivers/gpu/drm/amd/amdgpu/../include/navi14_ip_offset.h:144:29: warning: 
> ‘PCIE0_BASE’ defined but not used [-Wunused-const-variable=]
>  144 | static const struct IP_BASE PCIE0_BASE ={ { { { 0x, 
> 0x0014, 0x0D20, 0x00010400, 0x0241B000 } },
>  | ^~
>
> NB: Snipped for brevity
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  .../gpu/drm/amd/include/vega10_ip_offset.h| 76 +--
>  1 file changed, 38 insertions(+), 38 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/include/vega10_ip_offset.h 
> b/drivers/gpu/drm/amd/include/vega10_ip_offset.h
> index 976dd2d565ba4..bb5463152f6b0 100644
> --- a/drivers/gpu/drm/amd/include/vega10_ip_offset.h
> +++ b/drivers/gpu/drm/amd/include/vega10_ip_offset.h
> @@ -35,177 +35,177 @@ struct IP_BASE
>  };
>
>
> -static const struct IP_BASE NBIF_BASE  = { { { { 0x, 
> 0x0014, 0x0D20, 0x00010400, 0 } },
> +static const struct IP_BASE __maybe_unused NBIF_BASE   = { { { { 0x, 
> 0x0014, 0x0D20, 0x00010400, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } } } };
> -static const struct IP_BASE NBIO_BASE  = { { { { 0x, 
> 0x0014, 0x0D20, 0x00010400, 0 } },
> +static const struct IP_BASE __maybe_unused NBIO_BASE   = { { { { 0x, 
> 0x0014, 0x0D20, 0x00010400, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } } } };
> -static const struct IP_BASE DCE_BASE   = { { { { 0x0012, 
> 0x00C0, 0x34C0, 0, 0 } },
> +static const struct IP_BASE __maybe_unused DCE_BASE= { { { { 0x0012, 
> 0x00C0, 0x34C0, 0, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } } } };
> -static const struct IP_BASE DCN_BASE   = { { { { 0x0012, 
> 0x00C0, 0x34C0, 0, 0 } },
> +static const struct IP_BASE __maybe_unused DCN_BASE= { { { { 0x0012, 
> 0x00C0, 0x34C0, 0, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } },
>   
>   { { 0, 0, 0, 0, 0 } },
> 

[PATCH 01/40] drm/amd/include/vega10_ip_offset: Mark _BASE structs as __maybe_unused

2020-11-13 Thread Lee Jones
This patch fixes nearly 400 warnings!

These structures are too widely used in too many varying
configurations to be split-up into different headers or moved into
source files.

Instead, we'll mark them as __maybe_unused which tells the compiler
that we're aware they're being included into source files which do not
make use of them - but we've looked into it, and it's okay.

Let's tidy-up whilst were here.  Just alignment stuff.

Fixes the following W=1 kernel build warning(s):

 In file included from drivers/gpu/drm/amd/amdgpu/navi14_reg_init.c:27:
 drivers/gpu/drm/amd/amdgpu/../include/navi14_ip_offset.h:179:29: warning: 
‘USB0_BASE’ defined but not used [-Wunused-const-variable=]
 179 | static const struct IP_BASE USB0_BASE ={ { { { 0x0242A800, 0x05B0, 
0, 0, 0 } },
 | ^
 drivers/gpu/drm/amd/amdgpu/../include/navi14_ip_offset.h:172:29: warning: 
‘UMC_BASE’ defined but not used [-Wunused-const-variable=]
 172 | static const struct IP_BASE UMC_BASE ={ { { { 0x00014000, 0x02425800, 0, 
0, 0 } },
 | ^~~~
 drivers/gpu/drm/amd/amdgpu/../include/navi14_ip_offset.h:151:29: warning: 
‘SDMA_BASE’ defined but not used [-Wunused-const-variable=]
 151 | static const struct IP_BASE SDMA_BASE ={ { { { 0x1260, 0xA000, 
0x02402C00, 0, 0 } },
 | ^
 drivers/gpu/drm/amd/amdgpu/../include/navi14_ip_offset.h:144:29: warning: 
‘PCIE0_BASE’ defined but not used [-Wunused-const-variable=]
 144 | static const struct IP_BASE PCIE0_BASE ={ { { { 0x, 0x0014, 
0x0D20, 0x00010400, 0x0241B000 } },
 | ^~

NB: Snipped for brevity

Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
 .../gpu/drm/amd/include/vega10_ip_offset.h| 76 +--
 1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/drivers/gpu/drm/amd/include/vega10_ip_offset.h 
b/drivers/gpu/drm/amd/include/vega10_ip_offset.h
index 976dd2d565ba4..bb5463152f6b0 100644
--- a/drivers/gpu/drm/amd/include/vega10_ip_offset.h
+++ b/drivers/gpu/drm/amd/include/vega10_ip_offset.h
@@ -35,177 +35,177 @@ struct IP_BASE
 };
 
 
-static const struct IP_BASE NBIF_BASE  = { { { { 0x, 
0x0014, 0x0D20, 0x00010400, 0 } },
+static const struct IP_BASE __maybe_unused NBIF_BASE   = { { { { 0x, 
0x0014, 0x0D20, 0x00010400, 0 } },

{ { 0, 0, 0, 0, 0 } },

{ { 0, 0, 0, 0, 0 } },

{ { 0, 0, 0, 0, 0 } },

{ { 0, 0, 0, 0, 0 } } } };
-static const struct IP_BASE NBIO_BASE  = { { { { 0x, 
0x0014, 0x0D20, 0x00010400, 0 } },
+static const struct IP_BASE __maybe_unused NBIO_BASE   = { { { { 0x, 
0x0014, 0x0D20, 0x00010400, 0 } },

{ { 0, 0, 0, 0, 0 } },

{ { 0, 0, 0, 0, 0 } },

{ { 0, 0, 0, 0, 0 } },

{ { 0, 0, 0, 0, 0 } } } };
-static const struct IP_BASE DCE_BASE   = { { { { 0x0012, 
0x00C0, 0x34C0, 0, 0 } },
+static const struct IP_BASE __maybe_unused DCE_BASE= { { { { 0x0012, 
0x00C0, 0x34C0, 0, 0 } },

{ { 0, 0, 0, 0, 0 } },

{ { 0, 0, 0, 0, 0 } },

{ { 0, 0, 0, 0, 0 } },

{ { 0, 0, 0, 0, 0 } } } };
-static const struct IP_BASE DCN_BASE   = { { { { 0x0012, 
0x00C0, 0x34C0, 0, 0 } },
+static const struct IP_BASE __maybe_unused DCN_BASE= { { { { 0x0012, 
0x00C0, 0x34C0, 0, 0 } },

{ { 0, 0, 0, 0, 0 } },

{ { 0, 0, 0, 0, 0 } },

{ { 0, 0, 0, 0, 0 } },

{ { 0, 0, 0, 0, 0 } } } };
-static const struct IP_BASE MP0_BASE   = { { { { 0x00016000, 
0, 0, 0, 0 } },
+static const struct IP_BASE __maybe_unused MP0_BASE= { { { { 0x00016000, 
0, 0, 0, 0 } },