mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-20 08:47:59 -05:00
tty: vt: add con_putc() helper
And let it call consw::con_putc() if it exists, otherwise consw::con_putcs(). This is similar to tty_put_char(). It supports dropping unneeded duplication of code like sticon_putc() is (see the next patch). Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Tested-by: Helge Deller <deller@gmx.de> # parisc STI console Link: https://lore.kernel.org/r/20240122110401.7289-24-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3ab8a65193
commit
387ccbdb63
@@ -300,6 +300,14 @@ static inline unsigned short *screenpos(const struct vc_data *vc, int offset,
|
||||
return p;
|
||||
}
|
||||
|
||||
static void con_putc(struct vc_data *vc, u16 ca, unsigned int y, unsigned int x)
|
||||
{
|
||||
if (vc->vc_sw->con_putc)
|
||||
vc->vc_sw->con_putc(vc, ca, y, x);
|
||||
else
|
||||
vc->vc_sw->con_putcs(vc, &ca, 1, y, x);
|
||||
}
|
||||
|
||||
/* Called from the keyboard irq path.. */
|
||||
static inline void scrolldelta(int lines)
|
||||
{
|
||||
@@ -762,7 +770,7 @@ void complement_pos(struct vc_data *vc, int offset)
|
||||
old_offset < vc->vc_screenbuf_size) {
|
||||
scr_writew(old, screenpos(vc, old_offset, true));
|
||||
if (con_should_update(vc))
|
||||
vc->vc_sw->con_putc(vc, old, oldy, oldx);
|
||||
con_putc(vc, old, oldy, oldx);
|
||||
notify_update(vc);
|
||||
}
|
||||
|
||||
@@ -779,7 +787,7 @@ void complement_pos(struct vc_data *vc, int offset)
|
||||
if (con_should_update(vc)) {
|
||||
oldx = (offset >> 1) % vc->vc_cols;
|
||||
oldy = (offset >> 1) / vc->vc_cols;
|
||||
vc->vc_sw->con_putc(vc, new, oldy, oldx);
|
||||
con_putc(vc, new, oldy, oldx);
|
||||
}
|
||||
notify_update(vc);
|
||||
}
|
||||
@@ -833,7 +841,7 @@ static void add_softcursor(struct vc_data *vc)
|
||||
i ^= CUR_FG;
|
||||
scr_writew(i, (u16 *)vc->vc_pos);
|
||||
if (con_should_update(vc))
|
||||
vc->vc_sw->con_putc(vc, i, vc->state.y, vc->state.x);
|
||||
con_putc(vc, i, vc->state.y, vc->state.x);
|
||||
}
|
||||
|
||||
static void hide_softcursor(struct vc_data *vc)
|
||||
@@ -841,8 +849,8 @@ static void hide_softcursor(struct vc_data *vc)
|
||||
if (softcursor_original != -1) {
|
||||
scr_writew(softcursor_original, (u16 *)vc->vc_pos);
|
||||
if (con_should_update(vc))
|
||||
vc->vc_sw->con_putc(vc, softcursor_original,
|
||||
vc->state.y, vc->state.x);
|
||||
con_putc(vc, softcursor_original, vc->state.y,
|
||||
vc->state.x);
|
||||
softcursor_original = -1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user