diff options
author | Simon Glass <sjg@chromium.org> | 2022-10-06 08:36:10 -0600 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2022-10-30 20:01:40 +0100 |
commit | 5330612f219bcd98f99b977a1fdec51c6b265ad2 (patch) | |
tree | 23d340e4bcb78c45250ef19ef685dfca8450f229 | |
parent | 0d3890188d6bcaf7172678d2e5e803035e85dc8d (diff) |
video: Tidy up the check for valid fonts
Put this check into a function so we can use it elsewhere. Also drop the
macros which do the same thing but are not actually used.
Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | drivers/video/console_truetype.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index c04b449a6d5..1331ce8d896 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -526,9 +526,18 @@ static struct font_info font_table[] = { {} /* sentinel */ }; -#define FONT_BEGIN(name) __ttf_ ## name ## _begin -#define FONT_END(name) __ttf_ ## name ## _end -#define FONT_IS_VALID(name) (abs(FONT_END(name) - FONT_BEGIN) > 4) +/** + * font_valid() - Check if a font-table entry is valid + * + * Depending on available files in the build system, fonts may end up being + * empty. + * + * @return true if the entry is valid + */ +static inline bool font_valid(struct font_info *tab) +{ + return abs(tab->begin - tab->end) > 4; +} /** * console_truetype_find_font() - Find a suitable font @@ -542,7 +551,7 @@ static u8 *console_truetype_find_font(void) struct font_info *tab; for (tab = font_table; tab->begin; tab++) { - if (abs(tab->begin - tab->end) > 4) { + if (font_valid(tab)) { debug("%s: Font '%s', at %p, size %lx\n", __func__, tab->name, tab->begin, (ulong)(tab->end - tab->begin)); |