diff mbox series

[2/9] cmd: Kconfig: Add missing dependency for cmd gpt

Message ID 4fc5267ccb4f1a005ef3d4a1398096f77b72f61c.1597826658.git.michal.simek@xilinx.com
State New
Delegated to: Tom Rini
Headers show
Series Incorrect Kconfig dependencies | expand

Commit Message

Michal Simek Aug. 19, 2020, 8:44 a.m. UTC
Command gpt select PARTITION_UUIDS which depends on PARTITIONS which is
doesn't need to be enabled.

Kconfig reports it like this.

WARNING: unmet direct dependencies detected for PARTITION_UUIDS
  Depends on [n]: PARTITIONS [=n]
  Selected by [y]:
  - CMD_GPT [=y]

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 cmd/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Heinrich Schuchardt Aug. 19, 2020, 8:46 a.m. UTC | #1
On 19.08.20 10:44, Michal Simek wrote:
> Command gpt select PARTITION_UUIDS which depends on PARTITIONS which is
> doesn't need to be enabled.
>
> Kconfig reports it like this.
>
> WARNING: unmet direct dependencies detected for PARTITION_UUIDS
>   Depends on [n]: PARTITIONS [=n]
>   Selected by [y]:
>   - CMD_GPT [=y]
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  cmd/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 9ad511aa176f..692fae5b8e89 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -1012,6 +1012,7 @@ config CMD_GPT
>  	bool "GPT (GUID Partition Table) command"
>  	select EFI_PARTITION
>  	select HAVE_BLOCK_DEVICE
> +	select PARTITIONS
>  	select PARTITION_UUIDS

It would be preferable to use "depends" instead of "select".

You don't want anybody to select this command on a device that does not
even have block devices.

Best regards

Heinrich


>  	imply RANDOM_UUID
>  	help
>
Michal Simek Aug. 19, 2020, 8:51 a.m. UTC | #2
On 19. 08. 20 10:46, Heinrich Schuchardt wrote:
> On 19.08.20 10:44, Michal Simek wrote:
>> Command gpt select PARTITION_UUIDS which depends on PARTITIONS which is
>> doesn't need to be enabled.
>>
>> Kconfig reports it like this.
>>
>> WARNING: unmet direct dependencies detected for PARTITION_UUIDS
>>   Depends on [n]: PARTITIONS [=n]
>>   Selected by [y]:
>>   - CMD_GPT [=y]
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>>  cmd/Kconfig | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/cmd/Kconfig b/cmd/Kconfig
>> index 9ad511aa176f..692fae5b8e89 100644
>> --- a/cmd/Kconfig
>> +++ b/cmd/Kconfig
>> @@ -1012,6 +1012,7 @@ config CMD_GPT
>>  	bool "GPT (GUID Partition Table) command"
>>  	select EFI_PARTITION
>>  	select HAVE_BLOCK_DEVICE
>> +	select PARTITIONS
>>  	select PARTITION_UUIDS
> 
> It would be preferable to use "depends" instead of "select".
> 
> You don't want anybody to select this command on a device that does not
> even have block devices.

Do we have any doc which is talking about preferred ways?

If you look at all patches I have used mostly depends on instead of
select with 2 exception. This patch and then last one 9/9.

In this case I use select because as you use there is already a lot of
other selection for EFI, BLOCK_DEVICE and UUIDS.

Thanks,
Michal
Heinrich Schuchardt Aug. 19, 2020, 9:01 a.m. UTC | #3
On 19.08.20 10:51, Michal Simek wrote:
>
>
> On 19. 08. 20 10:46, Heinrich Schuchardt wrote:
>> On 19.08.20 10:44, Michal Simek wrote:
>>> Command gpt select PARTITION_UUIDS which depends on PARTITIONS which is
>>> doesn't need to be enabled.
>>>
>>> Kconfig reports it like this.
>>>
>>> WARNING: unmet direct dependencies detected for PARTITION_UUIDS
>>>   Depends on [n]: PARTITIONS [=n]
>>>   Selected by [y]:
>>>   - CMD_GPT [=y]
>>>
>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>> ---
>>>
>>>  cmd/Kconfig | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/cmd/Kconfig b/cmd/Kconfig
>>> index 9ad511aa176f..692fae5b8e89 100644
>>> --- a/cmd/Kconfig
>>> +++ b/cmd/Kconfig
>>> @@ -1012,6 +1012,7 @@ config CMD_GPT
>>>  	bool "GPT (GUID Partition Table) command"
>>>  	select EFI_PARTITION
>>>  	select HAVE_BLOCK_DEVICE
>>> +	select PARTITIONS
>>>  	select PARTITION_UUIDS
>>
>> It would be preferable to use "depends" instead of "select".
>>
>> You don't want anybody to select this command on a device that does not
>> even have block devices.
>
> Do we have any doc which is talking about preferred ways?
>
> If you look at all patches I have used mostly depends on instead of
> select with 2 exception. This patch and then last one 9/9.
>
> In this case I use select because as you use there is already a lot of
> other selection for EFI, BLOCK_DEVICE and UUIDS.

Select allows you to set something whose own dependencies are not
fulfilled. So depends is preferable.

Best regards

Heinrich
Tom Rini Aug. 19, 2020, 12:25 p.m. UTC | #4
On Wed, Aug 19, 2020 at 10:51:51AM +0200, Michal Simek wrote:
> On 19. 08. 20 10:46, Heinrich Schuchardt wrote:
> > On 19.08.20 10:44, Michal Simek wrote:
> >> Command gpt select PARTITION_UUIDS which depends on PARTITIONS which is
> >> doesn't need to be enabled.
> >>
> >> Kconfig reports it like this.
> >>
> >> WARNING: unmet direct dependencies detected for PARTITION_UUIDS
> >>   Depends on [n]: PARTITIONS [=n]
> >>   Selected by [y]:
> >>   - CMD_GPT [=y]
> >>
> >> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> >> ---
> >>
> >>  cmd/Kconfig | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/cmd/Kconfig b/cmd/Kconfig
> >> index 9ad511aa176f..692fae5b8e89 100644
> >> --- a/cmd/Kconfig
> >> +++ b/cmd/Kconfig
> >> @@ -1012,6 +1012,7 @@ config CMD_GPT
> >>  	bool "GPT (GUID Partition Table) command"
> >>  	select EFI_PARTITION
> >>  	select HAVE_BLOCK_DEVICE
> >> +	select PARTITIONS
> >>  	select PARTITION_UUIDS
> > 
> > It would be preferable to use "depends" instead of "select".
> > 
> > You don't want anybody to select this command on a device that does not
> > even have block devices.
> 
> Do we have any doc which is talking about preferred ways?
> 
> If you look at all patches I have used mostly depends on instead of
> select with 2 exception. This patch and then last one 9/9.
> 
> In this case I use select because as you use there is already a lot of
> other selection for EFI, BLOCK_DEVICE and UUIDS.

We don't have a preferred way to solve these problems because it depends
on what the problem even is to start with.  Library type functionality
should be select'd while configurable functionality should be depend'd
on.

In this case, PARTITION_UUIDS enables code in disk/part_dos.c and
disk/part_efi.c to get and store UUID information from the existing
table (and cmd/gpt.c is setting/etc those UUIDs).

So I suspect audit'ing these symbols down further to see what the code
usage of them requires is and going back up to the Kconfig logic is
what's needed here.
diff mbox series

Patch

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 9ad511aa176f..692fae5b8e89 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1012,6 +1012,7 @@  config CMD_GPT
 	bool "GPT (GUID Partition Table) command"
 	select EFI_PARTITION
 	select HAVE_BLOCK_DEVICE
+	select PARTITIONS
 	select PARTITION_UUIDS
 	imply RANDOM_UUID
 	help