From: Helge Deller <deller@gmx.de>
To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org
Cc: Ethan Nelson-Moore <enelsonmoore@gmail.com>
Subject: [PATCH] lib/fonts: Avoid unncessary 64-bit math in font code
Date: Sun, 7 Jun 2026 23:02:03 +0200 [thread overview]
Message-ID: <20260607210203.229613-1-deller@gmx.de> (raw)
The text display code used in the Risc PC kernel image decompression
code uses arch/arm/boot/compressed/font.c, which includes
lib/fonts/font_acorn_8x8.c, which further includes <linux/font.h>.
Since commit 97df8960240a ("lib/fonts: Provide helpers for calculating
glyph pitch and size") <linux/font.h> contains inline functions that
require __do_div64, which is not linked into the ARM kernel
decompressor. This makes Risc PC zImages fail to build.
There is no need to use 64-bit division code here, so resolve this issue
by using plain standard addition and shift maths.
Fixes: 97df8960240a ("lib/fonts: Provide helpers for calculating glyph pitch and size")
Reported-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
---
include/linux/font.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/include/linux/font.h b/include/linux/font.h
index 6845f02d739a..67d32268989d 100644
--- a/include/linux/font.h
+++ b/include/linux/font.h
@@ -11,7 +11,6 @@
#ifndef _VIDEO_FONT_H
#define _VIDEO_FONT_H
-#include <linux/math.h>
#include <linux/types.h>
struct console_font;
@@ -35,7 +34,7 @@ struct console_font;
*/
static inline unsigned int font_glyph_pitch(unsigned int width)
{
- return DIV_ROUND_UP(width, 8);
+ return (width + 7) >> 3;
}
/**
--
2.54.0
next reply other threads:[~2026-06-07 21:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 21:02 Helge Deller [this message]
2026-06-08 4:50 ` [PATCH] lib/fonts: Avoid unncessary 64-bit math in font code Ethan Nelson-Moore
2026-06-08 11:25 ` Thomas Zimmermann
2026-06-08 19:57 ` Helge Deller
2026-06-08 20:14 ` Ethan Nelson-Moore
2026-06-08 20:26 ` Helge Deller
2026-06-09 1:50 ` Ethan Nelson-Moore
2026-06-09 6:14 ` Thomas Zimmermann
2026-06-09 9:03 ` Helge Deller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260607210203.229613-1-deller@gmx.de \
--to=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=enelsonmoore@gmail.com \
--cc=linux-fbdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox