Re: [PATCH 00/11] drm: Restore helper usability

From: Masahiro Yamada
Date: Mon Apr 22 2024 - 15:43:00 EST


On Tue, Apr 23, 2024 at 3:24 AM Arnd Bergmann <arnd@xxxxxxxx> wrote:
>
> On Mon, Apr 22, 2024, at 18:58, Geert Uytterhoeven wrote:
> > On Mon, Apr 22, 2024 at 3:55 PM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> >> On Mon, Apr 22, 2024, at 15:28, Jani Nikula wrote:
> >> Whereas this one is broken:
> >>
> >> config FEATURE_A
> >> tristate "user visible if I2C is enabled"
> >> depends on I2C
> >>
> >> config HELPER_B
> >> tristate # hidden
> >> select FEATURE_A
> >>
> >> config DRIVER
> >> tristate "This driver is broken if I2C is disabled"
> >> select HELPER_B
> >
> > So the DRIVER section should gain a "depends on I2C" statement.
>
> That is of course the common workaround, but my point was
> that nothing should ever 'select I2C' or any of the other
> subsystems that are user visible.
>
> > Yamada-san: would it be difficult to modify Kconfig to ignore symbols
> > like DRIVER that select other symbols with unmet dependencies?
> > Currently it already warns about that.
> >
> > Handling this implicitly (instead of the current explict "depends
> > on") would have the disadvantage though: a user who is not aware of
> > the implicit dependency may wonder why DRIVER is invisible in his
> > config interface.
>
> I think hiding this would make it much harder to get anything
> right. The symbols in question are almost all ones that should
> be enabled in normal configs, and the 'make menuconfig' help
> doesn't make it too hard to figure things out normally, we just
> have to find a way to avoid regressions when converting things
> to 'depends on' that used an incorrect 'select'.
>
> Arnd



I am confused because you repeatedly discussed
the missing I2C dependency.


Are you talking about DRM drivers,
or is it just "an example" in general?



DRM selects I2C.

https://github.com/torvalds/linux/blob/v6.9-rc4/drivers/gpu/drm/Kconfig#L16



If you make sure individual DRM drivers depend on DRM,
none of them can be enabled without I2C.



Currently, this is not guaranteed just because
DRM folks do not know how to use the "menuconfig" syntax.



The "menuconfig" makes sense only when it is
followed by "if".




diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 5a0c476361c3..6984b3fea271 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -29,6 +29,8 @@ menuconfig DRM
details. You should also select and configure AGP
(/dev/agpgart) support if it is available for your platform.

+if DRM
+
config DRM_MIPI_DBI
tristate
depends on DRM
@@ -414,3 +416,5 @@ config DRM_LIB_RANDOM
config DRM_PRIVACY_SCREEN
bool
default n
+
+endif










--
Best Regards
Masahiro Yamada