在 2021/7/28 下午7:30, Laurent Pinchart 写道:
On Wed, Jul 28, 2021 at 12:09:34PM +0100, Kieran Bingham wrote:
Hi Jackie,
On 28/07/2021 10:57, Jackie Liu wrote:
Hi Kieran.
How about this.
diff --git a/drivers/gpu/drm/rcar-du/Kconfig b/drivers/gpu/drm/rcar-du/Kconfig index b47e74421e34..14cf3e6415d7 100644 --- a/drivers/gpu/drm/rcar-du/Kconfig +++ b/drivers/gpu/drm/rcar-du/Kconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 config DRM_RCAR_DU tristate "DRM Support for R-Car Display Unit" - depends on DRM && OF + depends on DRM && OF && m depends on ARM || ARM64 depends on ARCH_RENESAS || COMPILE_TEST imply DRM_RCAR_CMM
Of course, this is not a good way, in fact, as long as rcar-du built-in, cmm must also be built-in, otherwise an error will be reported.
Correct, ideally we should enforce that if the RCAR_DU is built in (y), then the CMM can only be y/n and not m.
I thought that the depends on DRM_RCAR_DU should do that, but it appears it doesn't enforce the built-in rule to match...
Do you have a good way?
Kconfig-language.rst says:
Note: If the combination of FOO=y and BAR=m causes a link error, you can guard the function call with IS_REACHABLE()::
foo_init() { if (IS_REACHABLE(CONFIG_BAZ)) baz_register(&foo); ... }
But that seems redundant, so I suspect we could/should change the drivers/gpu/drm/rcar-du/rcar_cmm.h from:
#if IS_ENABLED(CONFIG_DRM_RCAR_CMM) to #if IS_REACHABLE(CONFIG_DRM_RCAR_CMM)
...
Seems odd that we might allow the module to be compiled at all if it won't be reachable and that we can't enforce that at the KConfig level - but at least IS_REACHABLE would prevent the linker error..
This has been discussed before:
https://lore.kernel.org/dri-devel/20200408202711.1198966-6-arnd@arndb.de/
Hi Laurent.
Thanks for tell me this.