wrapping Kconfig "source" directives in "if" statements?

Robert P. J. Day rpjday at crashcourse.ca
Fri Aug 25 03:16:58 EDT 2017


  just curious as to Kconfig style, i noticed the following in
drivers/pps/. first, once PPS is selected, the subsequent two config
variables predictably "depend" on PPS:

  menuconfig PPS
        tristate "PPS support"
        ---help---
	  ... snip ...

  config PPS_DEBUG
        bool "PPS debugging messages"
        depends on PPS
        help
	  ... snip ...

  config NTP_PPS
        bool "PPS kernel consumer support"
        depends on PPS && !NO_HZ_COMMON
        help
	  ... snip ...

obviously, those two dependencies on PPS could be removed and those
two config variables could then be wrapped in:

  if PPS
  ...
  endif

but with only two config entries, it's like, meh, no big deal, who
cares?

  but that Kconfig file finishes by sourcing two pps subdirs:

  source drivers/pps/clients/Kconfig
  source drivers/pps/generators/Kconfig

each of which appears to totally depend on PPS; here's the (stripped)
clients/ Kconfig file:

  comment "PPS clients support"
        depends on PPS

  config PPS_CLIENT_KTIMER
        tristate "Kernel timer client (Testing client, use for debug)"
        depends on PPS

  config PPS_CLIENT_LDISC
        tristate "PPS line discipline"
        depends on PPS && TTY

  config PPS_CLIENT_PARPORT
        tristate "Parallel port PPS client"
        depends on PPS && PARPORT

  config PPS_CLIENT_GPIO
        tristate "PPS client using GPIO"
        depends on PPS

same with the pps/generators/Kconfig file. so, rather than all of
those "depends on PPS" lines, would it be equivalent to have the
top-level Kconfig file just look like:

  menuconfig PPS
        tristate "PPS support"

  if PPS

  config PPS_DEBUG
        bool "PPS debugging messages"

  config NTP_PPS
        bool "PPS kernel consumer support"
        depends on !NO_HZ_COMMON

  source drivers/pps/clients/Kconfig

  source drivers/pps/generators/Kconfig

  endif

and remove all the lower-level Kconfig "PPS" dependencies? i'm pretty
sure that would be equivalent, would it not? or is there some subtlety
that prevents that?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



More information about the Kernelnewbies mailing list