Skip to contentSkip to conversation

Use menuconfig objects

PATCH In review Al Boldi 4 participants 8 messages Apr 10, 2007 – Apr 11, 2007

lore
Share & tools
lore

Al Boldi

author
#0 lore raw

cover Use menuconfig objects

Quoted 2 lines · Jan Engelhardt

the following patch series turns some menus into menuconfigs, so they can be disabled whilst "walking" thorugh the parent menu

Great, but instead of making it a simple on/off, make it tri-state that would default select all child-options appropriately. (see HW_RANDOM)

Thanks!

--
Al

#1 lore raw
Quoted 6 lines · Al Boldi
Quoted 2 lines · Jan Engelhardt

the following patch series turns some menus into menuconfigs, so they can be disabled whilst "walking" thorugh the parent menu

Great, but instead of making it a simple on/off, make it tri-state that would default select all child-options appropriately. (see HW_RANDOM)

I do not remember having touched the Random Number Generators or Character Devices anywhere in this series.

Don't worry, I have paid attention (or at least I hope so ;-) to 'm'-able options, for example the SCSI, IEEE1394, or I2C stacks.

But, for example you will see
[*] Old CD-ROM drivers (not SCSI, not IDE)

which is because this entry in itself does not generate any object file.

Generally, I just made the 'menuconfig' entry have the same state (bool/tristate) as the original entry. If I have overseen that somewhere, please let me know!

Thank you,
Jan

author
#2 lore raw
Quoted 14 lines · Jan Engelhardt
Quoted 6 lines · Al Boldi
Quoted 2 lines · Jan Engelhardt

the following patch series turns some menus into menuconfigs, so they can be disabled whilst "walking" thorugh the parent menu

Great, but instead of making it a simple on/off, make it tri-state that would default select all child-options appropriately. (see HW_RANDOM)

I do not remember having touched the Random Number Generators or Character Devices anywhere in this series.

Don't worry, I have paid attention (or at least I hope so ;-) to 'm'-able options, for example the SCSI, IEEE1394, or I2C stacks.

Quoted 8 lines

But, for example you will see
[*] Old CD-ROM drivers (not SCSI, not IDE)

which is because this entry in itself does not generate any object file.

Generally, I just made the 'menuconfig' entry have the same state (bool/tristate) as the original entry. If I have overseen that somewhere, please let me know!

Correct, no oversight here; but it may be more meaningful, if you could default select child-options based on the parent-state, like HW_RANDOM.

Also, I don't think it's necessary to touch any of the "depends on"; keep them as is, as they don't hurt staying that way, and may actually be necessary under certain circumstances. (see EMBEDDED)

Thanks!

--
Al

#3 lore raw
Quoted 4 lines · Al Boldi

Jan Engelhardt wrote:

Correct, no oversight here; but it may be more meaningful, if you could default select child-options based on the parent-state, like HW_RANDOM.

A symbol will already have the 'magic' you describe if its creator wrote it that way. Changing to 'menuconfig' tokens does not change that I think. Consider:

menu "foobar"
config FOOBAR
bool "foobar"
default y

config HW_RANDOM
depends on FOOBAR
default y

endmenu

This example should do things as you describe -- if FOOBAR is changed from n to y, HW_RANDOM should automatically do the same since it is a new option then.

menuconfig FOOBAR
bool "foobar"
default y

if FOOBAR

config HW_RANDOM
default y

endif

inhibits the same behavior AFAICS.

Quoted 3 lines

Also, I don't think it's necessary to touch any of the "depends on"; keep them as is, as they don't hurt staying that way, and may actually be necessary under certain circumstances. (see EMBEDDED)

Simplifying the depends lines is a good thing IMO.

Jan

#4 lore raw
Quoted 6 lines · Jan Engelhardt
Quoted 3 lines · Al Boldi

Also, I don't think it's necessary to touch any of the "depends on"; keep them as is, as they don't hurt staying that way, and may actually be necessary under certain circumstances. (see EMBEDDED)

Simplifying the depends lines is a good thing IMO.

If explicit dependency statements are replaced by if--endif blocks, does this count as simplification?

Signature · 3 lines
Stefan Richter
-=====-=-=== -=-- -=-==
http://arcgraph.de/sr/
#5 lore raw
Quoted 10 lines · Stefan Richter
Quoted 6 lines · Jan Engelhardt
Quoted 3 lines · Al Boldi

Also, I don't think it's necessary to touch any of the "depends on"; keep them as is, as they don't hurt staying that way, and may actually be necessary under certain circumstances. (see EMBEDDED)

Simplifying the depends lines is a good thing IMO.

If explicit dependency statements are replaced by if--endif blocks, does this count as simplification?

According to Documentation/kbuild/, if FOO .. endif is interpreted as if each option inside the if block had 'depends on FOO'.

If _every_ option under a menu (and that's another reason why I did not modify _all_ Kconfig menus) has a 'depends on this or that', it can be substituted by an if block, and yes, I take that as a simplification since the whole LoC count goes down. What would perhaps be cool is some indent in Kconfig to see what an if-endif block spans, but currently this is not much needed, since two nested ifs are quite the max.

Jan

#6 lore raw
In reply to Stefan Richter
Quoted 10 lines · Stefan Richter
Quoted 6 lines · Jan Engelhardt
Quoted 3 lines · Al Boldi

Also, I don't think it's necessary to touch any of the "depends on"; keep them as is, as they don't hurt staying that way, and may actually be necessary under certain circumstances. (see EMBEDDED)

Simplifying the depends lines is a good thing IMO.

If explicit dependency statements are replaced by if--endif blocks, does this count as simplification?

Applied with some common sense - yes.
if --endif blocks has been used in several places to make dependencies consistent. When cleaning up the net part I recall a few places where the explicit dependency was missing causing 1) dependencies to be wrong and 2) caused indention in menu- config to be wrong.

But yet agin do not go and replace all dependencies with if--endif blocks. They shall be used with some good taste.

Sam

author
#7 lore raw
In reply to Jan Engelhardt
Quoted 19 lines · Jan Engelhardt
Quoted 4 lines · Al Boldi

Jan Engelhardt wrote:

Correct, no oversight here; but it may be more meaningful, if you could default select child-options based on the parent-state, like HW_RANDOM.

A symbol will already have the 'magic' you describe if its creator wrote it that way. Changing to 'menuconfig' tokens does not change that I think. Consider:

menu "foobar"
config FOOBAR
bool "foobar"
default y

config HW_RANDOM
depends on FOOBAR
default y

Quoted 5 lines

endmenu

This example should do things as you describe -- if FOOBAR is changed from n to y, HW_RANDOM should automatically do the same since it is a new option then.

I don't think so. But this might:

menu "foobar"
config FOOBAR
bool "foobar"
default y

config HW_RANDOM
depends on FOOBAR
default FOOBAR

endmenu

Quoted 5 lines

menuconfig FOOBAR
bool "foobar"
default y

Quoted 8 lines

if FOOBAR

config HW_RANDOM
default y

endif

inhibits the same behavior AFAICS.

I think you mean "exhibits"?

Quoted 6 lines
Quoted 4 lines

Also, I don't think it's necessary to touch any of the "depends on"; keep them as is, as they don't hurt staying that way, and may actually be necessary under certain circumstances. (see EMBEDDED)

Simplifying the depends lines is a good thing IMO.

You are replacing the depends with an if block, which seems to add complexity, as we now have two constructs, if and depends.

IMHO, leave the depends as is, for simplicity and correctness and maintainability.

So if we have something like this:

menu "foobar"
config FOOBAR
bool "foobar"
default y

config FOOBAR_SUB1
tristate "FOOBAR SUB1"
depends on FOOBAR
default m

config FOOBAR_SUB2
bool "FOOBAR SUB2"
depends on FOOBAR
default y

endmenu

Change it to something like this:

menuconfig FOOBAR
tristate "foobar"
default y

config FOOBAR_SUB1
tristate "FOOBAR SUB1"
depends on FOOBAR
default FOOBAR

config FOOBAR_SUB2
bool "FOOBAR SUB2"
depends on FOOBAR
default FOOBAR

without any if blocks, and maybe even in its own Kconfig.

Thanks!

--
Al