diff mbox series

[4/6] blk: Make block subsystems select BLK

Message ID 20241220222612.1757884-5-trini@konsulko.com
State Changes Requested
Delegated to: Tom Rini
Headers show
Series Rework the BLK symbol usage in Kconfig | expand

Commit Message

Tom Rini Dec. 20, 2024, 10:22 p.m. UTC
The BLK symbol has a few meanings, one of which is that it controls the
driver model portion of a "block device". Rather than having this hidden
symbol be "default y if ..." it should be select'd by the various block
subsystems.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
 drivers/ata/Kconfig    | 2 ++
 drivers/block/Kconfig  | 7 +++----
 drivers/mmc/Kconfig    | 1 +
 drivers/nvme/Kconfig   | 1 +
 drivers/scsi/Kconfig   | 1 +
 drivers/usb/Kconfig    | 1 +
 drivers/virtio/Kconfig | 1 +
 7 files changed, 10 insertions(+), 4 deletions(-)

Comments

Peter Robinson Dec. 23, 2024, 6:31 p.m. UTC | #1
On Fri, 20 Dec 2024 at 22:36, Tom Rini <trini@konsulko.com> wrote:

> The BLK symbol has a few meanings, one of which is that it controls the
> driver model portion of a "block device". Rather than having this hidden
> symbol be "default y if ..." it should be select'd by the various block
> subsystems.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
>

Just a minor query against the USB change, other than that the rest looks
fine.

Reviewed-by: Peter Robinson <pbrobinson@gmail.com>


> ---
>  drivers/ata/Kconfig    | 2 ++
>  drivers/block/Kconfig  | 7 +++----
>  drivers/mmc/Kconfig    | 1 +
>  drivers/nvme/Kconfig   | 1 +
>  drivers/scsi/Kconfig   | 1 +
>  drivers/usb/Kconfig    | 1 +
>  drivers/virtio/Kconfig | 1 +
>  7 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index 4fbb63a148ac..29ceab849c02 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -1,6 +1,7 @@
>  config AHCI
>         bool "Support SATA controllers with driver model"
>         depends on DM
> +       select BLK
>         help
>           This enables a uclass for disk controllers in U-Boot. Various
> driver
>           types can use this, such as AHCI/SATA. It does not provide any
> standard
> @@ -9,6 +10,7 @@ config AHCI
>
>  config SATA
>         bool "Support SATA controllers"
> +       select BLK
>         help
>           This enables support for SATA (Serial Advanced Technology
>           Attachment), a serial bus standard for connecting to hard drives
> and
> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> index 5283d8981e09..cc75bad02b8c 100644
> --- a/drivers/block/Kconfig
> +++ b/drivers/block/Kconfig
> @@ -1,8 +1,5 @@
>  config BLK
> -       bool # "Support block devices"
> -       depends on DM
> -       def_bool y if MMC || USB || SCSI || NVME || IDE || AHCI || SATA
> -       def_bool y if EFI_MEDIA || VIRTIO_BLK || PVBLOCK
> +       bool
>         help
>           Enable support for block devices, such as SCSI, MMC and USB
>           flash sticks. These provide a block-level interface which permits
> @@ -100,6 +97,7 @@ config TPL_BLOCK_CACHE
>  config EFI_MEDIA
>         bool "Support EFI media drivers"
>         default y if EFI || SANDBOX
> +       select BLK
>         help
>           Enable this to support media devices on top of UEFI. This enables
>           just the uclass so you also need a specific driver to make this
> do
> @@ -139,6 +137,7 @@ endif  # EFI_MEDIA
>
>  config IDE
>         bool "Support IDE controllers"
> +       select BLK
>         help
>           Enables support for IDE (Integrated Drive Electronics) hard
> drives.
>           This allows access to raw blocks and filesystems on an IDE drive
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index 46513db0d6e3..4827834b4aab 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -3,6 +3,7 @@ menu "MMC Host controller Support"
>  config MMC
>         bool "MMC/SD/SDIO card support"
>         default ARM || PPC || SANDBOX
> +       select BLK
>         select DM_MMC
>         help
>           This selects MultiMediaCard, Secure Digital and Secure
> diff --git a/drivers/nvme/Kconfig b/drivers/nvme/Kconfig
> index 73edb3551606..d138867666bd 100644
> --- a/drivers/nvme/Kconfig
> +++ b/drivers/nvme/Kconfig
> @@ -4,6 +4,7 @@
>
>  config NVME
>         bool "NVM Express device support"
> +       select BLK
>         help
>           This option enables support for NVM Express devices.
>           It supports basic functions of NVMe (read/write).
> diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
> index 7e21c4ae2bb8..fc87d34cca39 100644
> --- a/drivers/scsi/Kconfig
> +++ b/drivers/scsi/Kconfig
> @@ -1,5 +1,6 @@
>  config SCSI
>         bool "Support SCSI controllers with driver model"
> +       select BLK
>         help
>           This enables support for SCSI (Small Computer System Interface),
>           a parallel interface widely used with storage peripherals such as
> diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
> index 960b6a906ac4..99c6649e4178 100644
> --- a/drivers/usb/Kconfig
> +++ b/drivers/usb/Kconfig
> @@ -1,5 +1,6 @@
>  menuconfig USB
>         bool "USB support"
> +       select BLK
>

Shouldn't this be against USB_STORAGE further down the file?


>         ---help---
>           Universal Serial Bus (USB) is a specification for a serial bus
>           subsystem which offers higher speeds and more features than the
> diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig
> index 1de68867d52e..512ac376f185 100644
> --- a/drivers/virtio/Kconfig
> +++ b/drivers/virtio/Kconfig
> @@ -64,6 +64,7 @@ config VIRTIO_NET
>  config VIRTIO_BLK
>         bool "virtio block driver"
>         depends on VIRTIO
> +       select BLK
>         help
>           This is the virtual block driver for virtio. It can be used with
>           QEMU based targets.
> --
> 2.43.0
>
>
Tom Rini Dec. 23, 2024, 6:53 p.m. UTC | #2
On Mon, Dec 23, 2024 at 06:31:58PM +0000, Peter Robinson wrote:
> On Fri, 20 Dec 2024 at 22:36, Tom Rini <trini@konsulko.com> wrote:
> 
> > The BLK symbol has a few meanings, one of which is that it controls the
> > driver model portion of a "block device". Rather than having this hidden
> > symbol be "default y if ..." it should be select'd by the various block
> > subsystems.
> >
> > Signed-off-by: Tom Rini <trini@konsulko.com>
> >
> 
> Just a minor query against the USB change, other than that the rest looks
> fine.
[snip]
> > diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
> > index 960b6a906ac4..99c6649e4178 100644
> > --- a/drivers/usb/Kconfig
> > +++ b/drivers/usb/Kconfig
> > @@ -1,5 +1,6 @@
> >  menuconfig USB
> >         bool "USB support"
> > +       select BLK
> >
> 
> Shouldn't this be against USB_STORAGE further down the file?

So, this is a 1:1 translation of what we have today. That said, it
likely could be done at the USB_STORAGE level for USB host, and
USB_FUNCTION_MASS_STORAGE for gadget (the entry for CMD_USB_MASS_STORAGE
is depends on BLK) ? I was slightly worried about opening up a number of
problems if I poked too hard on this area and didn't want the series to
get too big.
Quentin Schulz Jan. 14, 2025, 1:45 p.m. UTC | #3
Hi Tom,

On 12/20/24 11:22 PM, Tom Rini wrote:
> The BLK symbol has a few meanings, one of which is that it controls the
> driver model portion of a "block device". Rather than having this hidden
> symbol be "default y if ..." it should be select'd by the various block
> subsystems.
> 
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
>   drivers/ata/Kconfig    | 2 ++
>   drivers/block/Kconfig  | 7 +++----
>   drivers/mmc/Kconfig    | 1 +
>   drivers/nvme/Kconfig   | 1 +
>   drivers/scsi/Kconfig   | 1 +
>   drivers/usb/Kconfig    | 1 +
>   drivers/virtio/Kconfig | 1 +
>   7 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index 4fbb63a148ac..29ceab849c02 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -1,6 +1,7 @@
>   config AHCI
>   	bool "Support SATA controllers with driver model"
>   	depends on DM
> +	select BLK
>   	help
>   	  This enables a uclass for disk controllers in U-Boot. Various driver
>   	  types can use this, such as AHCI/SATA. It does not provide any standard
> @@ -9,6 +10,7 @@ config AHCI
>   
>   config SATA
>   	bool "Support SATA controllers"
> +	select BLK
>   	help
>   	  This enables support for SATA (Serial Advanced Technology
>   	  Attachment), a serial bus standard for connecting to hard drives and
> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> index 5283d8981e09..cc75bad02b8c 100644
> --- a/drivers/block/Kconfig
> +++ b/drivers/block/Kconfig
> @@ -1,8 +1,5 @@
>   config BLK
> -	bool # "Support block devices"
> -	depends on DM
> -	def_bool y if MMC || USB || SCSI || NVME || IDE || AHCI || SATA
> -	def_bool y if EFI_MEDIA || VIRTIO_BLK || PVBLOCK

I believe you missed adding a select BLK for the PVBLOCK symbol?

Looks good to me otherwise, I was actually confused as to why we used 
def_bool instead of select (see what it prompted in my comment for patch 
1 :) ).

Cheers,
Quentin
Tom Rini Jan. 14, 2025, 4:58 p.m. UTC | #4
On Tue, Jan 14, 2025 at 02:45:25PM +0100, Quentin Schulz wrote:
> Hi Tom,
> 
> On 12/20/24 11:22 PM, Tom Rini wrote:
> > The BLK symbol has a few meanings, one of which is that it controls the
> > driver model portion of a "block device". Rather than having this hidden
> > symbol be "default y if ..." it should be select'd by the various block
> > subsystems.
> > 
> > Signed-off-by: Tom Rini <trini@konsulko.com>
> > ---
> >   drivers/ata/Kconfig    | 2 ++
> >   drivers/block/Kconfig  | 7 +++----
> >   drivers/mmc/Kconfig    | 1 +
> >   drivers/nvme/Kconfig   | 1 +
> >   drivers/scsi/Kconfig   | 1 +
> >   drivers/usb/Kconfig    | 1 +
> >   drivers/virtio/Kconfig | 1 +
> >   7 files changed, 10 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> > index 4fbb63a148ac..29ceab849c02 100644
> > --- a/drivers/ata/Kconfig
> > +++ b/drivers/ata/Kconfig
> > @@ -1,6 +1,7 @@
> >   config AHCI
> >   	bool "Support SATA controllers with driver model"
> >   	depends on DM
> > +	select BLK
> >   	help
> >   	  This enables a uclass for disk controllers in U-Boot. Various driver
> >   	  types can use this, such as AHCI/SATA. It does not provide any standard
> > @@ -9,6 +10,7 @@ config AHCI
> >   config SATA
> >   	bool "Support SATA controllers"
> > +	select BLK
> >   	help
> >   	  This enables support for SATA (Serial Advanced Technology
> >   	  Attachment), a serial bus standard for connecting to hard drives and
> > diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> > index 5283d8981e09..cc75bad02b8c 100644
> > --- a/drivers/block/Kconfig
> > +++ b/drivers/block/Kconfig
> > @@ -1,8 +1,5 @@
> >   config BLK
> > -	bool # "Support block devices"
> > -	depends on DM
> > -	def_bool y if MMC || USB || SCSI || NVME || IDE || AHCI || SATA
> > -	def_bool y if EFI_MEDIA || VIRTIO_BLK || PVBLOCK
> 
> I believe you missed adding a select BLK for the PVBLOCK symbol?

In this case, PVBLOCK was one of the few (as it's newer) symbols that
was doing this correctly.
Quentin Schulz Jan. 15, 2025, 5:38 p.m. UTC | #5
Hi Tom,

On 1/14/25 5:58 PM, Tom Rini wrote:
> On Tue, Jan 14, 2025 at 02:45:25PM +0100, Quentin Schulz wrote:
>> Hi Tom,
>>
>> On 12/20/24 11:22 PM, Tom Rini wrote:
>>> The BLK symbol has a few meanings, one of which is that it controls the
>>> driver model portion of a "block device". Rather than having this hidden
>>> symbol be "default y if ..." it should be select'd by the various block
>>> subsystems.
>>>
>>> Signed-off-by: Tom Rini <trini@konsulko.com>
>>> ---
>>>    drivers/ata/Kconfig    | 2 ++
>>>    drivers/block/Kconfig  | 7 +++----
>>>    drivers/mmc/Kconfig    | 1 +
>>>    drivers/nvme/Kconfig   | 1 +
>>>    drivers/scsi/Kconfig   | 1 +
>>>    drivers/usb/Kconfig    | 1 +
>>>    drivers/virtio/Kconfig | 1 +
>>>    7 files changed, 10 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
>>> index 4fbb63a148ac..29ceab849c02 100644
>>> --- a/drivers/ata/Kconfig
>>> +++ b/drivers/ata/Kconfig
>>> @@ -1,6 +1,7 @@
>>>    config AHCI
>>>    	bool "Support SATA controllers with driver model"
>>>    	depends on DM
>>> +	select BLK
>>>    	help
>>>    	  This enables a uclass for disk controllers in U-Boot. Various driver
>>>    	  types can use this, such as AHCI/SATA. It does not provide any standard
>>> @@ -9,6 +10,7 @@ config AHCI
>>>    config SATA
>>>    	bool "Support SATA controllers"
>>> +	select BLK
>>>    	help
>>>    	  This enables support for SATA (Serial Advanced Technology
>>>    	  Attachment), a serial bus standard for connecting to hard drives and
>>> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
>>> index 5283d8981e09..cc75bad02b8c 100644
>>> --- a/drivers/block/Kconfig
>>> +++ b/drivers/block/Kconfig
>>> @@ -1,8 +1,5 @@
>>>    config BLK
>>> -	bool # "Support block devices"
>>> -	depends on DM
>>> -	def_bool y if MMC || USB || SCSI || NVME || IDE || AHCI || SATA
>>> -	def_bool y if EFI_MEDIA || VIRTIO_BLK || PVBLOCK
>>
>> I believe you missed adding a select BLK for the PVBLOCK symbol?
> 
> In this case, PVBLOCK was one of the few (as it's newer) symbols that
> was doing this correctly.
> 

Indeed! Would have been nice to mention that is was not an oversight in 
the commit log :)

Cheers,
Quentin
diff mbox series

Patch

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 4fbb63a148ac..29ceab849c02 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -1,6 +1,7 @@ 
 config AHCI
 	bool "Support SATA controllers with driver model"
 	depends on DM
+	select BLK
 	help
 	  This enables a uclass for disk controllers in U-Boot. Various driver
 	  types can use this, such as AHCI/SATA. It does not provide any standard
@@ -9,6 +10,7 @@  config AHCI
 
 config SATA
 	bool "Support SATA controllers"
+	select BLK
 	help
 	  This enables support for SATA (Serial Advanced Technology
 	  Attachment), a serial bus standard for connecting to hard drives and
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 5283d8981e09..cc75bad02b8c 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -1,8 +1,5 @@ 
 config BLK
-	bool # "Support block devices"
-	depends on DM
-	def_bool y if MMC || USB || SCSI || NVME || IDE || AHCI || SATA
-	def_bool y if EFI_MEDIA || VIRTIO_BLK || PVBLOCK
+	bool
 	help
 	  Enable support for block devices, such as SCSI, MMC and USB
 	  flash sticks. These provide a block-level interface which permits
@@ -100,6 +97,7 @@  config TPL_BLOCK_CACHE
 config EFI_MEDIA
 	bool "Support EFI media drivers"
 	default y if EFI || SANDBOX
+	select BLK
 	help
 	  Enable this to support media devices on top of UEFI. This enables
 	  just the uclass so you also need a specific driver to make this do
@@ -139,6 +137,7 @@  endif  # EFI_MEDIA
 
 config IDE
 	bool "Support IDE controllers"
+	select BLK
 	help
 	  Enables support for IDE (Integrated Drive Electronics) hard drives.
 	  This allows access to raw blocks and filesystems on an IDE drive
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index 46513db0d6e3..4827834b4aab 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -3,6 +3,7 @@  menu "MMC Host controller Support"
 config MMC
 	bool "MMC/SD/SDIO card support"
 	default ARM || PPC || SANDBOX
+	select BLK
 	select DM_MMC
 	help
 	  This selects MultiMediaCard, Secure Digital and Secure
diff --git a/drivers/nvme/Kconfig b/drivers/nvme/Kconfig
index 73edb3551606..d138867666bd 100644
--- a/drivers/nvme/Kconfig
+++ b/drivers/nvme/Kconfig
@@ -4,6 +4,7 @@ 
 
 config NVME
 	bool "NVM Express device support"
+	select BLK
 	help
 	  This option enables support for NVM Express devices.
 	  It supports basic functions of NVMe (read/write).
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 7e21c4ae2bb8..fc87d34cca39 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1,5 +1,6 @@ 
 config SCSI
 	bool "Support SCSI controllers with driver model"
+	select BLK
 	help
 	  This enables support for SCSI (Small Computer System Interface),
 	  a parallel interface widely used with storage peripherals such as
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 960b6a906ac4..99c6649e4178 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -1,5 +1,6 @@ 
 menuconfig USB
 	bool "USB support"
+	select BLK
 	---help---
 	  Universal Serial Bus (USB) is a specification for a serial bus
 	  subsystem which offers higher speeds and more features than the
diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig
index 1de68867d52e..512ac376f185 100644
--- a/drivers/virtio/Kconfig
+++ b/drivers/virtio/Kconfig
@@ -64,6 +64,7 @@  config VIRTIO_NET
 config VIRTIO_BLK
 	bool "virtio block driver"
 	depends on VIRTIO
+	select BLK
 	help
 	  This is the virtual block driver for virtio. It can be used with
 	  QEMU based targets.