Hi

Am 07.06.26 um 23:02 schrieb Helge Deller:
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.

Why is there a 64-bit division at all?


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;

Ok by me, if that's what's necessary. But can we try to keep a documented macro for the division to make the code explain itself? Does it work with DIV_ROUND_UP_POW2() ?

Best regards
Thomas

  }
/**

--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)


Reply via email to