Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vt: Implement helpers for struct vc_font in source file

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 <linux/math.h> from the header.

v2:
- fix typo in commit description

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Thomas Zimmermann and committed by
Helge Deller
c713b964 e4ef723d

+37 -28
+35
drivers/tty/vt/vt.c
··· 71 71 * by Adam Tla/lka <atlka@pg.gda.pl>, Aug 2006 72 72 */ 73 73 74 + #include <linux/math.h> 74 75 #include <linux/module.h> 75 76 #include <linux/types.h> 76 77 #include <linux/sched/signal.h> ··· 230 229 blank_normal_wait, 231 230 blank_vesa_wait, 232 231 }; 232 + 233 + /* 234 + * struct vc_font 235 + */ 236 + 237 + /** 238 + * vc_font_pitch - Calculates the number of bytes between two adjacent scanlines 239 + * @font: The VC font 240 + * 241 + * Returns: 242 + * The number of bytes between two adjacent scanlines in the font data 243 + */ 244 + unsigned int vc_font_pitch(const struct vc_font *font) 245 + { 246 + return DIV_ROUND_UP(font->width, 8); 247 + } 248 + EXPORT_SYMBOL_GPL(vc_font_pitch); 249 + 250 + /** 251 + * vc_font_size - Calculates the size of the font data in bytes 252 + * @font: The VC font 253 + * 254 + * vc_font_size() calculates the number of bytes of font data in the 255 + * font specified by @font. The function calculates the size from the 256 + * font parameters. 257 + * 258 + * Returns: 259 + * The size of the font data in bytes. 260 + */ 261 + unsigned int vc_font_size(const struct vc_font *font) 262 + { 263 + return font->height * vc_font_pitch(font) * font->charcount; 264 + } 265 + EXPORT_SYMBOL_GPL(vc_font_size); 233 266 234 267 /* 235 268 * /sys/class/tty/tty0/
+2 -28
include/linux/console_struct.h
··· 13 13 #ifndef _LINUX_CONSOLE_STRUCT_H 14 14 #define _LINUX_CONSOLE_STRUCT_H 15 15 16 - #include <linux/math.h> 17 16 #include <linux/vt.h> 18 17 #include <linux/wait.h> 19 18 #include <linux/workqueue.h> ··· 82 83 const unsigned char *data; 83 84 }; 84 85 85 - /** 86 - * vc_font_pitch - Calculates the number of bytes between two adjacent scanlines 87 - * @font: The VC font 88 - * 89 - * Returns: 90 - * The number of bytes between two adjacent scanlines in the font data 91 - */ 92 - static inline unsigned int vc_font_pitch(const struct vc_font *font) 93 - { 94 - return DIV_ROUND_UP(font->width, 8); 95 - } 96 - 97 - /** 98 - * vc_font_size - Calculates the size of the font data in bytes 99 - * @font: The VC font 100 - * 101 - * vc_font_size() calculates the number of bytes of font data in the 102 - * font specified by @font. The function calculates the size from the 103 - * font parameters. 104 - * 105 - * Returns: 106 - * The size of the font data in bytes. 107 - */ 108 - static inline unsigned int vc_font_size(const struct vc_font *font) 109 - { 110 - return font->height * vc_font_pitch(font) * font->charcount; 111 - } 86 + unsigned int vc_font_pitch(const struct vc_font *font); 87 + unsigned int vc_font_size(const struct vc_font *font); 112 88 113 89 /* 114 90 * Example: vc_data of a console that was scrolled 3 lines down.