linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: move DRM-related CONFIG options into DRM submenu
@ 2024-04-23 10:24 Masahiro Yamada
  2024-04-23 12:57 ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2024-04-23 10:24 UTC (permalink / raw)
  To: dri-devel
  Cc: Arnd Bergmann, linux-kbuild, linux-kernel, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
	Geert Uytterhoeven, Masahiro Yamada

When you create a submenu using the 'menu' syntax, there is no
ambiguity about the end of the submenu because the code between
'menu' and 'endmenu' becomes the submenu.

In contrast, 'menuconfig' does not have the corresponding end marker.
Instead, it infers the end of submenu from symbol dependency.

This is described in Documentation/kbuild/kconfig-language.rst,
starting line 348. It demonstrates two ways to place the code under
the submenu:

 (1) open an if-block right after the 'menuconfig', placing the submenu
     content inside the if-block

 (2) give 'depends on' to every symbol that should go into the submenu

Many subsystems adopt (1) because it is the only reliable way to
maintain the submenu structure. It ensures the code enclosed within the
if-block is placed under the submenu.

The DRM subsystem adopts (2). The submenu ends when the sequence of
'depends on' breaks. DRM_DEBUG_MODESET_LOCK is the first option that
does not depend on DRM. So, DRM_DEBUG_MODESET_LOCK and subsequent
options reside outside the DRM submenu.

You can confirm it by running a GUI frontend such as 'make menuconfig'
and visiting the DRM menu:

    < > Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  ----

If you toggle '< >', you will notice most of the DRM-related options
appear below it, not in the submenu.

I highly recommend the approach (1). Obviously, (2) is not a reliable
way because the submenu breaks whenever someone forgets to add
'depends on DRM'.

This commit surrounds the entire DRM configuration with 'if DRM' and
'endif', except DRM_PANEL_ORIENTATION_QUIRKS.

Note:
 Now, 'depends on DRM' properties inside 'if DRM' ... 'endif' are
 all redundant. I leave it as follow-up cleanups.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 drivers/gpu/drm/Kconfig | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 5a0c476361c3..11f952d540aa 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
@@ -403,10 +405,6 @@ config DRM_HYPERV
 config DRM_EXPORT_FOR_TESTS
 	bool
 
-# Separate option because drm_panel_orientation_quirks.c is shared with fbdev
-config DRM_PANEL_ORIENTATION_QUIRKS
-	tristate
-
 config DRM_LIB_RANDOM
 	bool
 	default n
@@ -414,3 +412,9 @@ config DRM_LIB_RANDOM
 config DRM_PRIVACY_SCREEN
 	bool
 	default n
+
+endif
+
+# Separate option because drm_panel_orientation_quirks.c is shared with fbdev
+config DRM_PANEL_ORIENTATION_QUIRKS
+	tristate
-- 
2.40.1


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

* Re: [PATCH] drm: move DRM-related CONFIG options into DRM submenu
  2024-04-23 10:24 [PATCH] drm: move DRM-related CONFIG options into DRM submenu Masahiro Yamada
@ 2024-04-23 12:57 ` Arnd Bergmann
  2024-04-23 13:55   ` Jani Nikula
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2024-04-23 12:57 UTC (permalink / raw)
  To: Masahiro Yamada, dri-devel
  Cc: linux-kbuild, linux-kernel, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Dave Airlie, Daniel Vetter,
	Geert Uytterhoeven

On Tue, Apr 23, 2024, at 12:24, Masahiro Yamada wrote:
> When you create a submenu using the 'menu' syntax, there is no
> ambiguity about the end of the submenu because the code between
> 'menu' and 'endmenu' becomes the submenu.
>
...
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

I think this is a useful cleanup.

Acked-by: Arnd Bergmann <arnd@arndb.de>

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

* Re: [PATCH] drm: move DRM-related CONFIG options into DRM submenu
  2024-04-23 12:57 ` Arnd Bergmann
@ 2024-04-23 13:55   ` Jani Nikula
  0 siblings, 0 replies; 3+ messages in thread
From: Jani Nikula @ 2024-04-23 13:55 UTC (permalink / raw)
  To: Arnd Bergmann, Masahiro Yamada, dri-devel
  Cc: linux-kbuild, linux-kernel, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Dave Airlie, Daniel Vetter,
	Geert Uytterhoeven

On Tue, 23 Apr 2024, "Arnd Bergmann" <arnd@arndb.de> wrote:
> On Tue, Apr 23, 2024, at 12:24, Masahiro Yamada wrote:
>> When you create a submenu using the 'menu' syntax, there is no
>> ambiguity about the end of the submenu because the code between
>> 'menu' and 'endmenu' becomes the submenu.
>>
> ...
>>
>> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
>
> I think this is a useful cleanup.

Yeah, thanks for the good explanation!

However, it won't apply to current drm trees.

BR,
Jani.


-- 
Jani Nikula, Intel

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

end of thread, other threads:[~2024-04-23 13:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-23 10:24 [PATCH] drm: move DRM-related CONFIG options into DRM submenu Masahiro Yamada
2024-04-23 12:57 ` Arnd Bergmann
2024-04-23 13:55   ` Jani Nikula

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