aboutsummaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorSimon Glass2022-08-11 19:34:45 -0600
committerTom Rini2022-09-16 11:05:00 -0400
commita51eb8de31492d2139e66a7e66b8fb3f03ddca50 (patch)
tree65ad7cdda932cfa146f811a25b4a0648ebe47d0f /drivers/block
parentfc614d2044a41ce98588f591349ac0f8c1c43ff6 (diff)
blk: Use a function for whether block devices are available
At present we use HAVE_BLOCK_DEVICE to indicate when block devices are available. This is a very strange option, since it partially duplicates the BLK option used by driver model. It also covers both U-Boot proper and SPL, even though one might have block devices and another not. As a first step towards correcting this, create a new inline function called blk_enabled() which indicates if block devices are available. This cannot be used in Makefiles, or #if clauses, but can be used in C code. A function is useful because we cannot use CONFIG_IS_ENABLED(BLK) to decide if block devices are needed, since we must consider the legacy block interface, enabled by HAVE_BLOCK_DEVICE Update a few places where it can be used and drop some unnecessary #if checks around some functions in disk/part.c - rely on the compiler's dead-code elimination instead. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/blk-uclass.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index 21c5209bb63..1a6e8f8c29d 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -743,8 +743,7 @@ int blk_unbind_all(int if_type)
static int blk_post_probe(struct udevice *dev)
{
- if (CONFIG_IS_ENABLED(PARTITIONS) &&
- IS_ENABLED(CONFIG_HAVE_BLOCK_DEVICE)) {
+ if (CONFIG_IS_ENABLED(PARTITIONS) && blk_enabled()) {
struct blk_desc *desc = dev_get_uclass_plat(dev);
part_init(desc);