diff options
author | Simon Glass <sjg@chromium.org> | 2022-08-12 04:34:45 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-09-16 18:05:00 +0300 |
commit | a51eb8de31492d2139e66a7e66b8fb3f03ddca50 (patch) | |
tree | 65ad7cdda932cfa146f811a25b4a0648ebe47d0f /fs/fat | |
parent | fc614d2044a41ce98588f591349ac0f8c1c43ff6 (diff) | |
download | u-boot-a51eb8de31492d2139e66a7e66b8fb3f03ddca50.tar.xz |
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 'fs/fat')
-rw-r--r-- | fs/fat/fat.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c index df9ea2c028..c64e253abd 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -1144,7 +1144,7 @@ int file_fat_detectfs(void) return 1; } - if (IS_ENABLED(CONFIG_HAVE_BLOCK_DEVICE)) { + if (blk_enabled()) { printf("Interface: %s\n", blk_get_if_type_name(cur_dev->if_type)); printf(" Device %d: ", cur_dev->devnum); dev_print(cur_dev); |