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 <[email protected]>
Signed-off-by: Helge Deller <[email protected]>
---
 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

Reply via email to