public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] dmaengine: dw: dmamux: Export the module device table
@ 2022-06-07 15:22 Miquel Raynal
  2022-06-07 15:22 ` [PATCH v2 2/2] dmaengine: dw: dmamux: Fix build without CONFIG_OF Miquel Raynal
  2022-06-07 16:33 ` [PATCH v2 1/2] dmaengine: dw: dmamux: Export the module device table Andy Shevchenko
  0 siblings, 2 replies; 7+ messages in thread
From: Miquel Raynal @ 2022-06-07 15:22 UTC (permalink / raw)
  To: Vinod Koul, dmaengine
  Cc: Andy Shevchenko, Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Thomas Petazzoni, Herve Codina, Clement Leger, Miquel Raynal

This is a tristate driver that can be built as a module, as a result,
the OF match table should be exported with MODULE_DEVICE_TABLE().

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---

Changes in v2:
* New patch.

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

diff --git a/drivers/dma/dw/rzn1-dmamux.c b/drivers/dma/dw/rzn1-dmamux.c
index 11d254e450b0..0ce4fb58185e 100644
--- a/drivers/dma/dw/rzn1-dmamux.c
+++ b/drivers/dma/dw/rzn1-dmamux.c
@@ -140,6 +140,7 @@ static const struct of_device_id rzn1_dmamux_match[] = {
 	{ .compatible = "renesas,rzn1-dmamux" },
 	{}
 };
+MODULE_DEVICE_TABLE(of, rzn1_dmamux_match);
 
 static struct platform_driver rzn1_dmamux_driver = {
 	.driver = {
-- 
2.34.1


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

* [PATCH v2 2/2] dmaengine: dw: dmamux: Fix build without CONFIG_OF
  2022-06-07 15:22 [PATCH v2 1/2] dmaengine: dw: dmamux: Export the module device table Miquel Raynal
@ 2022-06-07 15:22 ` Miquel Raynal
  2022-06-07 16:32   ` Andy Shevchenko
  2022-06-07 16:33 ` [PATCH v2 1/2] dmaengine: dw: dmamux: Export the module device table Andy Shevchenko
  1 sibling, 1 reply; 7+ messages in thread
From: Miquel Raynal @ 2022-06-07 15:22 UTC (permalink / raw)
  To: Vinod Koul, dmaengine
  Cc: Andy Shevchenko, Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Thomas Petazzoni, Herve Codina, Clement Leger, Miquel Raynal,
	kernel test robot

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.

In order to keep the harmony in the driver, the second match table is
also enclosed with the same #ifdef CONFIG_OF/#endif block and the use of
the match table forwarded by the of_match_ptr() macro.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---

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

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

diff --git a/drivers/dma/dw/rzn1-dmamux.c b/drivers/dma/dw/rzn1-dmamux.c
index 0ce4fb58185e..6ab33614e91e 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)
 {
@@ -136,16 +138,18 @@ static int rzn1_dmamux_probe(struct platform_device *pdev)
 				      &dmamux->dmarouter);
 }
 
+#ifdef CONFIG_OF
 static const struct of_device_id rzn1_dmamux_match[] = {
 	{ .compatible = "renesas,rzn1-dmamux" },
 	{}
 };
 MODULE_DEVICE_TABLE(of, rzn1_dmamux_match);
+#endif
 
 static struct platform_driver rzn1_dmamux_driver = {
 	.driver = {
 		.name = "renesas,rzn1-dmamux",
-		.of_match_table = rzn1_dmamux_match,
+		.of_match_table = of_match_ptr(rzn1_dmamux_match),
 	},
 	.probe	= rzn1_dmamux_probe,
 };
-- 
2.34.1


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

* Re: [PATCH v2 2/2] dmaengine: dw: dmamux: Fix build without CONFIG_OF
  2022-06-07 15:22 ` [PATCH v2 2/2] dmaengine: dw: dmamux: Fix build without CONFIG_OF Miquel Raynal
@ 2022-06-07 16:32   ` Andy Shevchenko
  2022-06-07 17:17     ` Miquel Raynal
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2022-06-07 16:32 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vinod Koul, dmaengine, Milan Stevanovic, Jimmy Lalande,
	Pascal Eberhard, Thomas Petazzoni, Herve Codina, Clement Leger,
	kernel test robot

On Tue, Jun 07, 2022 at 05:22:15PM +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.
> 
> In order to keep the harmony in the driver, the second match table is
> also enclosed with the same #ifdef CONFIG_OF/#endif block and the use of
> the match table forwarded by the of_match_ptr() macro.

No, what I asked is the opposite.
So, the most of this patch seems not needed (see below).

...

> +#ifdef CONFIG_OF
>  static const struct of_device_id rzn1_dmamux_match[] = {
>  	{ .compatible = "renesas,rzn1-dmamux" },
>  	{}
>  };
>  MODULE_DEVICE_TABLE(of, rzn1_dmamux_match);
> +#endif
>  
>  static struct platform_driver rzn1_dmamux_driver = {
>  	.driver = {
>  		.name = "renesas,rzn1-dmamux",
> -		.of_match_table = rzn1_dmamux_match,
> +		.of_match_table = of_match_ptr(rzn1_dmamux_match),
>  	},
>  	.probe	= rzn1_dmamux_probe,
>  };

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2 1/2] dmaengine: dw: dmamux: Export the module device table
  2022-06-07 15:22 [PATCH v2 1/2] dmaengine: dw: dmamux: Export the module device table Miquel Raynal
  2022-06-07 15:22 ` [PATCH v2 2/2] dmaengine: dw: dmamux: Fix build without CONFIG_OF Miquel Raynal
@ 2022-06-07 16:33 ` Andy Shevchenko
  1 sibling, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2022-06-07 16:33 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vinod Koul, dmaengine, Milan Stevanovic, Jimmy Lalande,
	Pascal Eberhard, Thomas Petazzoni, Herve Codina, Clement Leger

On Tue, Jun 07, 2022 at 05:22:14PM +0200, Miquel Raynal wrote:
> This is a tristate driver that can be built as a module, as a result,
> the OF match table should be exported with MODULE_DEVICE_TABLE().

Fixes go first in the series.
If this is a fix, it misses Fixes tag.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2 2/2] dmaengine: dw: dmamux: Fix build without CONFIG_OF
  2022-06-07 16:32   ` Andy Shevchenko
@ 2022-06-07 17:17     ` Miquel Raynal
  2022-06-07 18:50       ` Andy Shevchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Miquel Raynal @ 2022-06-07 17:17 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Vinod Koul, dmaengine, Milan Stevanovic, Jimmy Lalande,
	Pascal Eberhard, Thomas Petazzoni, Herve Codina, Clement Leger,
	kernel test robot

Hi Andy,

andriy.shevchenko@linux.intel.com wrote on Tue, 7 Jun 2022 19:32:47
+0300:

> On Tue, Jun 07, 2022 at 05:22:15PM +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.
> > 
> > In order to keep the harmony in the driver, the second match table is
> > also enclosed with the same #ifdef CONFIG_OF/#endif block and the use of
> > the match table forwarded by the of_match_ptr() macro.  
> 
> No, what I asked is the opposite.

I don't get what you want. Can you please explain what you mean by
"simply drop CONFIG_OF"?

> So, the most of this patch seems not needed (see below).
> 
> ...
> 
> > +#ifdef CONFIG_OF
> >  static const struct of_device_id rzn1_dmamux_match[] = {
> >  	{ .compatible = "renesas,rzn1-dmamux" },
> >  	{}
> >  };
> >  MODULE_DEVICE_TABLE(of, rzn1_dmamux_match);
> > +#endif
> >  
> >  static struct platform_driver rzn1_dmamux_driver = {
> >  	.driver = {
> >  		.name = "renesas,rzn1-dmamux",
> > -		.of_match_table = rzn1_dmamux_match,
> > +		.of_match_table = of_match_ptr(rzn1_dmamux_match),
> >  	},
> >  	.probe	= rzn1_dmamux_probe,
> >  };  
> 


Thanks,
Miquèl

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

* Re: [PATCH v2 2/2] dmaengine: dw: dmamux: Fix build without CONFIG_OF
  2022-06-07 17:17     ` Miquel Raynal
@ 2022-06-07 18:50       ` Andy Shevchenko
  2022-06-07 22:01         ` Miquel Raynal
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2022-06-07 18:50 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vinod Koul, dmaengine, Milan Stevanovic, Jimmy Lalande,
	Pascal Eberhard, Thomas Petazzoni, Herve Codina, Clement Leger,
	kernel test robot

On Tue, Jun 07, 2022 at 07:17:59PM +0200, Miquel Raynal wrote:
> andriy.shevchenko@linux.intel.com wrote on Tue, 7 Jun 2022 19:32:47
> +0300:
> > On Tue, Jun 07, 2022 at 05:22:15PM +0200, Miquel Raynal wrote:

...

> > No, what I asked is the opposite.
> 
> I don't get what you want. Can you please explain what you mean by
> "simply drop CONFIG_OF"?

The below code changes shouldn't be present in this patch, that's all.

...

> > > +#ifdef CONFIG_OF
> > >  static const struct of_device_id rzn1_dmamux_match[] = {
> > >  	{ .compatible = "renesas,rzn1-dmamux" },
> > >  	{}
> > >  };
> > >  MODULE_DEVICE_TABLE(of, rzn1_dmamux_match);
> > > +#endif
> > >  
> > >  static struct platform_driver rzn1_dmamux_driver = {
> > >  	.driver = {
> > >  		.name = "renesas,rzn1-dmamux",
> > > -		.of_match_table = rzn1_dmamux_match,
> > > +		.of_match_table = of_match_ptr(rzn1_dmamux_match),
> > >  	},
> > >  	.probe	= rzn1_dmamux_probe,
> > >  };  

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2 2/2] dmaengine: dw: dmamux: Fix build without CONFIG_OF
  2022-06-07 18:50       ` Andy Shevchenko
@ 2022-06-07 22:01         ` Miquel Raynal
  0 siblings, 0 replies; 7+ messages in thread
From: Miquel Raynal @ 2022-06-07 22:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Vinod Koul, dmaengine, Milan Stevanovic, Jimmy Lalande,
	Pascal Eberhard, Thomas Petazzoni, Herve Codina, Clement Leger,
	kernel test robot

Hi Andy,

andriy.shevchenko@linux.intel.com wrote on Tue, 7 Jun 2022 21:50:20
+0300:

> On Tue, Jun 07, 2022 at 07:17:59PM +0200, Miquel Raynal wrote:
> > andriy.shevchenko@linux.intel.com wrote on Tue, 7 Jun 2022 19:32:47
> > +0300:  
> > > On Tue, Jun 07, 2022 at 05:22:15PM +0200, Miquel Raynal wrote:  
> 
> ...
> 
> > > No, what I asked is the opposite.  
> > 
> > I don't get what you want. Can you please explain what you mean by
> > "simply drop CONFIG_OF"?  
> 
> The below code changes shouldn't be present in this patch, that's all.

Ok then, I'll send a v3 tomorrow without the below changes + the
missing Fixes.

Thanks for the clarification.

Cheers,
Miquèl

> 
> ...
> 
> > > > +#ifdef CONFIG_OF
> > > >  static const struct of_device_id rzn1_dmamux_match[] = {
> > > >  	{ .compatible = "renesas,rzn1-dmamux" },
> > > >  	{}
> > > >  };
> > > >  MODULE_DEVICE_TABLE(of, rzn1_dmamux_match);
> > > > +#endif
> > > >  
> > > >  static struct platform_driver rzn1_dmamux_driver = {
> > > >  	.driver = {
> > > >  		.name = "renesas,rzn1-dmamux",
> > > > -		.of_match_table = rzn1_dmamux_match,
> > > > +		.of_match_table = of_match_ptr(rzn1_dmamux_match),
> > > >  	},
> > > >  	.probe	= rzn1_dmamux_probe,
> > > >  };    
> 

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

end of thread, other threads:[~2022-06-08  0:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-07 15:22 [PATCH v2 1/2] dmaengine: dw: dmamux: Export the module device table Miquel Raynal
2022-06-07 15:22 ` [PATCH v2 2/2] dmaengine: dw: dmamux: Fix build without CONFIG_OF Miquel Raynal
2022-06-07 16:32   ` Andy Shevchenko
2022-06-07 17:17     ` Miquel Raynal
2022-06-07 18:50       ` Andy Shevchenko
2022-06-07 22:01         ` Miquel Raynal
2022-06-07 16:33 ` [PATCH v2 1/2] dmaengine: dw: dmamux: Export the module device table Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox