From: Thomas Zimmermann <tzimmermann@suse.de>
To: deller@gmx.de, gregkh@linuxfoundation.org, jirislaby@kernel.org,
simona@ffwll.ch, sam@ravnborg.org
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 02/10] vt: Implement helpers for struct vc_font in source file
Date: Fri, 27 Mar 2026 13:49:35 +0100 [thread overview]
Message-ID: <20260327130431.59481-3-tzimmermann@suse.de> (raw)
In-Reply-To: <20260327130431.59481-1-tzimmermann@suse.de>
Move the helpers vc_font_pitch() and vc_font_size() from the VT
header file into source file. They are not called very often, so
there's no benefit in keeping them in the headers. Also avoids
including <liux/math.h> from the header.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/tty/vt/vt.c | 35 ++++++++++++++++++++++++++++++++++
include/linux/console_struct.h | 30 ++---------------------------
2 files changed, 37 insertions(+), 28 deletions(-)
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index e2df99e3d458..3d89d30c9596 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -71,6 +71,7 @@
* by Adam Tla/lka <atlka@pg.gda.pl>, Aug 2006
*/
+#include <linux/math.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/sched/signal.h>
@@ -230,6 +231,40 @@ enum {
blank_vesa_wait,
};
+/*
+ * struct vc_font
+ */
+
+/**
+ * vc_font_pitch - Calculates the number of bytes between two adjacent scanlines
+ * @font: The VC font
+ *
+ * Returns:
+ * The number of bytes between two adjacent scanlines in the font data
+ */
+unsigned int vc_font_pitch(const struct vc_font *font)
+{
+ return DIV_ROUND_UP(font->width, 8);
+}
+EXPORT_SYMBOL_GPL(vc_font_pitch);
+
+/**
+ * vc_font_size - Calculates the size of the font data in bytes
+ * @font: The VC font
+ *
+ * vc_font_size() calculates the number of bytes of font data in the
+ * font specified by @font. The function calculates the size from the
+ * font parameters.
+ *
+ * Returns:
+ * The size of the font data in bytes.
+ */
+unsigned int vc_font_size(const struct vc_font *font)
+{
+ return font->height * vc_font_pitch(font) * font->charcount;
+}
+EXPORT_SYMBOL_GPL(vc_font_size);
+
/*
* /sys/class/tty/tty0/
*
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index 6ce498b31855..fe915afdece5 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -13,7 +13,6 @@
#ifndef _LINUX_CONSOLE_STRUCT_H
#define _LINUX_CONSOLE_STRUCT_H
-#include <linux/math.h>
#include <linux/vt.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
@@ -83,33 +82,8 @@ struct vc_font {
const unsigned char *data;
};
-/**
- * vc_font_pitch - Calculates the number of bytes between two adjacent scanlines
- * @font: The VC font
- *
- * Returns:
- * The number of bytes between two adjacent scanlines in the font data
- */
-static inline unsigned int vc_font_pitch(const struct vc_font *font)
-{
- return DIV_ROUND_UP(font->width, 8);
-}
-
-/**
- * vc_font_size - Calculates the size of the font data in bytes
- * @font: The VC font
- *
- * vc_font_size() calculates the number of bytes of font data in the
- * font specified by @font. The function calculates the size from the
- * font parameters.
- *
- * Returns:
- * The size of the font data in bytes.
- */
-static inline unsigned int vc_font_size(const struct vc_font *font)
-{
- return font->height * vc_font_pitch(font) * font->charcount;
-}
+unsigned int vc_font_pitch(const struct vc_font *font);
+unsigned int vc_font_size(const struct vc_font *font);
/*
* Example: vc_data of a console that was scrolled 3 lines down.
--
2.53.0
next prev parent reply other threads:[~2026-03-27 13:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-27 12:49 [PATCH 00/10] fbcon,fonts: Refactor framebuffer console rotation Thomas Zimmermann
2026-03-27 12:49 ` [PATCH 01/10] fbcon: Avoid OOB font access if console rotation fails Thomas Zimmermann
2026-03-27 12:49 ` Thomas Zimmermann [this message]
2026-03-27 12:49 ` [PATCH 03/10] lib/fonts: Provide helpers for calculating glyph pitch and size Thomas Zimmermann
2026-03-27 12:49 ` [PATCH 04/10] lib/fonts: Clean up Makefile Thomas Zimmermann
2026-03-27 12:49 ` [PATCH 05/10] lib/fonts: Implement glyph rotation Thomas Zimmermann
2026-03-27 12:49 ` [PATCH 06/10] lib/fonts: Refactor glyph-pattern helpers Thomas Zimmermann
2026-03-27 12:49 ` [PATCH 07/10] lib/fonts: Refactor glyph-rotation helpers Thomas Zimmermann
2026-03-27 12:49 ` [PATCH 08/10] lib/fonts: Implement font rotation Thomas Zimmermann
2026-03-27 12:49 ` [PATCH 09/10] fbcon: Fill cursor mask in helper function Thomas Zimmermann
2026-03-27 12:49 ` [PATCH 10/10] fbcon: Put font-rotation state into separate struct Thomas Zimmermann
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=20260327130431.59481-3-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=sam@ravnborg.org \
--cc=simona@ffwll.ch \
/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