Re: [PATCH 19/45] tty: vt: make init parameter of consw::con_init() a bool

2024-01-18 Thread Geert Uytterhoeven
Hi Jiri,

On Thu, Jan 18, 2024 at 9:03 AM Jiri Slaby (SUSE)  wrote:
> The 'init' parameter of consw::con_init() is true for the first call of
> the hook on a particular console. So make the parameter a bool.
>
> And document the hook.
>
> Signed-off-by: Jiri Slaby (SUSE) 

Thanks for your patch!

> --- a/drivers/video/console/vgacon.c
> +++ b/drivers/video/console/vgacon.c
> @@ -367,7 +367,7 @@ static const char *vgacon_startup(void)
> return display_desc;
>  }
>
> -static void vgacon_init(struct vc_data *c, int init)
> +static void vgacon_init(struct vc_data *c, bool init)
>  {
> struct uni_pagedict *p;
>

Below, there is one more line to update:

-/* set dimensions manually if init != 0 since vc_resize()
will fail */
+/* set dimensions manually if init is true since
vc_resize() will fail */

With the above fixed:
Reviewed-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


[PATCH 19/45] tty: vt: make init parameter of consw::con_init() a bool

2024-01-17 Thread Jiri Slaby (SUSE)
The 'init' parameter of consw::con_init() is true for the first call of
the hook on a particular console. So make the parameter a bool.

And document the hook.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Helge Deller 
Cc: "James E.J. Bottomley" 
Cc: Daniel Vetter 
Cc: linux-fb...@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-par...@vger.kernel.org
---
 drivers/tty/vt/vt.c | 8 
 drivers/video/console/dummycon.c| 2 +-
 drivers/video/console/mdacon.c  | 2 +-
 drivers/video/console/newport_con.c | 2 +-
 drivers/video/console/sticon.c  | 2 +-
 drivers/video/console/vgacon.c  | 2 +-
 drivers/video/fbdev/core/fbcon.c| 2 +-
 include/linux/console.h | 4 +++-
 8 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index a953c3f262a5..eada45683594 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -999,7 +999,7 @@ int vc_cons_allocated(unsigned int i)
return (i < MAX_NR_CONSOLES && vc_cons[i].d);
 }
 
-static void visual_init(struct vc_data *vc, int num, int init)
+static void visual_init(struct vc_data *vc, int num, bool init)
 {
/* ++Geert: vc->vc_sw->con_init determines console size */
if (vc->vc_sw)
@@ -1083,7 +1083,7 @@ int vc_allocate(unsigned int currcons)/* return 0 on 
success */
vc->port.ops = _port_ops;
INIT_WORK(_cons[currcons].SAK_work, vc_SAK);
 
-   visual_init(vc, currcons, 1);
+   visual_init(vc, currcons, true);
 
if (!*vc->uni_pagedict_loc)
con_set_default_unimap(vc);
@@ -3527,7 +3527,7 @@ static int __init con_init(void)
vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), 
GFP_NOWAIT);
INIT_WORK(_cons[currcons].SAK_work, vc_SAK);
tty_port_init(>port);
-   visual_init(vc, currcons, 1);
+   visual_init(vc, currcons, true);
/* Assuming vc->vc_{cols,rows,screenbuf_size} are sane here. */
vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT);
vc_init(vc, currcons || !vc->vc_sw->con_save_screen);
@@ -3696,7 +3696,7 @@ static int do_bind_con_driver(const struct consw *csw, 
int first, int last,
old_was_color = vc->vc_can_do_color;
vc->vc_sw->con_deinit(vc);
vc->vc_origin = (unsigned long)vc->vc_screenbuf;
-   visual_init(vc, i, 0);
+   visual_init(vc, i, false);
set_origin(vc);
update_attr(vc);
 
diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
index 14af5d9e13b0..f2cef9d9a4b5 100644
--- a/drivers/video/console/dummycon.c
+++ b/drivers/video/console/dummycon.c
@@ -98,7 +98,7 @@ static const char *dummycon_startup(void)
 return "dummy device";
 }
 
-static void dummycon_init(struct vc_data *vc, int init)
+static void dummycon_init(struct vc_data *vc, bool init)
 {
 vc->vc_can_do_color = 1;
 if (init) {
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index ef29b321967f..c5b255c96879 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -352,7 +352,7 @@ static const char *mdacon_startup(void)
return "MDA-2";
 }
 
-static void mdacon_init(struct vc_data *c, int init)
+static void mdacon_init(struct vc_data *c, bool init)
 {
c->vc_complement_mask = 0x0800;  /* reverse video */
c->vc_display_fg = _display_fg;
diff --git a/drivers/video/console/newport_con.c 
b/drivers/video/console/newport_con.c
index e8e4f82cd4a1..12c64ef47087 100644
--- a/drivers/video/console/newport_con.c
+++ b/drivers/video/console/newport_con.c
@@ -324,7 +324,7 @@ static const char *newport_startup(void)
return NULL;
 }
 
-static void newport_init(struct vc_data *vc, int init)
+static void newport_init(struct vc_data *vc, bool init)
 {
int cols, rows;
 
diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
index 992a4fa431aa..0bfeabc3f7c7 100644
--- a/drivers/video/console/sticon.c
+++ b/drivers/video/console/sticon.c
@@ -273,7 +273,7 @@ static int sticon_font_set(struct vc_data *vc, struct 
console_font *font,
return sticon_set_font(vc, font, vpitch);
 }
 
-static void sticon_init(struct vc_data *c, int init)
+static void sticon_init(struct vc_data *c, bool init)
 {
 struct sti_struct *sti = sticon_sti;
 int vc_cols, vc_rows;
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 0c76e2817b49..2c0a952ee51a 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -367,7 +367,7 @@ static const char *vgacon_startup(void)
return display_desc;
 }
 
-static void vgacon_init(struct vc_data *c, int init)
+static void vgacon_init(struct vc_data *c, bool init)
 {
struct uni_pagedict *p;
 
diff --git a/drivers/video/fbdev/core/fbcon.c