linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: pl111: add CONFIG_VEXPRESS_CONFIG dependency
@ 2020-05-27 13:31 Arnd Bergmann
  2020-05-27 13:42 ` Linus Walleij
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Arnd Bergmann @ 2020-05-27 13:31 UTC (permalink / raw)
  To: Eric Anholt, David Airlie, Daniel Vetter, Rob Herring,
	Sam Ravnborg, Linus Walleij
  Cc: Arnd Bergmann, dri-devel, Alex Deucher, linux-kernel

The vexpress_config code fails to link in some configurations:

drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_versatile_init':
(.text+0x1f0): undefined reference to `devm_regmap_init_vexpress_config'

Add a dependency that links to this only if the dependency is there,
and prevent the configuration where the drm driver is built-in but
the config is a loadable module.

Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/pl111/Kconfig           | 1 +
 drivers/gpu/drm/pl111/pl111_versatile.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
index 80f6748055e3..33a005816fdd 100644
--- a/drivers/gpu/drm/pl111/Kconfig
+++ b/drivers/gpu/drm/pl111/Kconfig
@@ -3,6 +3,7 @@ config DRM_PL111
 	tristate "DRM Support for PL111 CLCD Controller"
 	depends on DRM
 	depends on ARM || ARM64 || COMPILE_TEST
+	depends on VEXPRESS_CONFIG || !VEXPRESS_CONFIG
 	depends on COMMON_CLK
 	select DRM_KMS_HELPER
 	select DRM_KMS_CMA_HELPER
diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c
index 64f01a4e6767..451d74205108 100644
--- a/drivers/gpu/drm/pl111/pl111_versatile.c
+++ b/drivers/gpu/drm/pl111/pl111_versatile.c
@@ -476,7 +476,8 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv)
 	versatile_clcd_type = (enum versatile_clcd)clcd_id->data;
 
 	/* Versatile Express special handling */
-	if (versatile_clcd_type == VEXPRESS_CLCD_V2M) {
+	if (IS_ENABLED(CONFIG_VEXPRESS_CONFIG) &&
+	    versatile_clcd_type == VEXPRESS_CLCD_V2M) {
 		int ret = pl111_vexpress_clcd_init(dev, np, priv);
 		of_node_put(np);
 		if (ret)
-- 
2.26.2


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

* Re: [PATCH] drm: pl111: add CONFIG_VEXPRESS_CONFIG dependency
  2020-05-27 13:31 [PATCH] drm: pl111: add CONFIG_VEXPRESS_CONFIG dependency Arnd Bergmann
@ 2020-05-27 13:42 ` Linus Walleij
  2020-05-27 14:52 ` Sam Ravnborg
  2020-05-28 21:36 ` Rob Herring
  2 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2020-05-27 13:42 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Eric Anholt, David Airlie, Daniel Vetter, Rob Herring,
	Sam Ravnborg, open list:DRM PANEL DRIVERS, Alex Deucher,
	linux-kernel

On Wed, May 27, 2020 at 3:32 PM Arnd Bergmann <arnd@arndb.de> wrote:
> The vexpress_config code fails to link in some configurations:
>
> drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_versatile_init':
> (.text+0x1f0): undefined reference to `devm_regmap_init_vexpress_config'
>
> Add a dependency that links to this only if the dependency is there,
> and prevent the configuration where the drm driver is built-in but
> the config is a loadable module.
>
> Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Rob will you apply this directly to the drm tree?

Yours,
Linus Walleij

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

* Re: [PATCH] drm: pl111: add CONFIG_VEXPRESS_CONFIG dependency
  2020-05-27 13:31 [PATCH] drm: pl111: add CONFIG_VEXPRESS_CONFIG dependency Arnd Bergmann
  2020-05-27 13:42 ` Linus Walleij
@ 2020-05-27 14:52 ` Sam Ravnborg
  2020-05-27 15:47   ` Arnd Bergmann
  2020-05-28 21:36 ` Rob Herring
  2 siblings, 1 reply; 7+ messages in thread
From: Sam Ravnborg @ 2020-05-27 14:52 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Eric Anholt, David Airlie, Daniel Vetter, Rob Herring,
	Linus Walleij, dri-devel, Alex Deucher, linux-kernel

Hi Arnd.

On Wed, May 27, 2020 at 03:31:42PM +0200, Arnd Bergmann wrote:
> The vexpress_config code fails to link in some configurations:
> 
> drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_versatile_init':
> (.text+0x1f0): undefined reference to `devm_regmap_init_vexpress_config'
> 
> Add a dependency that links to this only if the dependency is there,
> and prevent the configuration where the drm driver is built-in but
> the config is a loadable module.
> 
> Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Could this be another way to fix it:

diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c
index 64f01a4e6767..1c38d3bd2e84 100644
--- a/drivers/gpu/drm/pl111/pl111_versatile.c
+++ b/drivers/gpu/drm/pl111/pl111_versatile.c
@@ -379,7 +379,7 @@ static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np,
        u32 val;
        int ret;

-       if (!IS_ENABLED(CONFIG_VEXPRESS_CONFIG))
+       if (!IS_REACHABLE(CONFIG_VEXPRESS_CONFIG))
                return -ENODEV;

        /*


Then we no longer have the whole driver depending on
the value of VEXPRESS_CONFIG.
Not that I like IS_REACHABLE() but we already had
IS_ENABLED() to cover up here, and that was not enough.

With your patch would we then need the IS_ENABLED()
check?

	Sam

> ---
>  drivers/gpu/drm/pl111/Kconfig           | 1 +
>  drivers/gpu/drm/pl111/pl111_versatile.c | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
> index 80f6748055e3..33a005816fdd 100644
> --- a/drivers/gpu/drm/pl111/Kconfig
> +++ b/drivers/gpu/drm/pl111/Kconfig
> @@ -3,6 +3,7 @@ config DRM_PL111
>  	tristate "DRM Support for PL111 CLCD Controller"
>  	depends on DRM
>  	depends on ARM || ARM64 || COMPILE_TEST
> +	depends on VEXPRESS_CONFIG || !VEXPRESS_CONFIG
>  	depends on COMMON_CLK
>  	select DRM_KMS_HELPER
>  	select DRM_KMS_CMA_HELPER
> diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c
> index 64f01a4e6767..451d74205108 100644
> --- a/drivers/gpu/drm/pl111/pl111_versatile.c
> +++ b/drivers/gpu/drm/pl111/pl111_versatile.c
> @@ -476,7 +476,8 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv)
>  	versatile_clcd_type = (enum versatile_clcd)clcd_id->data;
>  
>  	/* Versatile Express special handling */
> -	if (versatile_clcd_type == VEXPRESS_CLCD_V2M) {
> +	if (IS_ENABLED(CONFIG_VEXPRESS_CONFIG) &&
> +	    versatile_clcd_type == VEXPRESS_CLCD_V2M) {
>  		int ret = pl111_vexpress_clcd_init(dev, np, priv);
>  		of_node_put(np);
>  		if (ret)
> -- 
> 2.26.2

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

* Re: [PATCH] drm: pl111: add CONFIG_VEXPRESS_CONFIG dependency
  2020-05-27 14:52 ` Sam Ravnborg
@ 2020-05-27 15:47   ` Arnd Bergmann
  2020-05-27 17:50     ` Sam Ravnborg
  0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2020-05-27 15:47 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Eric Anholt, David Airlie, Daniel Vetter, Rob Herring,
	Linus Walleij, dri-devel, Alex Deucher, linux-kernel

On Wed, May 27, 2020 at 4:52 PM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Arnd.
>
> On Wed, May 27, 2020 at 03:31:42PM +0200, Arnd Bergmann wrote:
> > The vexpress_config code fails to link in some configurations:
> >
> > drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_versatile_init':
> > (.text+0x1f0): undefined reference to `devm_regmap_init_vexpress_config'
> >
> > Add a dependency that links to this only if the dependency is there,
> > and prevent the configuration where the drm driver is built-in but
> > the config is a loadable module.
> >
> > Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Could this be another way to fix it:
>
> diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c
> index 64f01a4e6767..1c38d3bd2e84 100644
> --- a/drivers/gpu/drm/pl111/pl111_versatile.c
> +++ b/drivers/gpu/drm/pl111/pl111_versatile.c
> @@ -379,7 +379,7 @@ static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np,
>         u32 val;
>         int ret;
>
> -       if (!IS_ENABLED(CONFIG_VEXPRESS_CONFIG))
> +       if (!IS_REACHABLE(CONFIG_VEXPRESS_CONFIG))
>                 return -ENODEV;
>
>         /*
>
>
> Then we no longer have the whole driver depending on
> the value of VEXPRESS_CONFIG.
> Not that I like IS_REACHABLE() but we already had
> IS_ENABLED() to cover up here, and that was not enough.
>
> With your patch would we then need the IS_ENABLED()
> check?

The IS_ENABLED() check is what I'm adding, not removing. I'd still
the Kconfig dependency combined with that check over
IS_REACHABLE(), which is more likely to silently not work.

       Arnd

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

* Re: [PATCH] drm: pl111: add CONFIG_VEXPRESS_CONFIG dependency
  2020-05-27 15:47   ` Arnd Bergmann
@ 2020-05-27 17:50     ` Sam Ravnborg
  2020-05-27 19:03       ` Arnd Bergmann
  0 siblings, 1 reply; 7+ messages in thread
From: Sam Ravnborg @ 2020-05-27 17:50 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: David Airlie, linux-kernel, dri-devel, Alex Deucher

Hi Arnd.

On Wed, May 27, 2020 at 05:47:21PM +0200, Arnd Bergmann wrote:
> On Wed, May 27, 2020 at 4:52 PM Sam Ravnborg <sam@ravnborg.org> wrote:
> >
> > Hi Arnd.
> >
> > On Wed, May 27, 2020 at 03:31:42PM +0200, Arnd Bergmann wrote:
> > > The vexpress_config code fails to link in some configurations:
> > >
> > > drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_versatile_init':
> > > (.text+0x1f0): undefined reference to `devm_regmap_init_vexpress_config'
> > >
> > > Add a dependency that links to this only if the dependency is there,
> > > and prevent the configuration where the drm driver is built-in but
> > > the config is a loadable module.
> > >
> > > Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >
> > Could this be another way to fix it:
> >
> > diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c
> > index 64f01a4e6767..1c38d3bd2e84 100644
> > --- a/drivers/gpu/drm/pl111/pl111_versatile.c
> > +++ b/drivers/gpu/drm/pl111/pl111_versatile.c
> > @@ -379,7 +379,7 @@ static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np,
> >         u32 val;
> >         int ret;
> >
> > -       if (!IS_ENABLED(CONFIG_VEXPRESS_CONFIG))
> > +       if (!IS_REACHABLE(CONFIG_VEXPRESS_CONFIG))
> >                 return -ENODEV;
> >
> >         /*
> >
> >
> > Then we no longer have the whole driver depending on
> > the value of VEXPRESS_CONFIG.
> > Not that I like IS_REACHABLE() but we already had
> > IS_ENABLED() to cover up here, and that was not enough.
> >
> > With your patch would we then need the IS_ENABLED()
> > check?
> 
> The IS_ENABLED() check is what I'm adding, not removing. I'd still
> the Kconfig dependency combined with that check over
> IS_REACHABLE(), which is more likely to silently not work.

Then the now redundant IS_ENABLED() check should go.
With you patch it looks like this:

	...
	if (IS_ENABLED(CONFIG_VEXPRESS_CONFIG) && ...)
		pl111_vexpress_clcd_init()


And in pl111_vexpress_clcd_init() we have:

{
	if (!IS_ENABLED(CONFIG_VEXPRESS_CONFIG))
		return -ENODEV;

The IS_ENABLED() in pl111_vexpress_clcd_init() is redundant
and the patch should drop it.

	Sam

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

* Re: [PATCH] drm: pl111: add CONFIG_VEXPRESS_CONFIG dependency
  2020-05-27 17:50     ` Sam Ravnborg
@ 2020-05-27 19:03       ` Arnd Bergmann
  0 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2020-05-27 19:03 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: David Airlie, linux-kernel, dri-devel, Alex Deucher

On Wed, May 27, 2020 at 7:50 PM Sam Ravnborg <sam@ravnborg.org> wrote:
> On Wed, May 27, 2020 at 05:47:21PM +0200, Arnd Bergmann wrote:
> > On Wed, May 27, 2020 at 4:52 PM Sam Ravnborg <sam@ravnborg.org> wrote:
> > >
> > > Hi Arnd.
> > >
> > > On Wed, May 27, 2020 at 03:31:42PM +0200, Arnd Bergmann wrote:
> > > > The vexpress_config code fails to link in some configurations:
> > > >
> > > > drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_versatile_init':
> > > > (.text+0x1f0): undefined reference to `devm_regmap_init_vexpress_config'
> > > >
> > > > Add a dependency that links to this only if the dependency is there,
> > > > and prevent the configuration where the drm driver is built-in but
> > > > the config is a loadable module.
> > > >
> > > > Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
> > > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > >
> > > Could this be another way to fix it:
> > >
> > > diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c
> > > index 64f01a4e6767..1c38d3bd2e84 100644
> > > --- a/drivers/gpu/drm/pl111/pl111_versatile.c
> > > +++ b/drivers/gpu/drm/pl111/pl111_versatile.c
> > > @@ -379,7 +379,7 @@ static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np,
> > >         u32 val;
> > >         int ret;
> > >
> > > -       if (!IS_ENABLED(CONFIG_VEXPRESS_CONFIG))
> > > +       if (!IS_REACHABLE(CONFIG_VEXPRESS_CONFIG))
> > >                 return -ENODEV;
> > >
> > >         /*
> > >
> > >
> > > Then we no longer have the whole driver depending on
> > > the value of VEXPRESS_CONFIG.
> > > Not that I like IS_REACHABLE() but we already had
> > > IS_ENABLED() to cover up here, and that was not enough.
> > >
> > > With your patch would we then need the IS_ENABLED()
> > > check?
> >
> > The IS_ENABLED() check is what I'm adding, not removing. I'd still
> > the Kconfig dependency combined with that check over
> > IS_REACHABLE(), which is more likely to silently not work.
>
> Then the now redundant IS_ENABLED() check should go.
> With you patch it looks like this:
>
>         ...
>         if (IS_ENABLED(CONFIG_VEXPRESS_CONFIG) && ...)
>                 pl111_vexpress_clcd_init()
>
>
> And in pl111_vexpress_clcd_init() we have:
>
> {
>         if (!IS_ENABLED(CONFIG_VEXPRESS_CONFIG))
>                 return -ENODEV;
>
> The IS_ENABLED() in pl111_vexpress_clcd_init() is redundant
> and the patch should drop it.

Ah I see your point now, sorry I missed the double IS_ENABLED()
check at first. I'll remove the second one from my patch and
resubmit after some more build testing then.

        Arnd

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

* Re: [PATCH] drm: pl111: add CONFIG_VEXPRESS_CONFIG dependency
  2020-05-27 13:31 [PATCH] drm: pl111: add CONFIG_VEXPRESS_CONFIG dependency Arnd Bergmann
  2020-05-27 13:42 ` Linus Walleij
  2020-05-27 14:52 ` Sam Ravnborg
@ 2020-05-28 21:36 ` Rob Herring
  2 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2020-05-28 21:36 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Eric Anholt, David Airlie, Daniel Vetter, Sam Ravnborg,
	Linus Walleij, dri-devel, Alex Deucher, linux-kernel

On Wed, May 27, 2020 at 7:32 AM Arnd Bergmann <arnd@arndb.de> wrote:
>
> The vexpress_config code fails to link in some configurations:
>
> drivers/gpu/drm/pl111/pl111_versatile.o: in function `pl111_versatile_init':
> (.text+0x1f0): undefined reference to `devm_regmap_init_vexpress_config'
>
> Add a dependency that links to this only if the dependency is there,
> and prevent the configuration where the drm driver is built-in but
> the config is a loadable module.
>
> Fixes: 826fc86b5903 ("drm: pl111: Move VExpress setup into versatile init")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpu/drm/pl111/Kconfig           | 1 +
>  drivers/gpu/drm/pl111/pl111_versatile.c | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
> index 80f6748055e3..33a005816fdd 100644
> --- a/drivers/gpu/drm/pl111/Kconfig
> +++ b/drivers/gpu/drm/pl111/Kconfig
> @@ -3,6 +3,7 @@ config DRM_PL111
>         tristate "DRM Support for PL111 CLCD Controller"
>         depends on DRM
>         depends on ARM || ARM64 || COMPILE_TEST
> +       depends on VEXPRESS_CONFIG || !VEXPRESS_CONFIG

That's really non-obvious. Sometimes I hate kconfig. Thanks for fixing my mess.

Rob

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

end of thread, other threads:[~2020-05-28 21:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 13:31 [PATCH] drm: pl111: add CONFIG_VEXPRESS_CONFIG dependency Arnd Bergmann
2020-05-27 13:42 ` Linus Walleij
2020-05-27 14:52 ` Sam Ravnborg
2020-05-27 15:47   ` Arnd Bergmann
2020-05-27 17:50     ` Sam Ravnborg
2020-05-27 19:03       ` Arnd Bergmann
2020-05-28 21:36 ` Rob Herring

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