Skip to content

Commit bb0890b

Browse files
peilin-yedanvet
authored andcommitted
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: [email protected] Signed-off-by: Peilin Ye <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/7fb8bc9b0abc676ada6b7ac0e0bd443499357267.1600953813.git.yepeilin.cs@gmail.com
1 parent 19a508b commit bb0890b

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

drivers/video/console/newport_con.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@
3535

3636
#define FONT_DATA ((unsigned char *)font_vga_8x16.data)
3737

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-
4438
static unsigned char *font_data[MAX_NR_CONSOLES];
4539

4640
static struct newport_regs *npregs;
@@ -522,6 +516,7 @@ static int newport_set_font(int unit, struct console_font *op)
522516
FNTSIZE(new_data) = size;
523517
FNTCHARCNT(new_data) = op->charcount;
524518
REFCOUNT(new_data) = 0; /* usage counter */
519+
FNTSUM(new_data) = 0;
525520

526521
p = new_data;
527522
for (i = 0; i < op->charcount; i++) {

drivers/video/fbdev/core/fbcon.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,6 @@ static inline int attr_col_ec(int shift, struct vc_data *vc,
152152
#define attr_bgcol_ec(bgshift, vc, info) attr_col_ec(bgshift, vc, info, 0)
153153
#define attr_fgcol_ec(fgshift, vc, info) attr_col_ec(fgshift, vc, info, 1)
154154

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-
162155
/*
163156
* Scroll Method
164157
*/

drivers/video/fbdev/core/fbcon_rotate.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/fb.h>
1515
#include <linux/vt_kern.h>
1616
#include <linux/console.h>
17+
#include <linux/font.h>
1718
#include <asm/types.h>
1819
#include "fbcon.h"
1920
#include "fbcon_rotate.h"

drivers/video/fbdev/core/tileblit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/fb.h>
1414
#include <linux/vt_kern.h>
1515
#include <linux/console.h>
16+
#include <linux/font.h>
1617
#include <asm/types.h>
1718
#include "fbcon.h"
1819

include/linux/font.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,12 @@ extern const struct font_desc *get_default_font(int xres, int yres,
5959
/* Max. length for the name of a predefined font */
6060
#define MAX_FONT_NAME 32
6161

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+
6270
#endif /* _VIDEO_FONT_H */

0 commit comments

Comments
 (0)