[1/2] soc: renesas: mark OF related data as maybe unused

Message ID 20230312132650.352796-1-krzysztof.kozlowski@linaro.org
State New
Headers
Series [1/2] soc: renesas: mark OF related data as maybe unused |

Commit Message

Krzysztof Kozlowski March 12, 2023, 1:26 p.m. UTC
  The driver can be compile tested with !CONFIG_OF making certain data
unused:

  drivers/soc/renesas/renesas-soc.c:272:34: error: ‘renesas_socs’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/soc/renesas/renesas-soc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Geert Uytterhoeven March 13, 2023, 12:33 p.m. UTC | #1
Hi Krzysztof,

Thanks for your patch!

On Sun, Mar 12, 2023 at 2:26 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
> The driver can be compile tested with !CONFIG_OF making certain data
> unused:
>
>   drivers/soc/renesas/renesas-soc.c:272:34: error: ‘renesas_socs’ defined but not used [-Werror=unused-const-variable=]

Where do you see this issue?
This variable is used unconditionally, and the driver builds fine for
me for m68k/allmodconfig+CONFIG_OF=n?

> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

> --- a/drivers/soc/renesas/renesas-soc.c
> +++ b/drivers/soc/renesas/renesas-soc.c
> @@ -269,7 +269,7 @@ static const struct renesas_soc soc_shmobile_ag5 __initconst __maybe_unused = {
>  };
>
>
> -static const struct of_device_id renesas_socs[] __initconst = {
> +static const struct of_device_id renesas_socs[] __initconst __maybe_unused = {
>  #ifdef CONFIG_ARCH_R7S72100
>         { .compatible = "renesas,r7s72100",     .data = &soc_rz_a1h },
>  #endif

Gr{oetje,eeting}s,

                        Geert
  
Geert Uytterhoeven March 13, 2023, 2:04 p.m. UTC | #2
On Mon, Mar 13, 2023 at 1:33 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Sun, Mar 12, 2023 at 2:26 PM Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
> > The driver can be compile tested with !CONFIG_OF making certain data
> > unused:
> >
> >   drivers/soc/renesas/renesas-soc.c:272:34: error: ‘renesas_socs’ defined but not used [-Werror=unused-const-variable=]
>
> Where do you see this issue?

With W=1, as of_match_node() is a dummy macro, not an inline
function.

> This variable is used unconditionally, and the driver builds fine for
> me for m68k/allmodconfig+CONFIG_OF=n?
>
> > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-devel for v6.4.

> > --- a/drivers/soc/renesas/renesas-soc.c
> > +++ b/drivers/soc/renesas/renesas-soc.c
> > @@ -269,7 +269,7 @@ static const struct renesas_soc soc_shmobile_ag5 __initconst __maybe_unused = {
> >  };
> >
> >
> > -static const struct of_device_id renesas_socs[] __initconst = {
> > +static const struct of_device_id renesas_socs[] __initconst __maybe_unused = {
> >  #ifdef CONFIG_ARCH_R7S72100
> >         { .compatible = "renesas,r7s72100",     .data = &soc_rz_a1h },
> >  #endif

Gr{oetje,eeting}s,

                        Geert
  

Patch

diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesas-soc.c
index 468ebce1ea88..9e0a5707d917 100644
--- a/drivers/soc/renesas/renesas-soc.c
+++ b/drivers/soc/renesas/renesas-soc.c
@@ -269,7 +269,7 @@  static const struct renesas_soc soc_shmobile_ag5 __initconst __maybe_unused = {
 };
 
 
-static const struct of_device_id renesas_socs[] __initconst = {
+static const struct of_device_id renesas_socs[] __initconst __maybe_unused = {
 #ifdef CONFIG_ARCH_R7S72100
 	{ .compatible = "renesas,r7s72100",	.data = &soc_rz_a1h },
 #endif