[PATCH] drm/i915: Fix Kconfig error for CONFIG_DRM_I915

Wang Jinchao wangjinchao at xfusion.com
Mon Aug 14 13:07:45 UTC 2023


On Mon, Aug 14, 2023 at 03:13:32PM +0300, Jani Nikula wrote:
> On Mon, 14 Aug 2023, Wang Jinchao <wangjinchao at xfusion.com> wrote:
> > On Mon, Aug 14, 2023 at 10:26:45AM +0300, Jani Nikula wrote:
> >> On Sat, 12 Aug 2023, Wang Jinchao <wangjinchao at xfusion.com> wrote:
> >> > When CONFIG_DRM_I915 is set to 'y' and CONFIG_BACKLIGHT_CLASS_DEVICE
> >> > is set to 'm', we encountered an ld.lld error during the build process:
> >> >
> >> > 	ld.lld: error: undefined symbol: backlight_device_get_by_name
> >> > 	>>> referenced by intel_backlight.c:955
> >> > 	>>>               vmlinux.o:(intel_backlight_device_register)
> >> >
> >> > 	ld.lld: error: undefined symbol: backlight_device_register
> >> > 	>>> referenced by intel_backlight.c:971
> >> > 	>>>               vmlinux.o:(intel_backlight_device_register)
> >> >
> >> > 	ld.lld: error: undefined symbol: backlight_device_unregister
> >> > 	>>> referenced by intel_backlight.c:999
> >> > 	>>>               vmlinux.o:(intel_backlight_device_unregister)
> >> >
> >> > This issue occurred because intel_backlight_device_register and
> >> > intel_backlight_device_unregister were enclosed within
> >> > However, according to Kconfig, CONFIG_DRM_I915 will select
> >> > BACKLIGHT_CLASS_DEVICE only if ACPI is enabled.
> >> > This led to an error, which can be resolved by removing the
> >> > conditional statements related to ACPI.
> >> 
> >> The real fix is to use
> >> 
> >> 	depends on BACKLIGHT_CLASS_DEVICE || BACKLIGHT_CLASS_DEVICE=n
> > it works.
> >> 
> >> but in order to do that, you need to change a lot of places to depend
> > Why, what are the other places?
> 
> Generally when you have a mixture of depends on and select on a kconfig
> symbol, you'll eventually end up with dependency problems.
> 
Using A to represent DRM_I915 and B to represent BACKLIGHT_CLASS_DEVICE, 
as both A and B are tristate options, all the possibilities include:

1. A=n, B=n
2. A=m, B=n
3. A=y, B=n
4. A=n, B=m
5. A=m, B=m
6. A=y, B=m
7. A=n, B=y
8. A=m, B=y
9. A=y, B=y
Among them, only the 6th case (A=y, B=m) would lead to a compilation failure.

Based on your suggestion, I tested the following configuration:

    config A
        tristate "A Option"
        depends on B || B=n
    
    config B
        tristate "B Option"

I tested it using menuconfig, and found that the 6th combination (A=y, B=m) 
cannot be manually selected.

Specifically, if B=m, A can only be selected as either n or m.
If A=y and B is set to m, A automatically changes to m as well.

I believe there is no issue with the solution you provided.
Is there something that I might have overlooked?

> BR,
> Jani.
> 
> 
> >> on, not select BACKLIGHT_CLASS_DEVICE, because otherwise you end up with
> > got it.
> >> other dependency issues.
> >> 
> >> BR,
> >> Jani.
> >> 
> >> >
> >> > Signed-off-by: Wang Jinchao <wangjinchao at xfusion.com>
> >> > ---
> >> >  drivers/gpu/drm/i915/Kconfig | 2 +-
> >> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >> >
> >> > diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
> >> > index 01b5a8272a27..5003de921bf7 100644
> >> > --- a/drivers/gpu/drm/i915/Kconfig
> >> > +++ b/drivers/gpu/drm/i915/Kconfig
> >> > @@ -24,7 +24,7 @@ config DRM_I915
> >> >  	select IRQ_WORK
> >> >  	# i915 depends on ACPI_VIDEO when ACPI is enabled
> >> >  	# but for select to work, need to select ACPI_VIDEO's dependencies, ick
> >> > -	select BACKLIGHT_CLASS_DEVICE if ACPI
> >> > +	select BACKLIGHT_CLASS_DEVICE
> >> >  	select INPUT if ACPI
> >> >  	select X86_PLATFORM_DEVICES if ACPI
> >> >  	select ACPI_WMI if ACPI
> >> 
> >> -- 
> >> Jani Nikula, Intel Open Source Graphics Center
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center


More information about the dri-devel mailing list