linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [SUBMITTED 20210721] fbdev: simplefb: fix Kconfig dependencies
@ 2021-09-28 14:52 Arnd Bergmann
  2021-09-29  8:14 ` Thomas Zimmermann
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2021-09-28 14:52 UTC (permalink / raw)
  To: Daniel Vetter, Maxime Ripard, Thomas Zimmermann
  Cc: Arnd Bergmann, Rob Herring, Rob Herring, Frank Rowand, devicetree,
	linux-kernel, dri-devel, linux-fbdev

From: Arnd Bergmann <arnd@arndb.de>

Configurations with both CONFIG_FB_SIMPLE=y and CONFIG_DRM_SIMPLEDRM=m
are allowed by Kconfig because the 'depends on !DRM_SIMPLEDRM' dependency
does not disallow FB_SIMPLE as long as SIMPLEDRM is not built-in. This
can however result in a build failure when cfb_fillrect() etc are then
also in loadable modules:

x86_64-linux-ld: drivers/video/fbdev/simplefb.o:(.rodata+0x1f8): undefined reference to `cfb_fillrect'
x86_64-linux-ld: drivers/video/fbdev/simplefb.o:(.rodata+0x200): undefined reference to `cfb_copyarea'
x86_64-linux-ld: drivers/video/fbdev/simplefb.o:(.rodata+0x208): undefined reference to `cfb_imageblit'

To work around this, change FB_SIMPLE to be a 'tristate' symbol,
which still allows both to be =m together, but not one of them to
be =y if the other one is =m. If a distro kernel picks this
configuration, it can be determined by local policy which of
the two modules gets loaded. The 'of_chosen' export is needed
as this is the first loadable module referencing it.

Alternatively, the Kconfig dependency could be changed to
'depends on DRM_SIMPLEDRM=n', which would forbid the configuration
with both drivers.

Fixes: 11e8f5fd223b ("drm: Add simpledrm driver")
Acked-by: Rob Herring <robh@kernel.org> # for drivers/of/
Link: https://lore.kernel.org/all/20210721151839.2484245-1-arnd@kernel.org/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/of/base.c           | 1 +
 drivers/video/fbdev/Kconfig | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index f720c0d246f2..0ac17256258d 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -36,6 +36,7 @@ LIST_HEAD(aliases_lookup);
 struct device_node *of_root;
 EXPORT_SYMBOL(of_root);
 struct device_node *of_chosen;
+EXPORT_SYMBOL(of_chosen);
 struct device_node *of_aliases;
 struct device_node *of_stdout;
 static const char *of_stdout_options;
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index b26b79dfcac9..6ed5e608dd04 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -2193,8 +2193,9 @@ config FB_HYPERV
 	  This framebuffer driver supports Microsoft Hyper-V Synthetic Video.
 
 config FB_SIMPLE
-	bool "Simple framebuffer support"
-	depends on (FB = y) && !DRM_SIMPLEDRM
+	tristate "Simple framebuffer support"
+	depends on FB
+	depends on !DRM_SIMPLEDRM
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
-- 
2.29.2


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

* Re: [PATCH] [SUBMITTED 20210721] fbdev: simplefb: fix Kconfig dependencies
  2021-09-28 14:52 [PATCH] [SUBMITTED 20210721] fbdev: simplefb: fix Kconfig dependencies Arnd Bergmann
@ 2021-09-29  8:14 ` Thomas Zimmermann
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Zimmermann @ 2021-09-29  8:14 UTC (permalink / raw)
  To: Arnd Bergmann, Daniel Vetter, Maxime Ripard
  Cc: Arnd Bergmann, Rob Herring, Rob Herring, Frank Rowand, devicetree,
	linux-kernel, dri-devel, linux-fbdev


[-- Attachment #1.1: Type: text/plain, Size: 3070 bytes --]

Hi

Am 28.09.21 um 16:52 schrieb Arnd Bergmann:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Configurations with both CONFIG_FB_SIMPLE=y and CONFIG_DRM_SIMPLEDRM=m
> are allowed by Kconfig because the 'depends on !DRM_SIMPLEDRM' dependency
> does not disallow FB_SIMPLE as long as SIMPLEDRM is not built-in. This
> can however result in a build failure when cfb_fillrect() etc are then
> also in loadable modules:
> 
> x86_64-linux-ld: drivers/video/fbdev/simplefb.o:(.rodata+0x1f8): undefined reference to `cfb_fillrect'
> x86_64-linux-ld: drivers/video/fbdev/simplefb.o:(.rodata+0x200): undefined reference to `cfb_copyarea'
> x86_64-linux-ld: drivers/video/fbdev/simplefb.o:(.rodata+0x208): undefined reference to `cfb_imageblit'
> 
> To work around this, change FB_SIMPLE to be a 'tristate' symbol,
> which still allows both to be =m together, but not one of them to
> be =y if the other one is =m. If a distro kernel picks this
> configuration, it can be determined by local policy which of
> the two modules gets loaded. The 'of_chosen' export is needed
> as this is the first loadable module referencing it.
> 
> Alternatively, the Kconfig dependency could be changed to
> 'depends on DRM_SIMPLEDRM=n', which would forbid the configuration
> with both drivers.
> 
> Fixes: 11e8f5fd223b ("drm: Add simpledrm driver")
> Acked-by: Rob Herring <robh@kernel.org> # for drivers/of/
> Link: https://lore.kernel.org/all/20210721151839.2484245-1-arnd@kernel.org/
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

I've added a few CC tags and merged the patch into drm-misc-fixes. 
Thanks for your patience and perseverance.

Best regards
Thomas

> ---
>   drivers/of/base.c           | 1 +
>   drivers/video/fbdev/Kconfig | 5 +++--
>   2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index f720c0d246f2..0ac17256258d 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -36,6 +36,7 @@ LIST_HEAD(aliases_lookup);
>   struct device_node *of_root;
>   EXPORT_SYMBOL(of_root);
>   struct device_node *of_chosen;
> +EXPORT_SYMBOL(of_chosen);
>   struct device_node *of_aliases;
>   struct device_node *of_stdout;
>   static const char *of_stdout_options;
> diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
> index b26b79dfcac9..6ed5e608dd04 100644
> --- a/drivers/video/fbdev/Kconfig
> +++ b/drivers/video/fbdev/Kconfig
> @@ -2193,8 +2193,9 @@ config FB_HYPERV
>   	  This framebuffer driver supports Microsoft Hyper-V Synthetic Video.
>   
>   config FB_SIMPLE
> -	bool "Simple framebuffer support"
> -	depends on (FB = y) && !DRM_SIMPLEDRM
> +	tristate "Simple framebuffer support"
> +	depends on FB
> +	depends on !DRM_SIMPLEDRM
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

end of thread, other threads:[~2021-09-29  8:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-28 14:52 [PATCH] [SUBMITTED 20210721] fbdev: simplefb: fix Kconfig dependencies Arnd Bergmann
2021-09-29  8:14 ` Thomas Zimmermann

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