Commit bb0890b4 authored by Peilin Ye's avatar Peilin Ye Committed by Daniel Vetter

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: default avatarPeilin Ye <yepeilin.cs@gmail.com>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/7fb8bc9b0abc676ada6b7ac0e0bd443499357267.1600953813.git.yepeilin.cs@gmail.com
parent 19a508bd
...@@ -35,12 +35,6 @@ ...@@ -35,12 +35,6 @@
#define FONT_DATA ((unsigned char *)font_vga_8x16.data) #define FONT_DATA ((unsigned char *)font_vga_8x16.data)
/* borrowed from fbcon.c */
#define REFCOUNT(fd) (((int *)(fd))[-1])
#define FNTSIZE(fd) (((int *)(fd))[-2])
#define FNTCHARCNT(fd) (((int *)(fd))[-3])
#define FONT_EXTRA_WORDS 3
static unsigned char *font_data[MAX_NR_CONSOLES]; static unsigned char *font_data[MAX_NR_CONSOLES];
static struct newport_regs *npregs; static struct newport_regs *npregs;
...@@ -522,6 +516,7 @@ static int newport_set_font(int unit, struct console_font *op) ...@@ -522,6 +516,7 @@ static int newport_set_font(int unit, struct console_font *op)
FNTSIZE(new_data) = size; FNTSIZE(new_data) = size;
FNTCHARCNT(new_data) = op->charcount; FNTCHARCNT(new_data) = op->charcount;
REFCOUNT(new_data) = 0; /* usage counter */ REFCOUNT(new_data) = 0; /* usage counter */
FNTSUM(new_data) = 0;
p = new_data; p = new_data;
for (i = 0; i < op->charcount; i++) { for (i = 0; i < op->charcount; i++) {
......
...@@ -152,13 +152,6 @@ static inline int attr_col_ec(int shift, struct vc_data *vc, ...@@ -152,13 +152,6 @@ static inline int attr_col_ec(int shift, struct vc_data *vc,
#define attr_bgcol_ec(bgshift, vc, info) attr_col_ec(bgshift, vc, info, 0) #define attr_bgcol_ec(bgshift, vc, info) attr_col_ec(bgshift, vc, info, 0)
#define attr_fgcol_ec(fgshift, vc, info) attr_col_ec(fgshift, vc, info, 1) #define attr_fgcol_ec(fgshift, vc, info) attr_col_ec(fgshift, vc, info, 1)
/* Font */
#define REFCOUNT(fd) (((int *)(fd))[-1])
#define FNTSIZE(fd) (((int *)(fd))[-2])
#define FNTCHARCNT(fd) (((int *)(fd))[-3])
#define FNTSUM(fd) (((int *)(fd))[-4])
#define FONT_EXTRA_WORDS 4
/* /*
* Scroll Method * Scroll Method
*/ */
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/vt_kern.h> #include <linux/vt_kern.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/font.h>
#include <asm/types.h> #include <asm/types.h>
#include "fbcon.h" #include "fbcon.h"
#include "fbcon_rotate.h" #include "fbcon_rotate.h"
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/vt_kern.h> #include <linux/vt_kern.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/font.h>
#include <asm/types.h> #include <asm/types.h>
#include "fbcon.h" #include "fbcon.h"
......
...@@ -59,4 +59,12 @@ extern const struct font_desc *get_default_font(int xres, int yres, ...@@ -59,4 +59,12 @@ extern const struct font_desc *get_default_font(int xres, int yres,
/* Max. length for the name of a predefined font */ /* Max. length for the name of a predefined font */
#define MAX_FONT_NAME 32 #define MAX_FONT_NAME 32
/* Extra word getters */
#define REFCOUNT(fd) (((int *)(fd))[-1])
#define FNTSIZE(fd) (((int *)(fd))[-2])
#define FNTCHARCNT(fd) (((int *)(fd))[-3])
#define FNTSUM(fd) (((int *)(fd))[-4])
#define FONT_EXTRA_WORDS 4
#endif /* _VIDEO_FONT_H */ #endif /* _VIDEO_FONT_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment