Skip to contentSkip to conversation

drm,fbdev: Fix module dependencies

PATCH Superseded Thomas Zimmermann 7 participants 22 messages Dec 12, 2024 – Dec 22, 2024

Subsystems (9)
DRM drivers DRM misc PowerPC Staging +5 more subsystems

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

v2 cover drm,fbdev: Fix module dependencies

Fix the dependencies among the various graphics modules.

Before addressing the FB_CORE issue, patch 1 first resolves a problem with BACKLIGHT_CLASS_DEVICE. A number of fbdev drivers select it, which results in a recursive-dependency error after patch has been applied. Making these drivers (or parts of them) depend on BACKLIGHT_CLASS_DEVICE fixes this.

Patch 2 selects FB_CORE for DRM_GEM_DMA_HELPER and DRM_TTM_HELPER. This is necessary with the recently added DRM client library.

Patch 3 is the second half of the patch provided by Arnd at [1]. It could not yet be merged because of the issues fixed by patch 1.

Side note: For the majority of graphics drivers, backlight functionality depends on BACKLIGHT_CLASS_DEVICE. In a few cases drivers select the Kconfig token automatically. These drivers should be updated to depends on the token as well, such that backlight functionality is fully user- controlled.

v2:
- s/BACKLIGHT_DEVICE_CLASS/BACKLIGHT_CLASS_DEVICE (Helge)
- Fix fbdev driver-dependency corner case (Arnd)

[1] https://patchwork.freedesktop.org/series/141411/

Arnd Bergmann (1):
drm: rework FB_CORE dependency

Thomas Zimmermann (2):
fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE drm/fbdev: Select FB_CORE dependency for fbdev on DMA and TTM

 drivers/auxdisplay/Kconfig       |  2 +-
 drivers/gpu/drm/Kconfig          |  3 +++
 drivers/macintosh/Kconfig        |  1 +
 drivers/staging/fbtft/Kconfig    |  1 +
 drivers/video/fbdev/Kconfig      | 18 +++++++++++++-----
 drivers/video/fbdev/core/Kconfig |  3 +--
 6 files changed, 20 insertions(+), 8 deletions(-)
Signature · 1 line
2.47.1
author maintainer
#1 lore raw

PATCH v2 1/3 fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

Do not select BACKLIGHT_CLASS_DEVICE from FB_BACKLIGHT. The latter only controls backlight support within fbdev core code and data structures.

Make fbdev drivers depend on BACKLIGHT_CLASS_DEVICE and let users select it explicitly. Fixes warnings about recursive dependencies, such as

error: recursive dependency detected!
symbol BACKLIGHT_CLASS_DEVICE is selected by FB_BACKLIGHT symbol FB_BACKLIGHT is selected by FB_SH_MOBILE_LCDC symbol FB_SH_MOBILE_LCDC depends on FB_DEVICE
symbol FB_DEVICE depends on FB_CORE
symbol FB_CORE is selected by DRM_GEM_DMA_HELPER symbol DRM_GEM_DMA_HELPER is selected by DRM_PANEL_ILITEK_ILI9341 symbol DRM_PANEL_ILITEK_ILI9341 depends on BACKLIGHT_CLASS_DEVICE

BACKLIGHT_CLASS_DEVICE is user-selectable, so making drivers adapt to it is the correct approach in any case. For most drivers, backlight support is also configurable separately.

v2:
- s/BACKLIGHT_DEVICE_CLASS/BACKLIGHT_CLASS_DEVICE (Helge)
- Fix fbdev driver-dependency corner case (Arnd)

---
 drivers/auxdisplay/Kconfig       |  2 +-
 drivers/macintosh/Kconfig        |  1 +
 drivers/staging/fbtft/Kconfig    |  1 +
 drivers/video/fbdev/Kconfig      | 18 +++++++++++++-----
 drivers/video/fbdev/core/Kconfig |  3 +--
 5 files changed, 17 insertions(+), 8 deletions(-)
drivers/auxdisplay/Kconfig +1 -1
index 21545ffba065..8934e6ad5772 100644
@@ -489,7 +489,7 @@ config IMG_ASCII_LCD
 
 config HT16K33
 	tristate "Holtek Ht16K33 LED controller with keyscan"
-	depends on FB && I2C && INPUT
+	depends on FB && I2C && INPUT && BACKLIGHT_CLASS_DEVICE
 	select FB_SYSMEM_HELPERS
 	select INPUT_MATRIXKMAP
 	select FB_BACKLIGHT
drivers/macintosh/Kconfig +1 -0
index fb38f684444f..bf3824032d61 100644
@@ -120,6 +120,7 @@ config PMAC_MEDIABAY
 config PMAC_BACKLIGHT
 	bool "Backlight control for LCD screens"
 	depends on PPC_PMAC && ADB_PMU && FB = y && (BROKEN || !PPC64)
+	depends on BACKLIGHT_CLASS_DEVICE
 	select FB_BACKLIGHT
 	help
 	  Say Y here to enable Macintosh specific extensions of the generic
drivers/staging/fbtft/Kconfig +1 -0
index 77ab44362f16..dcf6a70455cc 100644
@@ -3,6 +3,7 @@ menuconfig FB_TFT
 	tristate "Support for small TFT LCD display modules"
 	depends on FB && SPI
 	depends on FB_DEVICE
+	depends on BACKLIGHT_CLASS_DEVICE
 	depends on GPIOLIB || COMPILE_TEST
 	select FB_BACKLIGHT
 	select FB_SYSMEM_HELPERS_DEFERRED
drivers/video/fbdev/Kconfig +13 -5
index de035071fedb..55c6686f091e 100644
@@ -649,6 +649,7 @@ config FB_S1D13XXX
 config FB_ATMEL
 	tristate "AT91 LCD Controller support"
 	depends on FB && OF && HAVE_CLK && HAS_IOMEM
+	depends on BACKLIGHT_CLASS_DEVICE
 	depends on HAVE_FB_ATMEL || COMPILE_TEST
 	select FB_BACKLIGHT
 	select FB_IOMEM_HELPERS
@@ -660,7 +661,6 @@ config FB_ATMEL
 config FB_NVIDIA
 	tristate "nVidia Framebuffer Support"
 	depends on FB && PCI
-	select FB_BACKLIGHT if FB_NVIDIA_BACKLIGHT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -700,6 +700,8 @@ config FB_NVIDIA_DEBUG
 config FB_NVIDIA_BACKLIGHT
 	bool "Support for backlight control"
 	depends on FB_NVIDIA
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_NVIDIA
+	select FB_BACKLIGHT
 	default y
 	help
 	  Say Y here if you want to control the backlight of your display.
@@ -707,7 +709,6 @@ config FB_NVIDIA_BACKLIGHT
 config FB_RIVA
 	tristate "nVidia Riva support"
 	depends on FB && PCI
-	select FB_BACKLIGHT if FB_RIVA_BACKLIGHT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -747,6 +748,8 @@ config FB_RIVA_DEBUG
 config FB_RIVA_BACKLIGHT
 	bool "Support for backlight control"
 	depends on FB_RIVA
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_RIVA
+	select FB_BACKLIGHT
 	default y
 	help
 	  Say Y here if you want to control the backlight of your display.
@@ -934,7 +937,6 @@ config FB_MATROX_MAVEN
 config FB_RADEON
 	tristate "ATI Radeon display support"
 	depends on FB && PCI
-	select FB_BACKLIGHT if FB_RADEON_BACKLIGHT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -960,6 +962,8 @@ config FB_RADEON_I2C
 config FB_RADEON_BACKLIGHT
 	bool "Support for backlight control"
 	depends on FB_RADEON
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_RADEON
+	select FB_BACKLIGHT
 	default y
 	help
 	  Say Y here if you want to control the backlight of your display.
@@ -975,7 +979,6 @@ config FB_RADEON_DEBUG
 config FB_ATY128
 	tristate "ATI Rage128 display support"
 	depends on FB && PCI
-	select FB_BACKLIGHT if FB_ATY128_BACKLIGHT
 	select FB_IOMEM_HELPERS
 	select FB_MACMODES if PPC_PMAC
 	help
@@ -989,6 +992,8 @@ config FB_ATY128
 config FB_ATY128_BACKLIGHT
 	bool "Support for backlight control"
 	depends on FB_ATY128
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_ATY128
+	select FB_BACKLIGHT
 	default y
 	help
 	  Say Y here if you want to control the backlight of your display.
@@ -999,7 +1004,6 @@ config FB_ATY
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
-	select FB_BACKLIGHT if FB_ATY_BACKLIGHT
 	select FB_IOMEM_FOPS
 	select FB_MACMODES if PPC
 	select FB_ATY_CT if SPARC64 && PCI
@@ -1040,6 +1044,8 @@ config FB_ATY_GX
 config FB_ATY_BACKLIGHT
 	bool "Support for backlight control"
 	depends on FB_ATY
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_ATY
+	select FB_BACKLIGHT
 	default y
 	help
 	  Say Y here if you want to control the backlight of your display.
@@ -1528,6 +1534,7 @@ config FB_SH_MOBILE_LCDC
 	depends on FB && HAVE_CLK && HAS_IOMEM
 	depends on SUPERH || COMPILE_TEST
 	depends on FB_DEVICE
+	depends on BACKLIGHT_CLASS_DEVICE
 	select FB_BACKLIGHT
 	select FB_DEFERRED_IO
 	select FB_DMAMEM_HELPERS
@@ -1793,6 +1800,7 @@ config FB_SSD1307
 	tristate "Solomon SSD1307 framebuffer support"
 	depends on FB && I2C
 	depends on GPIOLIB || COMPILE_TEST
+	depends on BACKLIGHT_CLASS_DEVICE
 	select FB_BACKLIGHT
 	select FB_SYSMEM_HELPERS_DEFERRED
 	help
drivers/video/fbdev/core/Kconfig +1 -2
index 0ab8848ba2f1..d554d8c543d4 100644
@@ -183,9 +183,8 @@ config FB_SYSMEM_HELPERS_DEFERRED
 	select FB_SYSMEM_HELPERS
 
 config FB_BACKLIGHT
-	tristate
+	bool
 	depends on FB
-	select BACKLIGHT_CLASS_DEVICE
 
 config FB_MODE_HELPERS
 	bool "Enable Video Mode Handling Helpers"
Signature · 1 line
2.47.1
maintainer
#2 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

Quoted 7 lines · Thomas Zimmermann

Do not select BACKLIGHT_CLASS_DEVICE from FB_BACKLIGHT. The latter only controls backlight support within fbdev core code and data structures.

Make fbdev drivers depend on BACKLIGHT_CLASS_DEVICE and let users select it explicitly. Fixes warnings about recursive dependencies, such as [...]

I think in the fbdev drivers themselves you should do:
select BACKLIGHT_CLASS_DEVICE
instead of "depending" on it.
This is the way as it's done in the DRM tiny and the i915/gma500 DRM drivers.

So, something like:

--- a/drivers/staging/fbtft/Kconfig
tristate "Support for small TFT LCD display modules" depends on FB && SPI
depends on FB_DEVICE
+ select BACKLIGHT_DEVICE_CLASS

       depends on GPIOLIB || COMPILE_TEST
       select FB_BACKLIGHT

config FB_BACKLIGHT
tristate
depends on FB
- select BACKLIGHT_CLASS_DEVICE
+ depends on BACKLIGHT_CLASS_DEVICE

Would that fix the dependency warning?

Helge

Quoted 192 lines

error: recursive dependency detected!
symbol BACKLIGHT_CLASS_DEVICE is selected by FB_BACKLIGHT symbol FB_BACKLIGHT is selected by FB_SH_MOBILE_LCDC symbol FB_SH_MOBILE_LCDC depends on FB_DEVICE
symbol FB_DEVICE depends on FB_CORE
symbol FB_CORE is selected by DRM_GEM_DMA_HELPER symbol DRM_GEM_DMA_HELPER is selected by DRM_PANEL_ILITEK_ILI9341 symbol DRM_PANEL_ILITEK_ILI9341 depends on BACKLIGHT_CLASS_DEVICE

BACKLIGHT_CLASS_DEVICE is user-selectable, so making drivers adapt to it is the correct approach in any case. For most drivers, backlight support is also configurable separately.

v2:
- s/BACKLIGHT_DEVICE_CLASS/BACKLIGHT_CLASS_DEVICE (Helge)
- Fix fbdev driver-dependency corner case (Arnd)

---
  drivers/auxdisplay/Kconfig       |  2 +-
  drivers/macintosh/Kconfig        |  1 +
  drivers/staging/fbtft/Kconfig    |  1 +
  drivers/video/fbdev/Kconfig      | 18 +++++++++++++-----
  drivers/video/fbdev/core/Kconfig |  3 +--
  5 files changed, 17 insertions(+), 8 deletions(-)
drivers/auxdisplay/Kconfig +1 -1
index 21545ffba065..8934e6ad5772 100644
@@ -489,7 +489,7 @@ config IMG_ASCII_LCD
 
  config HT16K33
  	tristate "Holtek Ht16K33 LED controller with keyscan"
-	depends on FB && I2C && INPUT
+	depends on FB && I2C && INPUT && BACKLIGHT_CLASS_DEVICE
  	select FB_SYSMEM_HELPERS
  	select INPUT_MATRIXKMAP
  	select FB_BACKLIGHT
drivers/macintosh/Kconfig +1 -0
index fb38f684444f..bf3824032d61 100644
@@ -120,6 +120,7 @@ config PMAC_MEDIABAY
  config PMAC_BACKLIGHT
  	bool "Backlight control for LCD screens"
  	depends on PPC_PMAC && ADB_PMU && FB = y && (BROKEN || !PPC64)
+	depends on BACKLIGHT_CLASS_DEVICE
  	select FB_BACKLIGHT
  	help
  	  Say Y here to enable Macintosh specific extensions of the generic
drivers/staging/fbtft/Kconfig +1 -0
index 77ab44362f16..dcf6a70455cc 100644
@@ -3,6 +3,7 @@ menuconfig FB_TFT
  	tristate "Support for small TFT LCD display modules"
  	depends on FB && SPI
  	depends on FB_DEVICE
+	depends on BACKLIGHT_CLASS_DEVICE
  	depends on GPIOLIB || COMPILE_TEST
  	select FB_BACKLIGHT
  	select FB_SYSMEM_HELPERS_DEFERRED
drivers/video/fbdev/Kconfig +13 -5
index de035071fedb..55c6686f091e 100644
@@ -649,6 +649,7 @@ config FB_S1D13XXX
  config FB_ATMEL
  	tristate "AT91 LCD Controller support"
  	depends on FB && OF && HAVE_CLK && HAS_IOMEM
+	depends on BACKLIGHT_CLASS_DEVICE
  	depends on HAVE_FB_ATMEL || COMPILE_TEST
  	select FB_BACKLIGHT
  	select FB_IOMEM_HELPERS
@@ -660,7 +661,6 @@ config FB_ATMEL
  config FB_NVIDIA
  	tristate "nVidia Framebuffer Support"
  	depends on FB && PCI
-	select FB_BACKLIGHT if FB_NVIDIA_BACKLIGHT
  	select FB_CFB_FILLRECT
  	select FB_CFB_COPYAREA
  	select FB_CFB_IMAGEBLIT
@@ -700,6 +700,8 @@ config FB_NVIDIA_DEBUG
  config FB_NVIDIA_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_NVIDIA
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_NVIDIA
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -707,7 +709,6 @@ config FB_NVIDIA_BACKLIGHT
  config FB_RIVA
  	tristate "nVidia Riva support"
  	depends on FB && PCI
-	select FB_BACKLIGHT if FB_RIVA_BACKLIGHT
  	select FB_CFB_FILLRECT
  	select FB_CFB_COPYAREA
  	select FB_CFB_IMAGEBLIT
@@ -747,6 +748,8 @@ config FB_RIVA_DEBUG
  config FB_RIVA_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_RIVA
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_RIVA
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -934,7 +937,6 @@ config FB_MATROX_MAVEN
  config FB_RADEON
  	tristate "ATI Radeon display support"
  	depends on FB && PCI
-	select FB_BACKLIGHT if FB_RADEON_BACKLIGHT
  	select FB_CFB_FILLRECT
  	select FB_CFB_COPYAREA
  	select FB_CFB_IMAGEBLIT
@@ -960,6 +962,8 @@ config FB_RADEON_I2C
  config FB_RADEON_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_RADEON
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_RADEON
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -975,7 +979,6 @@ config FB_RADEON_DEBUG
  config FB_ATY128
  	tristate "ATI Rage128 display support"
  	depends on FB && PCI
-	select FB_BACKLIGHT if FB_ATY128_BACKLIGHT
  	select FB_IOMEM_HELPERS
  	select FB_MACMODES if PPC_PMAC
  	help
@@ -989,6 +992,8 @@ config FB_ATY128
  config FB_ATY128_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_ATY128
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_ATY128
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -999,7 +1004,6 @@ config FB_ATY
  	select FB_CFB_FILLRECT
  	select FB_CFB_COPYAREA
  	select FB_CFB_IMAGEBLIT
-	select FB_BACKLIGHT if FB_ATY_BACKLIGHT
  	select FB_IOMEM_FOPS
  	select FB_MACMODES if PPC
  	select FB_ATY_CT if SPARC64 && PCI
@@ -1040,6 +1044,8 @@ config FB_ATY_GX
  config FB_ATY_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_ATY
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_ATY
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -1528,6 +1534,7 @@ config FB_SH_MOBILE_LCDC
  	depends on FB && HAVE_CLK && HAS_IOMEM
  	depends on SUPERH || COMPILE_TEST
  	depends on FB_DEVICE
+	depends on BACKLIGHT_CLASS_DEVICE
  	select FB_BACKLIGHT
  	select FB_DEFERRED_IO
  	select FB_DMAMEM_HELPERS
@@ -1793,6 +1800,7 @@ config FB_SSD1307
  	tristate "Solomon SSD1307 framebuffer support"
  	depends on FB && I2C
  	depends on GPIOLIB || COMPILE_TEST
+	depends on BACKLIGHT_CLASS_DEVICE
  	select FB_BACKLIGHT
  	select FB_SYSMEM_HELPERS_DEFERRED
  	help
drivers/video/fbdev/core/Kconfig +1 -2
index 0ab8848ba2f1..d554d8c543d4 100644
@@ -183,9 +183,8 @@ config FB_SYSMEM_HELPERS_DEFERRED
  	select FB_SYSMEM_HELPERS
 
  config FB_BACKLIGHT
-	tristate
+	bool
  	depends on FB
-	select BACKLIGHT_CLASS_DEVICE
 
  config FB_MODE_HELPERS
  	bool "Enable Video Mode Handling Helpers"
#3 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

Quoted 24 lines · Helge Deller
Quoted 7 lines · Thomas Zimmermann

Do not select BACKLIGHT_CLASS_DEVICE from FB_BACKLIGHT. The latter only controls backlight support within fbdev core code and data structures.

Make fbdev drivers depend on BACKLIGHT_CLASS_DEVICE and let users select it explicitly. Fixes warnings about recursive dependencies, such as [...]

I think in the fbdev drivers themselves you should do:
select BACKLIGHT_CLASS_DEVICE
instead of "depending" on it.
This is the way as it's done in the DRM tiny and the i915/gma500 DRM drivers.

So, something like:

--- a/drivers/staging/fbtft/Kconfig
tristate "Support for small TFT LCD display modules" depends on FB && SPI
depends on FB_DEVICE
+ select BACKLIGHT_DEVICE_CLASS

        depends on GPIOLIB || COMPILE_TEST
        select FB_BACKLIGHT
Quoted 8 lines

config FB_BACKLIGHT
tristate
depends on FB
- select BACKLIGHT_CLASS_DEVICE
+ depends on BACKLIGHT_CLASS_DEVICE

Would that fix the dependency warning?

The above is generally a mistake and the root cause of the dependency loops. With very few exceptions, the solution in these cases is to find the inconsistent 'select' and change it into 'depends on'.

I actually have a few more patches like this that I've been carrying for years now, e.g. one that changes all the 'select I2C' into appropriate dependencies.

Arnd

#4 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

Quoted 32 lines · Arnd Bergmann
Quoted 31 lines · Helge Deller
Quoted 7 lines · Thomas Zimmermann

Do not select BACKLIGHT_CLASS_DEVICE from FB_BACKLIGHT. The latter only controls backlight support within fbdev core code and data structures.

Make fbdev drivers depend on BACKLIGHT_CLASS_DEVICE and let users select it explicitly. Fixes warnings about recursive dependencies, such as [...]

I think in the fbdev drivers themselves you should do:
select BACKLIGHT_CLASS_DEVICE
instead of "depending" on it.
This is the way as it's done in the DRM tiny and the i915/gma500 DRM drivers.

So, something like:

--- a/drivers/staging/fbtft/Kconfig
tristate "Support for small TFT LCD display modules" depends on FB && SPI
depends on FB_DEVICE
+ select BACKLIGHT_DEVICE_CLASS

        depends on GPIOLIB || COMPILE_TEST
        select FB_BACKLIGHT

config FB_BACKLIGHT
tristate
depends on FB
- select BACKLIGHT_CLASS_DEVICE
+ depends on BACKLIGHT_CLASS_DEVICE

Quoted 6 lines
Quoted 1 line

Would that fix the dependency warning?

The above is generally a mistake and the root cause of the dependency loops. With very few exceptions, the solution in these cases is to find the inconsistent 'select' and change it into 'depends on'.

Agreed.

Quoted 3 lines

I actually have a few more patches like this that I've been carrying for years now, e.g. one that changes all the 'select I2C' into appropriate dependencies.

I've done that for BACKLIGHT_CLASS_DEVICE and some related configs years ago, but there was pushback, and I gave up. Nowadays when I see this I just chuckle briefly and move on.

Occasionally I quote Documentation/kbuild/kconfig-language.rst:

select should be used with care. select will force a symbol to a value without visiting the dependencies. By abusing select you are able to select a symbol FOO even if FOO depends on BAR that is not set.
In general use select only for non-visible symbols (no prompts anywhere) and for symbols with no dependencies. That will limit the usefulness but on the other hand avoid the illegal configurations all over.

If kconfig warned about selecting symbols with dependencies it would be painful for a while but eventually I think life would be easier.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel
maintainer
#5 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

Quoted 33 lines · Jani Nikula
Quoted 32 lines · Arnd Bergmann
Quoted 31 lines · Helge Deller
Quoted 7 lines · Thomas Zimmermann

Do not select BACKLIGHT_CLASS_DEVICE from FB_BACKLIGHT. The latter only controls backlight support within fbdev core code and data structures.

Make fbdev drivers depend on BACKLIGHT_CLASS_DEVICE and let users select it explicitly. Fixes warnings about recursive dependencies, such as [...]

I think in the fbdev drivers themselves you should do:
select BACKLIGHT_CLASS_DEVICE
instead of "depending" on it.
This is the way as it's done in the DRM tiny and the i915/gma500 DRM drivers.

So, something like:

--- a/drivers/staging/fbtft/Kconfig
tristate "Support for small TFT LCD display modules" depends on FB && SPI
depends on FB_DEVICE
+ select BACKLIGHT_DEVICE_CLASS
depends on GPIOLIB || COMPILE_TEST
select FB_BACKLIGHT

config FB_BACKLIGHT
tristate
depends on FB
- select BACKLIGHT_CLASS_DEVICE
+ depends on BACKLIGHT_CLASS_DEVICE

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Would that fix the dependency warning?

The above is generally a mistake and the root cause of the dependency loops. With very few exceptions, the solution in these cases is to find the inconsistent 'select' and change it into 'depends on'.

Agreed.

That's fine, but my point is that it should be consistent. For example:

~:/git-kernel/linux$ grep -r "select.*BACKLIGHT_CLASS_DEVICE" drivers/gpu/
drivers/gpu/drm/tilcdc/Kconfig: select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/nouveau/Kconfig:        select BACKLIGHT_CLASS_DEVICE if DRM_NOUVEAU_BACKLIGHT
drivers/gpu/drm/nouveau/Kconfig:        select BACKLIGHT_CLASS_DEVICE if ACPI && X86
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/fsl-dcu/Kconfig:        select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/i915/Kconfig:   select BACKLIGHT_CLASS_DEVICE if ACPI
drivers/gpu/drm/gma500/Kconfig: select BACKLIGHT_CLASS_DEVICE if ACPI
drivers/gpu/drm/amd/amdgpu/Kconfig:     select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/xe/Kconfig:     select BACKLIGHT_CLASS_DEVICE if ACPI
drivers/gpu/drm/solomon/Kconfig:        select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/radeon/Kconfig: select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/renesas/shmobile/Kconfig:       select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/gud/Kconfig:    select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/bridge/Kconfig: select BACKLIGHT_CLASS_DEVICE

All major drm graphics drivers *select* BACKLIGHT_CLASS_DEVICE. Are you changing them to "depend on" as well?

Helge

author maintainer
#6 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

Hi

Am 13.12.24 um 00:56 schrieb Helge Deller:

Quoted 68 lines · Jani Nikula
Quoted 33 lines · Arnd Bergmann
Quoted 32 lines · Helge Deller
Quoted 31 lines · Thomas Zimmermann
Quoted 7 lines

Do not select BACKLIGHT_CLASS_DEVICE from FB_BACKLIGHT. The latter only controls backlight support within fbdev core code and data structures.

Make fbdev drivers depend on BACKLIGHT_CLASS_DEVICE and let users select it explicitly. Fixes warnings about recursive dependencies, such as [...]

I think in the fbdev drivers themselves you should do:
    select BACKLIGHT_CLASS_DEVICE
instead of "depending" on it.
This is the way as it's done in the DRM tiny and the i915/gma500 DRM drivers.

So, something like:

--- a/drivers/staging/fbtft/Kconfig
         tristate "Support for small TFT LCD display modules" depends on FB && SPI
         depends on FB_DEVICE
    +    select BACKLIGHT_DEVICE_CLASS
         depends on GPIOLIB || COMPILE_TEST
         select FB_BACKLIGHT

config FB_BACKLIGHT
            tristate
            depends on FB
    -      select BACKLIGHT_CLASS_DEVICE
    +       depends on BACKLIGHT_CLASS_DEVICE

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Would that fix the dependency warning?

The above is generally a mistake and the root cause of the dependency loops. With very few exceptions, the solution in these cases is to find the inconsistent 'select' and change it into 'depends on'.

Agreed.

That's fine, but my point is that it should be consistent. For example:

~:/git-kernel/linux$ grep -r "select.*BACKLIGHT_CLASS_DEVICE" drivers/gpu/
drivers/gpu/drm/tilcdc/Kconfig: select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/nouveau/Kconfig:        select BACKLIGHT_CLASS_DEVICE if DRM_NOUVEAU_BACKLIGHT
drivers/gpu/drm/nouveau/Kconfig:        select BACKLIGHT_CLASS_DEVICE if ACPI && X86
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/fsl-dcu/Kconfig:        select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/i915/Kconfig:   select BACKLIGHT_CLASS_DEVICE if ACPI
drivers/gpu/drm/gma500/Kconfig: select BACKLIGHT_CLASS_DEVICE if ACPI
drivers/gpu/drm/amd/amdgpu/Kconfig:     select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/xe/Kconfig:     select BACKLIGHT_CLASS_DEVICE if ACPI
drivers/gpu/drm/solomon/Kconfig:        select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/radeon/Kconfig: select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/renesas/shmobile/Kconfig:       select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/gud/Kconfig:    select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/bridge/Kconfig: select BACKLIGHT_CLASS_DEVICE
Quoted 2 lines

All major drm graphics drivers *select* BACKLIGHT_CLASS_DEVICE. Are you changing them to "depend on" as well?

All these drivers should be changed to either 'depends on' or maybe 'imply'.

Best regards
Thomas

Quoted 2 lines

Helge

Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
#7 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

Quoted 77 lines · Thomas Zimmermann

Hi

Am 13.12.24 um 00:56 schrieb Helge Deller:

Quoted 73 lines · Jani Nikula
Quoted 34 lines · Arnd Bergmann
Quoted 33 lines · Helge Deller
Quoted 32 lines · Thomas Zimmermann
Quoted 7 lines

Do not select BACKLIGHT_CLASS_DEVICE from FB_BACKLIGHT. The latter only controls backlight support within fbdev core code and data structures.

Make fbdev drivers depend on BACKLIGHT_CLASS_DEVICE and let users select it explicitly. Fixes warnings about recursive dependencies, such as [...]

I think in the fbdev drivers themselves you should do:
    select BACKLIGHT_CLASS_DEVICE
instead of "depending" on it.
This is the way as it's done in the DRM tiny and the i915/gma500 DRM drivers.

So, something like:

--- a/drivers/staging/fbtft/Kconfig
         tristate "Support for small TFT LCD display modules" depends on FB && SPI
         depends on FB_DEVICE
    +    select BACKLIGHT_DEVICE_CLASS
         depends on GPIOLIB || COMPILE_TEST
         select FB_BACKLIGHT

config FB_BACKLIGHT
            tristate
            depends on FB
    -      select BACKLIGHT_CLASS_DEVICE
    +       depends on BACKLIGHT_CLASS_DEVICE

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Would that fix the dependency warning?

The above is generally a mistake and the root cause of the dependency loops. With very few exceptions, the solution in these cases is to find the inconsistent 'select' and change it into 'depends on'.

Agreed.

That's fine, but my point is that it should be consistent. For example:

~:/git-kernel/linux$ grep -r "select.*BACKLIGHT_CLASS_DEVICE"
drivers/gpu/
drivers/gpu/drm/tilcdc/Kconfig: select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/nouveau/Kconfig:        select BACKLIGHT_CLASS_DEVICE if
DRM_NOUVEAU_BACKLIGHT
drivers/gpu/drm/nouveau/Kconfig:        select BACKLIGHT_CLASS_DEVICE if
ACPI && X86
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/tiny/Kconfig:   select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/fsl-dcu/Kconfig:        select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/i915/Kconfig:   select BACKLIGHT_CLASS_DEVICE if ACPI
drivers/gpu/drm/gma500/Kconfig: select BACKLIGHT_CLASS_DEVICE if ACPI
drivers/gpu/drm/amd/amdgpu/Kconfig:     select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/xe/Kconfig:     select BACKLIGHT_CLASS_DEVICE if ACPI
drivers/gpu/drm/solomon/Kconfig:        select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/radeon/Kconfig: select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/renesas/shmobile/Kconfig:       select
BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/gud/Kconfig:    select BACKLIGHT_CLASS_DEVICE
drivers/gpu/drm/bridge/Kconfig: select BACKLIGHT_CLASS_DEVICE
Quoted 4 lines
Quoted 2 lines

All major drm graphics drivers *select* BACKLIGHT_CLASS_DEVICE. Are you changing them to "depend on" as well?

All these drivers should be changed to either 'depends on' or maybe 'imply'.

Yeah, select on non-leaf/library function Kconfig symbols tends to be a complete pain. There's some push to use select so it's easier for people to enable complex drivers, but I honestly don't think it's worth it. menuconfig can give you a list of things you need to enable first, so it's all discoverable enough (but a bit painful to get them all if it's a really complex driver with lots of dependencies).

tldr; I concur fully, please no more select but instead less. -Sima

Quoted 16 lines

Best regards
Thomas

Quoted 2 lines

Helge

Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
Signature · 3 lines
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
author maintainer
#8 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

In reply to Arnd Bergmann

Hi

Am 12.12.24 um 22:04 schrieb Arnd Bergmann:

Quoted 37 lines · Helge Deller
Quoted 23 lines · Thomas Zimmermann
Quoted 7 lines

Do not select BACKLIGHT_CLASS_DEVICE from FB_BACKLIGHT. The latter only controls backlight support within fbdev core code and data structures.

Make fbdev drivers depend on BACKLIGHT_CLASS_DEVICE and let users select it explicitly. Fixes warnings about recursive dependencies, such as [...]

I think in the fbdev drivers themselves you should do:
select BACKLIGHT_CLASS_DEVICE
instead of "depending" on it.
This is the way as it's done in the DRM tiny and the i915/gma500 DRM drivers.

So, something like:

--- a/drivers/staging/fbtft/Kconfig
tristate "Support for small TFT LCD display modules" depends on FB && SPI
depends on FB_DEVICE
+ select BACKLIGHT_DEVICE_CLASS
depends on GPIOLIB || COMPILE_TEST
select FB_BACKLIGHT

Quoted 8 lines

config FB_BACKLIGHT
tristate
depends on FB
- select BACKLIGHT_CLASS_DEVICE
+ depends on BACKLIGHT_CLASS_DEVICE

Would that fix the dependency warning?

The above is generally a mistake and the root cause of the dependency loops. With very few exceptions, the solution in these cases is to find the inconsistent 'select' and change it into 'depends on'.

Quoted 3 lines

I actually have a few more patches like this that I've been carrying for years now, e.g. one that changes all the 'select I2C' into appropriate dependencies.

Thanks! If you have something for DRM, please submit. In the case of i2c, it might happen that the driver is useful without i2c support. But that's a discussion for the individual reviews.

Best regards
Thomas

Quoted 2 lines

Arnd

Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
#9 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

In reply to Thomas Zimmermann

Le 12/12/2024 à 11:04, Thomas Zimmermann a écrit :

Quoted 25 lines

Do not select BACKLIGHT_CLASS_DEVICE from FB_BACKLIGHT. The latter only controls backlight support within fbdev core code and data structures.

Make fbdev drivers depend on BACKLIGHT_CLASS_DEVICE and let users select it explicitly. Fixes warnings about recursive dependencies, such as

error: recursive dependency detected!
symbol BACKLIGHT_CLASS_DEVICE is selected by FB_BACKLIGHT symbol FB_BACKLIGHT is selected by FB_SH_MOBILE_LCDC symbol FB_SH_MOBILE_LCDC depends on FB_DEVICE
symbol FB_DEVICE depends on FB_CORE
symbol FB_CORE is selected by DRM_GEM_DMA_HELPER symbol DRM_GEM_DMA_HELPER is selected by DRM_PANEL_ILITEK_ILI9341 symbol DRM_PANEL_ILITEK_ILI9341 depends on BACKLIGHT_CLASS_DEVICE

BACKLIGHT_CLASS_DEVICE is user-selectable, so making drivers adapt to it is the correct approach in any case. For most drivers, backlight support is also configurable separately.

v2:
- s/BACKLIGHT_DEVICE_CLASS/BACKLIGHT_CLASS_DEVICE (Helge)
- Fix fbdev driver-dependency corner case (Arnd)

Quoted 8 lines
---
  drivers/auxdisplay/Kconfig       |  2 +-
  drivers/macintosh/Kconfig        |  1 +
  drivers/staging/fbtft/Kconfig    |  1 +
  drivers/video/fbdev/Kconfig      | 18 +++++++++++++-----
  drivers/video/fbdev/core/Kconfig |  3 +--
  5 files changed, 17 insertions(+), 8 deletions(-)

Build fails which pmac32_defconfig :

LD .tmp_vmlinux1
powerpc64-linux-ld: drivers/macintosh/via-pmu-backlight.o: in function `pmu_backlight_init':
via-pmu-backlight.c:(.init.text+0xc0): undefined reference to `backlight_device_register' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/home/chleroy/linux-powerpc/Makefile:1225: vmlinux] Error 2

Quoted 166 lines
drivers/auxdisplay/Kconfig +1 -1
index 21545ffba065..8934e6ad5772 100644
@@ -489,7 +489,7 @@ config IMG_ASCII_LCD
 
  config HT16K33
  	tristate "Holtek Ht16K33 LED controller with keyscan"
-	depends on FB && I2C && INPUT
+	depends on FB && I2C && INPUT && BACKLIGHT_CLASS_DEVICE
  	select FB_SYSMEM_HELPERS
  	select INPUT_MATRIXKMAP
  	select FB_BACKLIGHT
drivers/macintosh/Kconfig +1 -0
index fb38f684444f..bf3824032d61 100644
@@ -120,6 +120,7 @@ config PMAC_MEDIABAY
  config PMAC_BACKLIGHT
  	bool "Backlight control for LCD screens"
  	depends on PPC_PMAC && ADB_PMU && FB = y && (BROKEN || !PPC64)
+	depends on BACKLIGHT_CLASS_DEVICE
  	select FB_BACKLIGHT
  	help
  	  Say Y here to enable Macintosh specific extensions of the generic
drivers/staging/fbtft/Kconfig +1 -0
index 77ab44362f16..dcf6a70455cc 100644
@@ -3,6 +3,7 @@ menuconfig FB_TFT
  	tristate "Support for small TFT LCD display modules"
  	depends on FB && SPI
  	depends on FB_DEVICE
+	depends on BACKLIGHT_CLASS_DEVICE
  	depends on GPIOLIB || COMPILE_TEST
  	select FB_BACKLIGHT
  	select FB_SYSMEM_HELPERS_DEFERRED
drivers/video/fbdev/Kconfig +13 -5
index de035071fedb..55c6686f091e 100644
@@ -649,6 +649,7 @@ config FB_S1D13XXX
  config FB_ATMEL
  	tristate "AT91 LCD Controller support"
  	depends on FB && OF && HAVE_CLK && HAS_IOMEM
+	depends on BACKLIGHT_CLASS_DEVICE
  	depends on HAVE_FB_ATMEL || COMPILE_TEST
  	select FB_BACKLIGHT
  	select FB_IOMEM_HELPERS
@@ -660,7 +661,6 @@ config FB_ATMEL
  config FB_NVIDIA
  	tristate "nVidia Framebuffer Support"
  	depends on FB && PCI
-	select FB_BACKLIGHT if FB_NVIDIA_BACKLIGHT
  	select FB_CFB_FILLRECT
  	select FB_CFB_COPYAREA
  	select FB_CFB_IMAGEBLIT
@@ -700,6 +700,8 @@ config FB_NVIDIA_DEBUG
  config FB_NVIDIA_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_NVIDIA
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_NVIDIA
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -707,7 +709,6 @@ config FB_NVIDIA_BACKLIGHT
  config FB_RIVA
  	tristate "nVidia Riva support"
  	depends on FB && PCI
-	select FB_BACKLIGHT if FB_RIVA_BACKLIGHT
  	select FB_CFB_FILLRECT
  	select FB_CFB_COPYAREA
  	select FB_CFB_IMAGEBLIT
@@ -747,6 +748,8 @@ config FB_RIVA_DEBUG
  config FB_RIVA_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_RIVA
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_RIVA
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -934,7 +937,6 @@ config FB_MATROX_MAVEN
  config FB_RADEON
  	tristate "ATI Radeon display support"
  	depends on FB && PCI
-	select FB_BACKLIGHT if FB_RADEON_BACKLIGHT
  	select FB_CFB_FILLRECT
  	select FB_CFB_COPYAREA
  	select FB_CFB_IMAGEBLIT
@@ -960,6 +962,8 @@ config FB_RADEON_I2C
  config FB_RADEON_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_RADEON
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_RADEON
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -975,7 +979,6 @@ config FB_RADEON_DEBUG
  config FB_ATY128
  	tristate "ATI Rage128 display support"
  	depends on FB && PCI
-	select FB_BACKLIGHT if FB_ATY128_BACKLIGHT
  	select FB_IOMEM_HELPERS
  	select FB_MACMODES if PPC_PMAC
  	help
@@ -989,6 +992,8 @@ config FB_ATY128
  config FB_ATY128_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_ATY128
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_ATY128
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -999,7 +1004,6 @@ config FB_ATY
  	select FB_CFB_FILLRECT
  	select FB_CFB_COPYAREA
  	select FB_CFB_IMAGEBLIT
-	select FB_BACKLIGHT if FB_ATY_BACKLIGHT
  	select FB_IOMEM_FOPS
  	select FB_MACMODES if PPC
  	select FB_ATY_CT if SPARC64 && PCI
@@ -1040,6 +1044,8 @@ config FB_ATY_GX
  config FB_ATY_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_ATY
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_ATY
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -1528,6 +1534,7 @@ config FB_SH_MOBILE_LCDC
  	depends on FB && HAVE_CLK && HAS_IOMEM
  	depends on SUPERH || COMPILE_TEST
  	depends on FB_DEVICE
+	depends on BACKLIGHT_CLASS_DEVICE
  	select FB_BACKLIGHT
  	select FB_DEFERRED_IO
  	select FB_DMAMEM_HELPERS
@@ -1793,6 +1800,7 @@ config FB_SSD1307
  	tristate "Solomon SSD1307 framebuffer support"
  	depends on FB && I2C
  	depends on GPIOLIB || COMPILE_TEST
+	depends on BACKLIGHT_CLASS_DEVICE
  	select FB_BACKLIGHT
  	select FB_SYSMEM_HELPERS_DEFERRED
  	help
drivers/video/fbdev/core/Kconfig +1 -2
index 0ab8848ba2f1..d554d8c543d4 100644
@@ -183,9 +183,8 @@ config FB_SYSMEM_HELPERS_DEFERRED
  	select FB_SYSMEM_HELPERS
 
  config FB_BACKLIGHT
-	tristate
+	bool
  	depends on FB
-	select BACKLIGHT_CLASS_DEVICE
 
  config FB_MODE_HELPERS
  	bool "Enable Video Mode Handling Helpers"
author maintainer
#10 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

Hi

Am 13.12.24 um 08:44 schrieb Christophe Leroy:

Quoted 37 lines

Le 12/12/2024 à 11:04, Thomas Zimmermann a écrit :

Quoted 25 lines

Do not select BACKLIGHT_CLASS_DEVICE from FB_BACKLIGHT. The latter only controls backlight support within fbdev core code and data structures.

Make fbdev drivers depend on BACKLIGHT_CLASS_DEVICE and let users select it explicitly. Fixes warnings about recursive dependencies, such as

error: recursive dependency detected!
    symbol BACKLIGHT_CLASS_DEVICE is selected by FB_BACKLIGHT symbol FB_BACKLIGHT is selected by FB_SH_MOBILE_LCDC symbol FB_SH_MOBILE_LCDC depends on FB_DEVICE
    symbol FB_DEVICE depends on FB_CORE
    symbol FB_CORE is selected by DRM_GEM_DMA_HELPER symbol DRM_GEM_DMA_HELPER is selected by DRM_PANEL_ILITEK_ILI9341 symbol DRM_PANEL_ILITEK_ILI9341 depends on BACKLIGHT_CLASS_DEVICE

BACKLIGHT_CLASS_DEVICE is user-selectable, so making drivers adapt to it is the correct approach in any case. For most drivers, backlight support is also configurable separately.

v2:
- s/BACKLIGHT_DEVICE_CLASS/BACKLIGHT_CLASS_DEVICE (Helge)
- Fix fbdev driver-dependency corner case (Arnd)

Quoted 8 lines

---
  drivers/auxdisplay/Kconfig       |  2 +- drivers/macintosh/Kconfig        |  1 + drivers/staging/fbtft/Kconfig    |  1 + drivers/video/fbdev/Kconfig      | 18 +++++++++++++----- drivers/video/fbdev/core/Kconfig |  3 +--

  5 files changed, 17 insertions(+), 8 deletions(-)
Quoted 7 lines

Build fails which pmac32_defconfig :

  LD      .tmp_vmlinux1
powerpc64-linux-ld: drivers/macintosh/via-pmu-backlight.o: in function `pmu_backlight_init':
via-pmu-backlight.c:(.init.text+0xc0): undefined reference to `backlight_device_register' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/home/chleroy/linux-powerpc/Makefile:1225: vmlinux] Error 2

The attached patch selects backlight support in the defconfigs that also have PMAC_BACKLIGHT=y. Can you please apply it on top of the patchset and report on the results?

Best regards
Thomas

Quoted 171 lines
Quoted 170 lines
drivers/auxdisplay/Kconfig +0 -0
index 21545ffba065..8934e6ad5772 100644
@@ -489,7 +489,7 @@ config IMG_ASCII_LCD

    config HT16K33
      tristate "Holtek Ht16K33 LED controller with keyscan" -    depends on FB && I2C && INPUT
+    depends on FB && I2C && INPUT && BACKLIGHT_CLASS_DEVICE select FB_SYSMEM_HELPERS
      select INPUT_MATRIXKMAP
      select FB_BACKLIGHT

drivers/macintosh/Kconfig +0 -0
index fb38f684444f..bf3824032d61 100644
@@ -120,6 +120,7 @@ config PMAC_MEDIABAY

  config PMAC_BACKLIGHT
      bool "Backlight control for LCD screens"
      depends on PPC_PMAC && ADB_PMU && FB = y && (BROKEN || !PPC64) +    depends on BACKLIGHT_CLASS_DEVICE
      select FB_BACKLIGHT
      help
        Say Y here to enable Macintosh specific extensions of the generic

drivers/staging/fbtft/Kconfig +0 -0
index 77ab44362f16..dcf6a70455cc 100644
@@ -3,6 +3,7 @@ menuconfig FB_TFT

      tristate "Support for small TFT LCD display modules" depends on FB && SPI
      depends on FB_DEVICE
+    depends on BACKLIGHT_CLASS_DEVICE
      depends on GPIOLIB || COMPILE_TEST
      select FB_BACKLIGHT
      select FB_SYSMEM_HELPERS_DEFERRED

drivers/video/fbdev/Kconfig +0 -0
index de035071fedb..55c6686f091e 100644
@@ -649,6 +649,7 @@ config FB_S1D13XXX

  config FB_ATMEL
      tristate "AT91 LCD Controller support" depends on FB && OF && HAVE_CLK && HAS_IOMEM +    depends on BACKLIGHT_CLASS_DEVICE depends on HAVE_FB_ATMEL || COMPILE_TEST select FB_BACKLIGHT
      select FB_IOMEM_HELPERS

drivers/video/fbdev/Kconfig +0 -0
@@ -660,7 +661,6 @@ config FB_ATMEL

  config FB_NVIDIA
      tristate "nVidia Framebuffer Support"
      depends on FB && PCI
-    select FB_BACKLIGHT if FB_NVIDIA_BACKLIGHT
      select FB_CFB_FILLRECT
      select FB_CFB_COPYAREA
      select FB_CFB_IMAGEBLIT

drivers/video/fbdev/Kconfig +0 -0
@@ -700,6 +700,8 @@ config FB_NVIDIA_DEBUG

  config FB_NVIDIA_BACKLIGHT
      bool "Support for backlight control"
      depends on FB_NVIDIA
+    depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_NVIDIA
+    select FB_BACKLIGHT
      default y
      help
        Say Y here if you want to control the backlight of your display.

drivers/video/fbdev/Kconfig +0 -0
@@ -707,7 +709,6 @@ config FB_NVIDIA_BACKLIGHT

  config FB_RIVA
      tristate "nVidia Riva support"
      depends on FB && PCI
-    select FB_BACKLIGHT if FB_RIVA_BACKLIGHT
      select FB_CFB_FILLRECT
      select FB_CFB_COPYAREA
      select FB_CFB_IMAGEBLIT

drivers/video/fbdev/Kconfig +0 -0
@@ -747,6 +748,8 @@ config FB_RIVA_DEBUG

  config FB_RIVA_BACKLIGHT
      bool "Support for backlight control"
      depends on FB_RIVA
+    depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_RIVA
+    select FB_BACKLIGHT
      default y
      help
        Say Y here if you want to control the backlight of your display.

drivers/video/fbdev/Kconfig +0 -0
@@ -934,7 +937,6 @@ config FB_MATROX_MAVEN

  config FB_RADEON
      tristate "ATI Radeon display support"
      depends on FB && PCI
-    select FB_BACKLIGHT if FB_RADEON_BACKLIGHT
      select FB_CFB_FILLRECT
      select FB_CFB_COPYAREA
      select FB_CFB_IMAGEBLIT

drivers/video/fbdev/Kconfig +0 -0
@@ -960,6 +962,8 @@ config FB_RADEON_I2C

  config FB_RADEON_BACKLIGHT
      bool "Support for backlight control"
      depends on FB_RADEON
+    depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_RADEON
+    select FB_BACKLIGHT
      default y
      help
        Say Y here if you want to control the backlight of your display.

drivers/video/fbdev/Kconfig +0 -0
@@ -975,7 +979,6 @@ config FB_RADEON_DEBUG

  config FB_ATY128
      tristate "ATI Rage128 display support"
      depends on FB && PCI
-    select FB_BACKLIGHT if FB_ATY128_BACKLIGHT
      select FB_IOMEM_HELPERS
      select FB_MACMODES if PPC_PMAC
      help

drivers/video/fbdev/Kconfig +0 -0
@@ -989,6 +992,8 @@ config FB_ATY128

  config FB_ATY128_BACKLIGHT
      bool "Support for backlight control"
      depends on FB_ATY128
+    depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_ATY128
+    select FB_BACKLIGHT
      default y
      help
        Say Y here if you want to control the backlight of your display.

drivers/video/fbdev/Kconfig +0 -0
@@ -999,7 +1004,6 @@ config FB_ATY

      select FB_CFB_FILLRECT
      select FB_CFB_COPYAREA
      select FB_CFB_IMAGEBLIT
-    select FB_BACKLIGHT if FB_ATY_BACKLIGHT
      select FB_IOMEM_FOPS
      select FB_MACMODES if PPC
      select FB_ATY_CT if SPARC64 && PCI

drivers/video/fbdev/Kconfig +0 -0
@@ -1040,6 +1044,8 @@ config FB_ATY_GX

  config FB_ATY_BACKLIGHT
      bool "Support for backlight control"
      depends on FB_ATY
+    depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_ATY
+    select FB_BACKLIGHT
      default y
      help
        Say Y here if you want to control the backlight of your display.

drivers/video/fbdev/Kconfig +0 -0
@@ -1528,6 +1534,7 @@ config FB_SH_MOBILE_LCDC

      depends on FB && HAVE_CLK && HAS_IOMEM
      depends on SUPERH || COMPILE_TEST
      depends on FB_DEVICE
+    depends on BACKLIGHT_CLASS_DEVICE
      select FB_BACKLIGHT
      select FB_DEFERRED_IO
      select FB_DMAMEM_HELPERS

drivers/video/fbdev/Kconfig +0 -0
@@ -1793,6 +1800,7 @@ config FB_SSD1307

      tristate "Solomon SSD1307 framebuffer support" depends on FB && I2C
      depends on GPIOLIB || COMPILE_TEST
+    depends on BACKLIGHT_CLASS_DEVICE select FB_BACKLIGHT
      select FB_SYSMEM_HELPERS_DEFERRED
      help

drivers/video/fbdev/core/Kconfig +0 -0
index 0ab8848ba2f1..d554d8c543d4 100644
@@ -183,9 +183,8 @@ config FB_SYSMEM_HELPERS_DEFERRED

      select FB_SYSMEM_HELPERS
    config FB_BACKLIGHT
-    tristate
+    bool
      depends on FB
-    select BACKLIGHT_CLASS_DEVICE
    config FB_MODE_HELPERS
      bool "Enable Video Mode Handling Helpers"

Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

From b0283396aeed19cef8e1340c05103929cb41faf6 Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann <[email protected]>
Date: Fri, 13 Dec 2024 09:02:41 +0100
Subject: [PATCH] add BACKLIGHT_CLASS_DEVICE on PPC defconfigs

---
 arch/powerpc/configs/pmac32_defconfig | 1 +
 arch/powerpc/configs/ppc6xx_defconfig | 1 +
 2 files changed, 2 insertions(+)
arch/powerpc/configs/pmac32_defconfig +1 -0
index 57ded82c2840..e8b3f67bf3f5 100644
@@ -208,6 +208,7 @@ CONFIG_FB_ATY=y
 CONFIG_FB_ATY_CT=y
 CONFIG_FB_ATY_GX=y
 CONFIG_FB_3DFX=y
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
arch/powerpc/configs/ppc6xx_defconfig +1 -0
index 4d77e17541e9..ca0c90e95837 100644
@@ -716,6 +716,7 @@ CONFIG_FB_TRIDENT=m
 CONFIG_FB_SM501=m
 CONFIG_FB_IBM_GXT4500=y
 CONFIG_LCD_PLATFORM=m
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
 CONFIG_LOGO=y
Signature · 1 line
2.47.1
#11 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

Le 13/12/2024 à 09:05, Thomas Zimmermann a écrit :

Quoted 43 lines

Hi

Am 13.12.24 um 08:44 schrieb Christophe Leroy:

Quoted 39 lines

Le 12/12/2024 à 11:04, Thomas Zimmermann a écrit :

Quoted 25 lines

Do not select BACKLIGHT_CLASS_DEVICE from FB_BACKLIGHT. The latter only controls backlight support within fbdev core code and data structures.

Make fbdev drivers depend on BACKLIGHT_CLASS_DEVICE and let users select it explicitly. Fixes warnings about recursive dependencies, such as

error: recursive dependency detected!
    symbol BACKLIGHT_CLASS_DEVICE is selected by FB_BACKLIGHT symbol FB_BACKLIGHT is selected by FB_SH_MOBILE_LCDC symbol FB_SH_MOBILE_LCDC depends on FB_DEVICE
    symbol FB_DEVICE depends on FB_CORE
    symbol FB_CORE is selected by DRM_GEM_DMA_HELPER symbol DRM_GEM_DMA_HELPER is selected by DRM_PANEL_ILITEK_ILI9341 symbol DRM_PANEL_ILITEK_ILI9341 depends on BACKLIGHT_CLASS_DEVICE

BACKLIGHT_CLASS_DEVICE is user-selectable, so making drivers adapt to it is the correct approach in any case. For most drivers, backlight support is also configurable separately.

v2:
- s/BACKLIGHT_DEVICE_CLASS/BACKLIGHT_CLASS_DEVICE (Helge)
- Fix fbdev driver-dependency corner case (Arnd)

Quoted 8 lines

---
  drivers/auxdisplay/Kconfig       |  2 +- drivers/macintosh/Kconfig        |  1 + drivers/staging/fbtft/Kconfig    |  1 + drivers/video/fbdev/Kconfig      | 18 +++++++++++++----- drivers/video/fbdev/core/Kconfig |  3 +--

  5 files changed, 17 insertions(+), 8 deletions(-)

Build fails which pmac32_defconfig :

Quoted 8 lines
Quoted 5 lines

  LD      .tmp_vmlinux1
powerpc64-linux-ld: drivers/macintosh/via-pmu-backlight.o: in function `pmu_backlight_init':
via-pmu-backlight.c:(.init.text+0xc0): undefined reference to `backlight_device_register' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/home/chleroy/linux-powerpc/Makefile:1225: vmlinux] Error 2

The attached patch selects backlight support in the defconfigs that also have PMAC_BACKLIGHT=y. Can you please apply it on top of the patchset and report on the results?

That works for the defconfig but it is still possible to change CONFIG_BACKLIGHT_CLASS_DEVICE manually.

If it is necessary for PMAC_BACKLIGHT then it shouldn't be possible to deselect it.

author maintainer
#12 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

Hi

Am 13.12.24 um 09:33 schrieb Christophe Leroy:

Quoted 52 lines

Le 13/12/2024 à 09:05, Thomas Zimmermann a écrit :

Quoted 49 lines

Hi

Am 13.12.24 um 08:44 schrieb Christophe Leroy:

Quoted 44 lines

Le 12/12/2024 à 11:04, Thomas Zimmermann a écrit :

Quoted 25 lines

Do not select BACKLIGHT_CLASS_DEVICE from FB_BACKLIGHT. The latter only controls backlight support within fbdev core code and data structures.

Make fbdev drivers depend on BACKLIGHT_CLASS_DEVICE and let users select it explicitly. Fixes warnings about recursive dependencies, such as

error: recursive dependency detected!
    symbol BACKLIGHT_CLASS_DEVICE is selected by FB_BACKLIGHT symbol FB_BACKLIGHT is selected by FB_SH_MOBILE_LCDC symbol FB_SH_MOBILE_LCDC depends on FB_DEVICE
    symbol FB_DEVICE depends on FB_CORE
    symbol FB_CORE is selected by DRM_GEM_DMA_HELPER symbol DRM_GEM_DMA_HELPER is selected by DRM_PANEL_ILITEK_ILI9341 symbol DRM_PANEL_ILITEK_ILI9341 depends on BACKLIGHT_CLASS_DEVICE

BACKLIGHT_CLASS_DEVICE is user-selectable, so making drivers adapt to it is the correct approach in any case. For most drivers, backlight support is also configurable separately.

v2:
- s/BACKLIGHT_DEVICE_CLASS/BACKLIGHT_CLASS_DEVICE (Helge)
- Fix fbdev driver-dependency corner case (Arnd)

Quoted 8 lines

---
  drivers/auxdisplay/Kconfig       |  2 +- drivers/macintosh/Kconfig        |  1 + drivers/staging/fbtft/Kconfig    |  1 + drivers/video/fbdev/Kconfig      | 18 +++++++++++++----- drivers/video/fbdev/core/Kconfig |  3 +--

  5 files changed, 17 insertions(+), 8 deletions(-)

Build fails which pmac32_defconfig :

  LD      .tmp_vmlinux1
powerpc64-linux-ld: drivers/macintosh/via-pmu-backlight.o: in function `pmu_backlight_init':
via-pmu-backlight.c:(.init.text+0xc0): undefined reference to `backlight_device_register' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/home/chleroy/linux-powerpc/Makefile:1225: vmlinux] Error 2

Quoted 6 lines
Quoted 2 lines

The attached patch selects backlight support in the defconfigs that also have PMAC_BACKLIGHT=y. Can you please apply it on top of the patchset and report on the results?

That works for the defconfig but it is still possible to change CONFIG_BACKLIGHT_CLASS_DEVICE manually.

If it is necessary for PMAC_BACKLIGHT then it shouldn't be possible to deselect it.

If you disable CONFIG_BACKLIGHT_CLASS_DEVICE, shouldn't that auto-disable PMAC_BACKLIGHT as well?

Best regards
Thomas

Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
#13 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

Le 13/12/2024 à 09:35, Thomas Zimmermann a écrit :

Quoted 56 lines

Hi

Am 13.12.24 um 09:33 schrieb Christophe Leroy:

Quoted 52 lines

Le 13/12/2024 à 09:05, Thomas Zimmermann a écrit :

Quoted 49 lines

Hi

Am 13.12.24 um 08:44 schrieb Christophe Leroy:

Quoted 44 lines

Le 12/12/2024 à 11:04, Thomas Zimmermann a écrit :

Quoted 25 lines

Do not select BACKLIGHT_CLASS_DEVICE from FB_BACKLIGHT. The latter only controls backlight support within fbdev core code and data structures.

Make fbdev drivers depend on BACKLIGHT_CLASS_DEVICE and let users select it explicitly. Fixes warnings about recursive dependencies, such as

error: recursive dependency detected!
    symbol BACKLIGHT_CLASS_DEVICE is selected by FB_BACKLIGHT symbol FB_BACKLIGHT is selected by FB_SH_MOBILE_LCDC symbol FB_SH_MOBILE_LCDC depends on FB_DEVICE
    symbol FB_DEVICE depends on FB_CORE
    symbol FB_CORE is selected by DRM_GEM_DMA_HELPER symbol DRM_GEM_DMA_HELPER is selected by DRM_PANEL_ILITEK_ILI9341 symbol DRM_PANEL_ILITEK_ILI9341 depends on BACKLIGHT_CLASS_DEVICE

BACKLIGHT_CLASS_DEVICE is user-selectable, so making drivers adapt to it is the correct approach in any case. For most drivers, backlight support is also configurable separately.

v2:
- s/BACKLIGHT_DEVICE_CLASS/BACKLIGHT_CLASS_DEVICE (Helge)
- Fix fbdev driver-dependency corner case (Arnd)

Quoted 8 lines

---
  drivers/auxdisplay/Kconfig       |  2 +- drivers/macintosh/Kconfig        |  1 + drivers/staging/fbtft/Kconfig    |  1 + drivers/video/fbdev/Kconfig      | 18 +++++++++++++----- drivers/video/fbdev/core/Kconfig |  3 +--

  5 files changed, 17 insertions(+), 8 deletions(-)

Build fails which pmac32_defconfig :

  LD      .tmp_vmlinux1
powerpc64-linux-ld: drivers/macintosh/via-pmu-backlight.o: in function `pmu_backlight_init':
via-pmu-backlight.c:(.init.text+0xc0): undefined reference to `backlight_device_register' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/home/chleroy/linux-powerpc/Makefile:1225: vmlinux] Error 2

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

The attached patch selects backlight support in the defconfigs that also have PMAC_BACKLIGHT=y. Can you please apply it on top of the patchset and report on the results?

That works for the defconfig but it is still possible to change CONFIG_BACKLIGHT_CLASS_DEVICE manually.

If it is necessary for PMAC_BACKLIGHT then it shouldn't be possible to deselect it.

If you disable CONFIG_BACKLIGHT_CLASS_DEVICE, shouldn't that auto- disable PMAC_BACKLIGHT as well?

For the time being it doesn't, hence the build failure.

You can do it that way if you want, you need to add a dependency for that. Other solution is that PMAC_BACKLIGHT selects CONFIG_BACKLIGHT_CLASS_DEVICE.

Christophe

author maintainer
#14 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

In reply to Christophe Leroy

Hi

Am 13.12.24 um 09:33 schrieb Christophe Leroy:

Quoted 8 lines
Quoted 4 lines

The attached patch selects backlight support in the defconfigs that also have PMAC_BACKLIGHT=y. Can you please apply it on top of the patchset and report on the results?

That works for the defconfig but it is still possible to change CONFIG_BACKLIGHT_CLASS_DEVICE manually.

If it is necessary for PMAC_BACKLIGHT then it shouldn't be possible to deselect it.

Here's another patch that make it depend on BACKLIGHT_CLASS_DEVICE=y. Can you please try this as well?

Best regards
Thomas

Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

From ac9c7c3d9413021e7fae06966160d58eb3c5c5d7 Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann <[email protected]>
Date: Fri, 13 Dec 2024 09:02:41 +0100
Subject: [PATCH] add BACKLIGHT_CLASS_DEVICE on PPC defconfigs

---
 arch/powerpc/configs/pmac32_defconfig | 1 +
 arch/powerpc/configs/ppc6xx_defconfig | 1 +
 drivers/macintosh/Kconfig             | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/configs/pmac32_defconfig +1 -0
index 57ded82c2840..e8b3f67bf3f5 100644
@@ -208,6 +208,7 @@ CONFIG_FB_ATY=y
 CONFIG_FB_ATY_CT=y
 CONFIG_FB_ATY_GX=y
 CONFIG_FB_3DFX=y
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
arch/powerpc/configs/ppc6xx_defconfig +1 -0
index 4d77e17541e9..ca0c90e95837 100644
@@ -716,6 +716,7 @@ CONFIG_FB_TRIDENT=m
 CONFIG_FB_SM501=m
 CONFIG_FB_IBM_GXT4500=y
 CONFIG_LCD_PLATFORM=m
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
 CONFIG_LOGO=y
drivers/macintosh/Kconfig +1 -1
index bf3824032d61..d00e713c1092 100644
@@ -120,7 +120,7 @@ config PMAC_MEDIABAY
 config PMAC_BACKLIGHT
 	bool "Backlight control for LCD screens"
 	depends on PPC_PMAC && ADB_PMU && FB = y && (BROKEN || !PPC64)
-	depends on BACKLIGHT_CLASS_DEVICE
+	depends on BACKLIGHT_CLASS_DEVICE=y
 	select FB_BACKLIGHT
 	help
 	  Say Y here to enable Macintosh specific extensions of the generic
Signature · 1 line
2.47.1
#15 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

Le 13/12/2024 à 09:41, Thomas Zimmermann a écrit :

Quoted 6 lines

Hi

Am 13.12.24 um 09:33 schrieb Christophe Leroy:

Quoted 2 lines
Quoted 2 lines
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

The attached patch selects backlight support in the defconfigs that also have PMAC_BACKLIGHT=y. Can you please apply it on top of the patchset and report on the results?

That works for the defconfig but it is still possible to change CONFIG_BACKLIGHT_CLASS_DEVICE manually.

If it is necessary for PMAC_BACKLIGHT then it shouldn't be possible to deselect it.

Here's another patch that make it depend on BACKLIGHT_CLASS_DEVICE=y. Can you please try this as well?

That looks good, no build failure anymore with BACKLIGHT_CLASS_DEVICE=m

author maintainer
#16 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

Hi

Am 13.12.24 um 11:15 schrieb Christophe Leroy:

Quoted 12 lines

Le 13/12/2024 à 09:41, Thomas Zimmermann a écrit :

Quoted 9 lines

Hi

Am 13.12.24 um 09:33 schrieb Christophe Leroy:

Quoted 5 lines
Quoted 4 lines

The attached patch selects backlight support in the defconfigs that also have PMAC_BACKLIGHT=y. Can you please apply it on top of the patchset and report on the results?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

That works for the defconfig but it is still possible to change CONFIG_BACKLIGHT_CLASS_DEVICE manually.

If it is necessary for PMAC_BACKLIGHT then it shouldn't be possible to deselect it.

Here's another patch that make it depend on BACKLIGHT_CLASS_DEVICE=y. Can you please try this as well?

That looks good, no build failure anymore with BACKLIGHT_CLASS_DEVICE=m

Great, I'll add this change to the next iteration.

Best regards
Thomas

Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
maintainer
#17 lore raw

Re: [PATCH v2 1/3] fbdev: Fix recursive dependencies wrt BACKLIGHT_CLASS_DEVICE

In reply to Thomas Zimmermann
Quoted 92 lines · Thomas Zimmermann

Do not select BACKLIGHT_CLASS_DEVICE from FB_BACKLIGHT. The latter only controls backlight support within fbdev core code and data structures.

Make fbdev drivers depend on BACKLIGHT_CLASS_DEVICE and let users select it explicitly. Fixes warnings about recursive dependencies, such as

error: recursive dependency detected!
symbol BACKLIGHT_CLASS_DEVICE is selected by FB_BACKLIGHT symbol FB_BACKLIGHT is selected by FB_SH_MOBILE_LCDC symbol FB_SH_MOBILE_LCDC depends on FB_DEVICE
symbol FB_DEVICE depends on FB_CORE
symbol FB_CORE is selected by DRM_GEM_DMA_HELPER symbol DRM_GEM_DMA_HELPER is selected by DRM_PANEL_ILITEK_ILI9341 symbol DRM_PANEL_ILITEK_ILI9341 depends on BACKLIGHT_CLASS_DEVICE

BACKLIGHT_CLASS_DEVICE is user-selectable, so making drivers adapt to it is the correct approach in any case. For most drivers, backlight support is also configurable separately.

v2:
- s/BACKLIGHT_DEVICE_CLASS/BACKLIGHT_CLASS_DEVICE (Helge)
- Fix fbdev driver-dependency corner case (Arnd)

---
  drivers/auxdisplay/Kconfig       |  2 +-
  drivers/macintosh/Kconfig        |  1 +
  drivers/staging/fbtft/Kconfig    |  1 +
  drivers/video/fbdev/Kconfig      | 18 +++++++++++++-----
  drivers/video/fbdev/core/Kconfig |  3 +--
  5 files changed, 17 insertions(+), 8 deletions(-)
drivers/auxdisplay/Kconfig +1 -1
index 21545ffba065..8934e6ad5772 100644
@@ -489,7 +489,7 @@ config IMG_ASCII_LCD
 
  config HT16K33
  	tristate "Holtek Ht16K33 LED controller with keyscan"
-	depends on FB && I2C && INPUT
+	depends on FB && I2C && INPUT && BACKLIGHT_CLASS_DEVICE
  	select FB_SYSMEM_HELPERS
  	select INPUT_MATRIXKMAP
  	select FB_BACKLIGHT
drivers/macintosh/Kconfig +1 -0
index fb38f684444f..bf3824032d61 100644
@@ -120,6 +120,7 @@ config PMAC_MEDIABAY
  config PMAC_BACKLIGHT
  	bool "Backlight control for LCD screens"
  	depends on PPC_PMAC && ADB_PMU && FB = y && (BROKEN || !PPC64)
+	depends on BACKLIGHT_CLASS_DEVICE
  	select FB_BACKLIGHT
  	help
  	  Say Y here to enable Macintosh specific extensions of the generic
drivers/staging/fbtft/Kconfig +1 -0
index 77ab44362f16..dcf6a70455cc 100644
@@ -3,6 +3,7 @@ menuconfig FB_TFT
  	tristate "Support for small TFT LCD display modules"
  	depends on FB && SPI
  	depends on FB_DEVICE
+	depends on BACKLIGHT_CLASS_DEVICE
  	depends on GPIOLIB || COMPILE_TEST
  	select FB_BACKLIGHT
  	select FB_SYSMEM_HELPERS_DEFERRED
drivers/video/fbdev/Kconfig +1 -1
index de035071fedb..55c6686f091e 100644
@@ -649,6 +649,7 @@ config FB_S1D13XXX
  config FB_ATMEL
  	tristate "AT91 LCD Controller support"
  	depends on FB && OF && HAVE_CLK && HAS_IOMEM
+	depends on BACKLIGHT_CLASS_DEVICE
  	depends on HAVE_FB_ATMEL || COMPILE_TEST
  	select FB_BACKLIGHT
  	select FB_IOMEM_HELPERS
@@ -660,7 +661,6 @@ config FB_ATMEL
  config FB_NVIDIA
  	tristate "nVidia Framebuffer Support"
  	depends on FB && PCI
-	select FB_BACKLIGHT if FB_NVIDIA_BACKLIGHT
  	select FB_CFB_FILLRECT
  	select FB_CFB_COPYAREA
  	select FB_CFB_IMAGEBLIT

drivers/video/fbdev/Kconfig config FB_NVIDIA_DEBUG · line 703

Quoted 4 lines
drivers/video/fbdev/Kconfig +1 -0
@@ -700,6 +700,8 @@ config FB_NVIDIA_DEBUG
  config FB_NVIDIA_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_NVIDIA
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_NVIDIA

BACKLIGHT_CLASS_DEVICE is of type tristate.

Quoted 13 lines
drivers/video/fbdev/Kconfig +1 -1
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -707,7 +709,6 @@ config FB_NVIDIA_BACKLIGHT
  config FB_RIVA
  	tristate "nVidia Riva support"
  	depends on FB && PCI
-	select FB_BACKLIGHT if FB_RIVA_BACKLIGHT
  	select FB_CFB_FILLRECT
  	select FB_CFB_COPYAREA
  	select FB_CFB_IMAGEBLIT

drivers/video/fbdev/Kconfig config FB_RIVA_DEBUG · line 751

Quoted 4 lines
drivers/video/fbdev/Kconfig +1 -0
@@ -747,6 +748,8 @@ config FB_RIVA_DEBUG
  config FB_RIVA_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_RIVA
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_RIVA

here too. BACKLIGHT_CLASS_DEVICE is of type tristate.

Quoted 13 lines
drivers/video/fbdev/Kconfig +1 -1
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -934,7 +937,6 @@ config FB_MATROX_MAVEN
  config FB_RADEON
  	tristate "ATI Radeon display support"
  	depends on FB && PCI
-	select FB_BACKLIGHT if FB_RADEON_BACKLIGHT
  	select FB_CFB_FILLRECT
  	select FB_CFB_COPYAREA
  	select FB_CFB_IMAGEBLIT

drivers/video/fbdev/Kconfig config FB_RADEON_I2C · line 965

Quoted 4 lines
drivers/video/fbdev/Kconfig +1 -0
@@ -960,6 +962,8 @@ config FB_RADEON_I2C
  config FB_RADEON_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_RADEON
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_RADEON

and here.

Quoted 13 lines
drivers/video/fbdev/Kconfig +1 -1
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -975,7 +979,6 @@ config FB_RADEON_DEBUG
  config FB_ATY128
  	tristate "ATI Rage128 display support"
  	depends on FB && PCI
-	select FB_BACKLIGHT if FB_ATY128_BACKLIGHT
  	select FB_IOMEM_HELPERS
  	select FB_MACMODES if PPC_PMAC
  	help

drivers/video/fbdev/Kconfig config FB_ATY128 · line 995

Quoted 4 lines
drivers/video/fbdev/Kconfig +1 -0
@@ -989,6 +992,8 @@ config FB_ATY128
  config FB_ATY128_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_ATY128
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_ATY128

and here.

Quoted 13 lines
drivers/video/fbdev/Kconfig +1 -1
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -999,7 +1004,6 @@ config FB_ATY
  	select FB_CFB_FILLRECT
  	select FB_CFB_COPYAREA
  	select FB_CFB_IMAGEBLIT
-	select FB_BACKLIGHT if FB_ATY_BACKLIGHT
  	select FB_IOMEM_FOPS
  	select FB_MACMODES if PPC
  	select FB_ATY_CT if SPARC64 && PCI

drivers/video/fbdev/Kconfig config FB_ATY_GX · line 1047

Quoted 4 lines
drivers/video/fbdev/Kconfig +1 -0
@@ -1040,6 +1044,8 @@ config FB_ATY_GX
  config FB_ATY_BACKLIGHT
  	bool "Support for backlight control"
  	depends on FB_ATY
+	depends on BACKLIGHT_CLASS_DEVICE=y || BACKLIGHT_CLASS_DEVICE=FB_ATY

and here

Quoted 35 lines
drivers/video/fbdev/Kconfig +3 -0
+	select FB_BACKLIGHT
  	default y
  	help
  	  Say Y here if you want to control the backlight of your display.
@@ -1528,6 +1534,7 @@ config FB_SH_MOBILE_LCDC
  	depends on FB && HAVE_CLK && HAS_IOMEM
  	depends on SUPERH || COMPILE_TEST
  	depends on FB_DEVICE
+	depends on BACKLIGHT_CLASS_DEVICE
  	select FB_BACKLIGHT
  	select FB_DEFERRED_IO
  	select FB_DMAMEM_HELPERS
@@ -1793,6 +1800,7 @@ config FB_SSD1307
  	tristate "Solomon SSD1307 framebuffer support"
  	depends on FB && I2C
  	depends on GPIOLIB || COMPILE_TEST
+	depends on BACKLIGHT_CLASS_DEVICE
  	select FB_BACKLIGHT
  	select FB_SYSMEM_HELPERS_DEFERRED
  	help
drivers/video/fbdev/core/Kconfig +1 -2
index 0ab8848ba2f1..d554d8c543d4 100644
@@ -183,9 +183,8 @@ config FB_SYSMEM_HELPERS_DEFERRED
  	select FB_SYSMEM_HELPERS
 
  config FB_BACKLIGHT
-	tristate
+	bool
  	depends on FB
-	select BACKLIGHT_CLASS_DEVICE
 
  config FB_MODE_HELPERS
  	bool "Enable Video Mode Handling Helpers"
author maintainer
#18 lore raw

PATCH v2 2/3 drm/fbdev: Select FB_CORE dependency for fbdev on DMA and TTM

In reply to Thomas Zimmermann

Select FB_CORE if GEM's DMA and TTM implementations support fbdev emulation. Fixes linker errors about missing symbols from the fbdev subsystem.

Also see [1] for a related SHMEM fix.

Fixes dadd28d4142f ("drm/client: Add client-lib module")
---
 drivers/gpu/drm/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/Kconfig +2 -0
index 9abb41da4e3a..55ce61a46984 100644
@@ -293,6 +293,7 @@ config DRM_TTM_HELPER
 	tristate
 	depends on DRM
 	select DRM_TTM
+	select FB_CORE if DRM_FBDEV_EMULATION
 	select FB_SYSMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
 	help
 	  Helpers for ttm-based gem objects
@@ -300,6 +301,7 @@ config DRM_TTM_HELPER
 config DRM_GEM_DMA_HELPER
 	tristate
 	depends on DRM
+	select FB_CORE if DRM_FBDEV_EMULATION
 	select FB_DMAMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
 	help
 	  Choose this if you need the GEM DMA helper functions
Signature · 1 line
2.47.1
#19 lore raw

Re: [PATCH v2 2/3] drm/fbdev: Select FB_CORE dependency for fbdev on DMA and TTM

Le 12/12/2024 à 11:04, Thomas Zimmermann a écrit :

Quoted 4 lines

Select FB_CORE if GEM's DMA and TTM implementations support fbdev emulation. Fixes linker errors about missing symbols from the fbdev subsystem.

Quoted 8 lines

Also see [1] for a related SHMEM fix.

Fixes dadd28d4142f ("drm/client: Add client-lib module")
---
  drivers/gpu/drm/Kconfig | 2 ++
  1 file changed, 2 insertions(+)

Build fails which pmac32_defconfig :

LD .tmp_vmlinux1
powerpc64-linux-ld: drivers/macintosh/via-pmu-backlight.o: in function `pmu_backlight_init':
via-pmu-backlight.c:(.init.text+0xc0): undefined reference to `backlight_device_register'
make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1 make[1]: *** [/home/chleroy/linux-powerpc/Makefile:1225: vmlinux] Error 2

Quoted 21 lines
drivers/gpu/drm/Kconfig +2 -0
index 9abb41da4e3a..55ce61a46984 100644
@@ -293,6 +293,7 @@ config DRM_TTM_HELPER
  	tristate
  	depends on DRM
  	select DRM_TTM
+	select FB_CORE if DRM_FBDEV_EMULATION
  	select FB_SYSMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
  	help
  	  Helpers for ttm-based gem objects
@@ -300,6 +301,7 @@ config DRM_TTM_HELPER
  config DRM_GEM_DMA_HELPER
  	tristate
  	depends on DRM
+	select FB_CORE if DRM_FBDEV_EMULATION
  	select FB_DMAMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
  	help
  	  Choose this if you need the GEM DMA helper functions
#20 lore raw

Re: [PATCH v2 2/3] drm/fbdev: Select FB_CORE dependency for fbdev on DMA and TTM

Le 13/12/2024 à 08:40, Christophe Leroy a écrit :

Quoted 16 lines

Le 12/12/2024 à 11:04, Thomas Zimmermann a écrit :

Quoted 4 lines

Select FB_CORE if GEM's DMA and TTM implementations support fbdev emulation. Fixes linker errors about missing symbols from the fbdev subsystem.

Quoted 8 lines

Also see [1] for a related SHMEM fix.

Fixes dadd28d4142f ("drm/client: Add client-lib module")

---
  drivers/gpu/drm/Kconfig | 2 ++

  1 file changed, 2 insertions(+)
Quoted 9 lines

Build fails which pmac32_defconfig :

  LD      .tmp_vmlinux1
powerpc64-linux-ld: drivers/macintosh/via-pmu-backlight.o: in function `pmu_backlight_init':
via-pmu-backlight.c:(.init.text+0xc0): undefined reference to `backlight_device_register' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/home/chleroy/linux-powerpc/Makefile:1225: vmlinux] Error 2

Sorry that failure is from patch 1.

author maintainer
#21 lore raw

PATCH v2 3/3 drm: rework FB_CORE dependency

In reply to Thomas Zimmermann

From: Arnd Bergmann <[email protected]>

The 'select FB_CORE' statement moved from CONFIG_DRM to DRM_CLIENT_LIB, but there are now configurations that have code calling into fb_core as built-in even though the client_lib itself is a loadable module:

x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_set_suspend':
drm_fb_helper.c:(.text+0x2c6): undefined reference to `fb_set_suspend'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_resume_worker':
drm_fb_helper.c:(.text+0x2e1): undefined reference to `fb_set_suspend'

In addition to DRM_CLIENT_LIB, the 'select' needs to be at least in DRM_KMS_HELPER and DRM_GEM_SHMEM_HELPER, so add it here.

This patch is the KMS_HELPER part of [1].

Fixes dadd28d4142f ("drm/client: Add client-lib module")
---
 drivers/gpu/drm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/Kconfig +1 -0
index 55ce61a46984..2f51546b0b88 100644
@@ -99,6 +99,7 @@ config DRM_KUNIT_TEST
 config DRM_KMS_HELPER
 	tristate
 	depends on DRM
+	select FB_CORE if DRM_FBDEV_EMULATION
 	help
 	  CRTC helpers for KMS drivers.
 
Signature · 1 line
2.47.1