linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] remoteproc/mtk_scp: surround DT device IDs with CONFIG_OF
@ 2020-11-02  7:40 Alexandre Courbot
  2020-11-04 19:05 ` Mathieu Poirier
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Courbot @ 2020-11-02  7:40 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Bjorn Andersson, Matthias Brugger
  Cc: linux-remoteproc, linux-mediatek, linux-kernel,
	Alexandre Courbot, kernel test robot

Now that this driver can be compiled with COMPILE_TEST, we have no
guarantee that CONFIG_OF will also be defined. When that happens, a
warning about mtk_scp_of_match being defined but unused will be reported
so make sure this variable is only defined if of_match_ptr() actually
uses it.

Fixes: cbd2dca74926c0e4610c40923cc786b732c9e8ef remoteproc: scp: add COMPILE_TEST dependency
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
---
 drivers/remoteproc/mtk_scp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 577cbd5d421e..f74f22d4d1ff 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -772,12 +772,14 @@ static const struct mtk_scp_of_data mt8192_of_data = {
 	.host_to_scp_int_bit = MT8192_HOST_IPC_INT_BIT,
 };
 
+#if defined(CONFIG_OF)
 static const struct of_device_id mtk_scp_of_match[] = {
 	{ .compatible = "mediatek,mt8183-scp", .data = &mt8183_of_data },
 	{ .compatible = "mediatek,mt8192-scp", .data = &mt8192_of_data },
 	{},
 };
 MODULE_DEVICE_TABLE(of, mtk_scp_of_match);
+#endif
 
 static struct platform_driver mtk_scp_driver = {
 	.probe = scp_probe,
-- 
2.29.1.341.ge80a0c044ae-goog


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

* Re: [PATCH] remoteproc/mtk_scp: surround DT device IDs with CONFIG_OF
  2020-11-02  7:40 [PATCH] remoteproc/mtk_scp: surround DT device IDs with CONFIG_OF Alexandre Courbot
@ 2020-11-04 19:05 ` Mathieu Poirier
  2020-11-05  4:55   ` Bjorn Andersson
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Poirier @ 2020-11-04 19:05 UTC (permalink / raw)
  To: Alexandre Courbot
  Cc: Ohad Ben-Cohen, Bjorn Andersson, Matthias Brugger,
	linux-remoteproc, linux-mediatek, linux-kernel,
	kernel test robot

Hi Alexander,

On Mon, Nov 02, 2020 at 04:40:07PM +0900, Alexandre Courbot wrote:
> Now that this driver can be compiled with COMPILE_TEST, we have no
> guarantee that CONFIG_OF will also be defined. When that happens, a
> warning about mtk_scp_of_match being defined but unused will be reported
> so make sure this variable is only defined if of_match_ptr() actually
> uses it.
> 
> Fixes: cbd2dca74926c0e4610c40923cc786b732c9e8ef remoteproc: scp: add COMPILE_TEST dependency
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
> ---
>  drivers/remoteproc/mtk_scp.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index 577cbd5d421e..f74f22d4d1ff 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -772,12 +772,14 @@ static const struct mtk_scp_of_data mt8192_of_data = {
>  	.host_to_scp_int_bit = MT8192_HOST_IPC_INT_BIT,
>  };
>  
> +#if defined(CONFIG_OF)
>  static const struct of_device_id mtk_scp_of_match[] = {
>  	{ .compatible = "mediatek,mt8183-scp", .data = &mt8183_of_data },
>  	{ .compatible = "mediatek,mt8192-scp", .data = &mt8192_of_data },
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, mtk_scp_of_match);
> +#endif

I think it is better to add a "depends on OF" in the Kconfig.

Thanks,
Mathieu

>  
>  static struct platform_driver mtk_scp_driver = {
>  	.probe = scp_probe,
> -- 
> 2.29.1.341.ge80a0c044ae-goog
> 

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

* Re: [PATCH] remoteproc/mtk_scp: surround DT device IDs with CONFIG_OF
  2020-11-04 19:05 ` Mathieu Poirier
@ 2020-11-05  4:55   ` Bjorn Andersson
  0 siblings, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2020-11-05  4:55 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: Alexandre Courbot, Ohad Ben-Cohen, Matthias Brugger,
	linux-remoteproc, linux-mediatek, linux-kernel,
	kernel test robot

On Wed 04 Nov 13:05 CST 2020, Mathieu Poirier wrote:

> Hi Alexander,
> 
> On Mon, Nov 02, 2020 at 04:40:07PM +0900, Alexandre Courbot wrote:
> > Now that this driver can be compiled with COMPILE_TEST, we have no
> > guarantee that CONFIG_OF will also be defined. When that happens, a
> > warning about mtk_scp_of_match being defined but unused will be reported
> > so make sure this variable is only defined if of_match_ptr() actually
> > uses it.
> > 
> > Fixes: cbd2dca74926c0e4610c40923cc786b732c9e8ef remoteproc: scp: add COMPILE_TEST dependency
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
> > ---
> >  drivers/remoteproc/mtk_scp.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> > index 577cbd5d421e..f74f22d4d1ff 100644
> > --- a/drivers/remoteproc/mtk_scp.c
> > +++ b/drivers/remoteproc/mtk_scp.c
> > @@ -772,12 +772,14 @@ static const struct mtk_scp_of_data mt8192_of_data = {
> >  	.host_to_scp_int_bit = MT8192_HOST_IPC_INT_BIT,
> >  };
> >  
> > +#if defined(CONFIG_OF)
> >  static const struct of_device_id mtk_scp_of_match[] = {
> >  	{ .compatible = "mediatek,mt8183-scp", .data = &mt8183_of_data },
> >  	{ .compatible = "mediatek,mt8192-scp", .data = &mt8192_of_data },
> >  	{},
> >  };
> >  MODULE_DEVICE_TABLE(of, mtk_scp_of_match);
> > +#endif
> 
> I think it is better to add a "depends on OF" in the Kconfig.
> 

That would reduce the efficiency of COMPILE_TEST, so I would prefer that
we drop of_match_ptr(), which will result in the pointer always being
populated and this being referenced - although unused when built without
OF.

Regards,
Bjorn

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

end of thread, other threads:[~2020-11-05  4:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-02  7:40 [PATCH] remoteproc/mtk_scp: surround DT device IDs with CONFIG_OF Alexandre Courbot
2020-11-04 19:05 ` Mathieu Poirier
2020-11-05  4:55   ` Bjorn Andersson

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