Re: [PATCH] Documentation: kbuild: explain handling optional dependencies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 14, 2023, at 15:42, Jani Nikula wrote:
> On Wed, 13 Sep 2023, Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
>> From: Arnd Bergmann <arnd@xxxxxxxx>
>>  
>> +Optional dependencies
>> +~~~~~~~~~~~~~~~~~~~~~
>> +
>> +Some drivers are able to optionally use a feature from another module
>> +or build cleanly with that module disabled, but cause a link failure
>> +when trying to use that loadable module from a built-in driver.
>> +
>> +The most common way to express this optional dependency in Kconfig logic
>> +uses the slighly counterintuitive
>> +
>> +  config FOO
>> +	bool "Support for foo hardware"
>> +	depends on BAR || !BAR
>
> 	depends on BAR || BAR=n
>
> seems to be an alternative that's about as common:
>
> $ git grep "depends on \([A-Z0-9_]\+\) || \!\1" | wc -l
> 109
> $ git grep "depends on \([A-Z0-9_]\+\) || \1=n" | wc -l
> 107
>
> Maybe worth mentioning both?

I fear that would add more confusion than it avoids:
"!BAR" is actually different from "BAR=n", but
"BAR || !BAR" is the same as "BAR || BAR=n" here, and
trying to explain this in the documentation would either
make it incorrect or unhelpfully complicated.

      Arnd



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux