2023-07-12 09:20:22

by Jiri Slaby

[permalink] [raw]
Subject: [PATCH 0/7] consoles small cleanups

This is a series to do some small cleanups, especially in vgacon.

Jiri Slaby (SUSE) (7):
vgacon: switch vgacon_scrolldelta() and vgacon_restore_screen()
vgacon: remove unneeded forward declarations
vgacon: remove unused xpos from vgacon_set_cursor_size()
vgacon: let vgacon_doresize() return void
vgacon: cache vc_cell_height in vgacon_cursor()
sticon: make sticon_set_def_font() void and remove op parameter
fbcon: remove unused display (p) from fbcon_redraw()

drivers/video/console/sticon.c | 12 +++---
drivers/video/console/vgacon.c | 74 ++++++++++++--------------------
drivers/video/fbdev/core/fbcon.c | 7 ++-
3 files changed, 37 insertions(+), 56 deletions(-)

--
2.41.0



2023-07-12 09:20:53

by Jiri Slaby

[permalink] [raw]
Subject: [PATCH 3/7] vgacon: remove unused xpos from vgacon_set_cursor_size()

xpos is unused, remove it.

Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
Cc: Helge Deller <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/video/console/vgacon.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index a34cdfcc10c2..7cb15851ea56 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -437,7 +437,7 @@ static void vgacon_invert_region(struct vc_data *c, u16 * p, int count)
}
}

-static void vgacon_set_cursor_size(int xpos, int from, int to)
+static void vgacon_set_cursor_size(int from, int to)
{
unsigned long flags;
int curs, cure;
@@ -479,9 +479,9 @@ static void vgacon_cursor(struct vc_data *c, int mode)
case CM_ERASE:
write_vga(14, (c->vc_pos - vga_vram_base) / 2);
if (vga_video_type >= VIDEO_TYPE_VGAC)
- vgacon_set_cursor_size(c->state.x, 31, 30);
+ vgacon_set_cursor_size(31, 30);
else
- vgacon_set_cursor_size(c->state.x, 31, 31);
+ vgacon_set_cursor_size(31, 31);
break;

case CM_MOVE:
@@ -489,8 +489,7 @@ static void vgacon_cursor(struct vc_data *c, int mode)
write_vga(14, (c->vc_pos - vga_vram_base) / 2);
switch (CUR_SIZE(c->vc_cursor_type)) {
case CUR_UNDERLINE:
- vgacon_set_cursor_size(c->state.x,
- c->vc_cell_height -
+ vgacon_set_cursor_size(c->vc_cell_height -
(c->vc_cell_height <
10 ? 2 : 3),
c->vc_cell_height -
@@ -498,35 +497,31 @@ static void vgacon_cursor(struct vc_data *c, int mode)
10 ? 1 : 2));
break;
case CUR_TWO_THIRDS:
- vgacon_set_cursor_size(c->state.x,
- c->vc_cell_height / 3,
+ vgacon_set_cursor_size(c->vc_cell_height / 3,
c->vc_cell_height -
(c->vc_cell_height <
10 ? 1 : 2));
break;
case CUR_LOWER_THIRD:
- vgacon_set_cursor_size(c->state.x,
- (c->vc_cell_height * 2) / 3,
+ vgacon_set_cursor_size((c->vc_cell_height * 2) / 3,
c->vc_cell_height -
(c->vc_cell_height <
10 ? 1 : 2));
break;
case CUR_LOWER_HALF:
- vgacon_set_cursor_size(c->state.x,
- c->vc_cell_height / 2,
+ vgacon_set_cursor_size(c->vc_cell_height / 2,
c->vc_cell_height -
(c->vc_cell_height <
10 ? 1 : 2));
break;
case CUR_NONE:
if (vga_video_type >= VIDEO_TYPE_VGAC)
- vgacon_set_cursor_size(c->state.x, 31, 30);
+ vgacon_set_cursor_size(31, 30);
else
- vgacon_set_cursor_size(c->state.x, 31, 31);
+ vgacon_set_cursor_size(31, 31);
break;
default:
- vgacon_set_cursor_size(c->state.x, 1,
- c->vc_cell_height);
+ vgacon_set_cursor_size(1, c->vc_cell_height);
break;
}
break;
--
2.41.0


2023-07-12 09:21:14

by Jiri Slaby

[permalink] [raw]
Subject: [PATCH 1/7] vgacon: switch vgacon_scrolldelta() and vgacon_restore_screen()

Switch vgacon_scrolldelta() and vgacon_restore_screen() positions, so
that the former is not needed to be forward-declared.

Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
Cc: Helge Deller <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/video/console/vgacon.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index e25ba523892e..fbed2862c317 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -142,12 +142,6 @@ static inline void vga_set_mem_top(struct vc_data *c)
write_vga(12, (c->vc_visible_origin - vga_vram_base) / 2);
}

-static void vgacon_restore_screen(struct vc_data *c)
-{
- if (c->vc_origin != c->vc_visible_origin)
- vgacon_scrolldelta(c, 0);
-}
-
static void vgacon_scrolldelta(struct vc_data *c, int lines)
{
vc_scrolldelta_helper(c, lines, vga_rolled_over, (void *)vga_vram_base,
@@ -155,6 +149,12 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines)
vga_set_mem_top(c);
}

+static void vgacon_restore_screen(struct vc_data *c)
+{
+ if (c->vc_origin != c->vc_visible_origin)
+ vgacon_scrolldelta(c, 0);
+}
+
static const char *vgacon_startup(void)
{
const char *display_desc = NULL;
--
2.41.0


2023-07-12 09:21:15

by Jiri Slaby

[permalink] [raw]
Subject: [PATCH 6/7] sticon: make sticon_set_def_font() void and remove op parameter

sticon_set_def_font() always returns 0, so make it void. And remove an
unused 'op' parameter.

Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Cc: Helge Deller <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
drivers/video/console/sticon.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
index d11cfd2d68b5..992a4fa431aa 100644
--- a/drivers/video/console/sticon.c
+++ b/drivers/video/console/sticon.c
@@ -156,7 +156,7 @@ static bool sticon_scroll(struct vc_data *conp, unsigned int t,
return false;
}

-static int sticon_set_def_font(int unit, struct console_font *op)
+static void sticon_set_def_font(int unit)
{
if (font_data[unit] != STI_DEF_FONT) {
if (--FNTREFCOUNT(font_data[unit]) == 0) {
@@ -165,8 +165,6 @@ static int sticon_set_def_font(int unit, struct console_font *op)
}
font_data[unit] = STI_DEF_FONT;
}
-
- return 0;
}

static int sticon_set_font(struct vc_data *vc, struct console_font *op,
@@ -246,7 +244,7 @@ static int sticon_set_font(struct vc_data *vc, struct console_font *op,
vc->vc_video_erase_char, font_data[vc->vc_num]);

/* delete old font in case it is a user font */
- sticon_set_def_font(unit, NULL);
+ sticon_set_def_font(unit);

FNTREFCOUNT(cooked_font)++;
font_data[unit] = cooked_font;
@@ -264,7 +262,9 @@ static int sticon_set_font(struct vc_data *vc, struct console_font *op,

static int sticon_font_default(struct vc_data *vc, struct console_font *op, char *name)
{
- return sticon_set_def_font(vc->vc_num, op);
+ sticon_set_def_font(vc->vc_num);
+
+ return 0;
}

static int sticon_font_set(struct vc_data *vc, struct console_font *font,
@@ -297,7 +297,7 @@ static void sticon_deinit(struct vc_data *c)

/* free memory used by user font */
for (i = 0; i < MAX_NR_CONSOLES; i++)
- sticon_set_def_font(i, NULL);
+ sticon_set_def_font(i);
}

static void sticon_clear(struct vc_data *conp, int sy, int sx, int height,
--
2.41.0


2023-07-20 06:52:50

by Helge Deller

[permalink] [raw]
Subject: Re: [PATCH 1/7] vgacon: switch vgacon_scrolldelta() and vgacon_restore_screen()

On 7/12/23 10:59, Jiri Slaby (SUSE) wrote:
> Switch vgacon_scrolldelta() and vgacon_restore_screen() positions, so
> that the former is not needed to be forward-declared.
>
> Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
> Cc: Helge Deller <[email protected]>
> Cc: [email protected]
> Cc: [email protected]

Thanks Jiri !
I've applied this series to the fbdev git tree.

Helge

> ---
> drivers/video/console/vgacon.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
> index e25ba523892e..fbed2862c317 100644
> --- a/drivers/video/console/vgacon.c
> +++ b/drivers/video/console/vgacon.c
> @@ -142,12 +142,6 @@ static inline void vga_set_mem_top(struct vc_data *c)
> write_vga(12, (c->vc_visible_origin - vga_vram_base) / 2);
> }
>
> -static void vgacon_restore_screen(struct vc_data *c)
> -{
> - if (c->vc_origin != c->vc_visible_origin)
> - vgacon_scrolldelta(c, 0);
> -}
> -
> static void vgacon_scrolldelta(struct vc_data *c, int lines)
> {
> vc_scrolldelta_helper(c, lines, vga_rolled_over, (void *)vga_vram_base,
> @@ -155,6 +149,12 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines)
> vga_set_mem_top(c);
> }
>
> +static void vgacon_restore_screen(struct vc_data *c)
> +{
> + if (c->vc_origin != c->vc_visible_origin)
> + vgacon_scrolldelta(c, 0);
> +}
> +
> static const char *vgacon_startup(void)
> {
> const char *display_desc = NULL;