]> git.baikalelectronics.ru Git - uboot.git/commit
blk: Use a function for whether block devices are available
authorSimon Glass <sjg@chromium.org>
Fri, 12 Aug 2022 01:34:45 +0000 (19:34 -0600)
committerTom Rini <trini@konsulko.com>
Fri, 16 Sep 2022 15:05:00 +0000 (11:05 -0400)
commitfeb150849bbe2f27d843426351060e4bdb05941c
tree65ad7cdda932cfa146f811a25b4a0648ebe47d0f
parent901678ed6b79f0e5184f5fbf33894af14fbb4518
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>
disk/part.c
drivers/block/blk-uclass.c
fs/fat/fat.c
include/blk.h