diff mbox series

[v3,2/2] dmaengine: dw: dmamux: Fix build without CONFIG_OF

Message ID 20220609141455.300879-2-miquel.raynal@bootlin.com (mailing list archive)
State Accepted
Commit 7811f2e7fd6a30d96eaa1fccf57b07694a8cad27
Headers show
Series [v3,1/2] dmaengine: dw: dmamux: Export the module device table | expand

Commit Message

Miquel Raynal June 9, 2022, 2:14 p.m. UTC
When built without OF support, of_match_node() expands to NULL, which
produces the following output:
>> drivers/dma/dw/rzn1-dmamux.c:105:34: warning: unused variable 'rzn1_dmac_match' [-Wunused-const-variable]
   static const struct of_device_id rzn1_dmac_match[] = {

One way to silence the warning is to enclose the structure definition
with an #ifdef CONFIG_OF/#endif block.

Fixes: 134d9c52fca2 ("dmaengine: dw: dmamux: Introduce RZN1 DMA router support")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---

Changes in v3:
* Did not extend the change to the second match table as requested by Andy.
* Added a Fixes tag.

Changes in v2:
* Used the #ifdef solution rather than the __maybe_unused keyword.

 drivers/dma/dw/rzn1-dmamux.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andy Shevchenko June 9, 2022, 3:59 p.m. UTC | #1
On Thu, Jun 09, 2022 at 04:14:55PM +0200, Miquel Raynal wrote:
> When built without OF support, of_match_node() expands to NULL, which
> produces the following output:
> >> drivers/dma/dw/rzn1-dmamux.c:105:34: warning: unused variable 'rzn1_dmac_match' [-Wunused-const-variable]
>    static const struct of_device_id rzn1_dmac_match[] = {
> 
> One way to silence the warning is to enclose the structure definition
> with an #ifdef CONFIG_OF/#endif block.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Fixes: 134d9c52fca2 ("dmaengine: dw: dmamux: Introduce RZN1 DMA router support")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
> 
> Changes in v3:
> * Did not extend the change to the second match table as requested by Andy.
> * Added a Fixes tag.
> 
> Changes in v2:
> * Used the #ifdef solution rather than the __maybe_unused keyword.
> 
>  drivers/dma/dw/rzn1-dmamux.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/dma/dw/rzn1-dmamux.c b/drivers/dma/dw/rzn1-dmamux.c
> index 0ce4fb58185e..f9912c3dd4d7 100644
> --- a/drivers/dma/dw/rzn1-dmamux.c
> +++ b/drivers/dma/dw/rzn1-dmamux.c
> @@ -102,10 +102,12 @@ static void *rzn1_dmamux_route_allocate(struct of_phandle_args *dma_spec,
>  	return ERR_PTR(ret);
>  }
>  
> +#ifdef CONFIG_OF
>  static const struct of_device_id rzn1_dmac_match[] = {
>  	{ .compatible = "renesas,rzn1-dma" },
>  	{}
>  };
> +#endif
>  
>  static int rzn1_dmamux_probe(struct platform_device *pdev)
>  {
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/dma/dw/rzn1-dmamux.c b/drivers/dma/dw/rzn1-dmamux.c
index 0ce4fb58185e..f9912c3dd4d7 100644
--- a/drivers/dma/dw/rzn1-dmamux.c
+++ b/drivers/dma/dw/rzn1-dmamux.c
@@ -102,10 +102,12 @@  static void *rzn1_dmamux_route_allocate(struct of_phandle_args *dma_spec,
 	return ERR_PTR(ret);
 }
 
+#ifdef CONFIG_OF
 static const struct of_device_id rzn1_dmac_match[] = {
 	{ .compatible = "renesas,rzn1-dma" },
 	{}
 };
+#endif
 
 static int rzn1_dmamux_probe(struct platform_device *pdev)
 {