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

fbdev, newport_con: Move FONT_EXTRA_WORDS macros into linux/font.h

drivers/video/console/newport_con.c is borrowing FONT_EXTRA_WORDS macros
from drivers/video/fbdev/core/fbcon.h. To keep things simple, move all
definitions into <linux/font.h>.

Since newport_con now uses four extra words, initialize the fourth word in
newport_set_font() properly.

Cc: stable@vger.kernel.org
Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/7fb8bc9b0abc676ada6b7ac0e0bd443499357267.1600953813.git.yepeilin.cs@gmail.com

authored by

Peilin Ye and committed by
Daniel Vetter
bb0890b4 19a508bd

+11 -13
+1 -6
drivers/video/console/newport_con.c
··· 35 35 36 36 #define FONT_DATA ((unsigned char *)font_vga_8x16.data) 37 37 38 - /* borrowed from fbcon.c */ 39 - #define REFCOUNT(fd) (((int *)(fd))[-1]) 40 - #define FNTSIZE(fd) (((int *)(fd))[-2]) 41 - #define FNTCHARCNT(fd) (((int *)(fd))[-3]) 42 - #define FONT_EXTRA_WORDS 3 43 - 44 38 static unsigned char *font_data[MAX_NR_CONSOLES]; 45 39 46 40 static struct newport_regs *npregs; ··· 516 522 FNTSIZE(new_data) = size; 517 523 FNTCHARCNT(new_data) = op->charcount; 518 524 REFCOUNT(new_data) = 0; /* usage counter */ 525 + FNTSUM(new_data) = 0; 519 526 520 527 p = new_data; 521 528 for (i = 0; i < op->charcount; i++) {
-7
drivers/video/fbdev/core/fbcon.h
··· 152 152 #define attr_bgcol_ec(bgshift, vc, info) attr_col_ec(bgshift, vc, info, 0) 153 153 #define attr_fgcol_ec(fgshift, vc, info) attr_col_ec(fgshift, vc, info, 1) 154 154 155 - /* Font */ 156 - #define REFCOUNT(fd) (((int *)(fd))[-1]) 157 - #define FNTSIZE(fd) (((int *)(fd))[-2]) 158 - #define FNTCHARCNT(fd) (((int *)(fd))[-3]) 159 - #define FNTSUM(fd) (((int *)(fd))[-4]) 160 - #define FONT_EXTRA_WORDS 4 161 - 162 155 /* 163 156 * Scroll Method 164 157 */
+1
drivers/video/fbdev/core/fbcon_rotate.c
··· 14 14 #include <linux/fb.h> 15 15 #include <linux/vt_kern.h> 16 16 #include <linux/console.h> 17 + #include <linux/font.h> 17 18 #include <asm/types.h> 18 19 #include "fbcon.h" 19 20 #include "fbcon_rotate.h"
+1
drivers/video/fbdev/core/tileblit.c
··· 13 13 #include <linux/fb.h> 14 14 #include <linux/vt_kern.h> 15 15 #include <linux/console.h> 16 + #include <linux/font.h> 16 17 #include <asm/types.h> 17 18 #include "fbcon.h" 18 19
+8
include/linux/font.h
··· 59 59 /* Max. length for the name of a predefined font */ 60 60 #define MAX_FONT_NAME 32 61 61 62 + /* Extra word getters */ 63 + #define REFCOUNT(fd) (((int *)(fd))[-1]) 64 + #define FNTSIZE(fd) (((int *)(fd))[-2]) 65 + #define FNTCHARCNT(fd) (((int *)(fd))[-3]) 66 + #define FNTSUM(fd) (((int *)(fd))[-4]) 67 + 68 + #define FONT_EXTRA_WORDS 4 69 + 62 70 #endif /* _VIDEO_FONT_H */