public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kees Cook <keescook@chromium.org>,
	linux-serial <linux-serial@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 10/11] tty: vt: saner names for more scroll variables
Date: Thu, 12 Jan 2023 11:59:43 +0200 (EET)	[thread overview]
Message-ID: <f48acfdd-779d-2f6-27a5-39168e6f4ac0@linux.intel.com> (raw)
In-Reply-To: <20230112080136.4929-10-jirislaby@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 3018 bytes --]

On Thu, 12 Jan 2023, Jiri Slaby (SUSE) wrote:

> Rename more variables (t, b, s, d) -> (top, bottom, src, dst) to make
> them more obvious.
> 
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
> ---
>  drivers/tty/vt/vt.c | 40 ++++++++++++++++++++++------------------
>  1 file changed, 22 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 7cda18b7ee3d..165c81211bdc 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -420,21 +420,22 @@ static void juggle_array(u32 **array, unsigned int size, unsigned int nr)
>  	}
>  }
>  
> -static void vc_uniscr_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
> -			     enum con_scroll dir, unsigned int nr)
> +static void vc_uniscr_scroll(struct vc_data *vc, unsigned int top,
> +			     unsigned int bottom, enum con_scroll dir,
> +			     unsigned int nr)
>  {
>  	u32 **uni_lines = vc->vc_uni_lines;
> -	unsigned int size = b - t;
> +	unsigned int size = bottom - top;
>  
>  	if (!uni_lines)
>  		return;
>  
>  	if (dir == SM_DOWN) {
>  		juggle_array(&uni_lines[top], size, size - nr);
> -		vc_uniscr_clear_lines(vc, t, nr);
> +		vc_uniscr_clear_lines(vc, top, nr);
>  	} else {
>  		juggle_array(&uni_lines[top], size, nr);
> -		vc_uniscr_clear_lines(vc, b - nr, nr);
> +		vc_uniscr_clear_lines(vc, bottom - nr, nr);
>  	}
>  }
>  
> @@ -556,27 +557,30 @@ void vc_uniscr_copy_line(const struct vc_data *vc, void *dest, bool viewed,
>  	}
>  }
>  
> -static void con_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
> -		enum con_scroll dir, unsigned int nr)
> +static void con_scroll(struct vc_data *vc, unsigned int top,
> +		       unsigned int bottom, enum con_scroll dir,
> +		       unsigned int nr)
>  {
> -	u16 *clear, *d, *s;
> +	u16 *clear, *dst, *src;
>  
> -	if (t + nr >= b)
> -		nr = b - t - 1;
> -	if (b > vc->vc_rows || t >= b || nr < 1)
> +	if (top + nr >= bottom)
> +		nr = bottom - top - 1;
> +	if (bottom > vc->vc_rows || top >= bottom || nr < 1)
>  		return;
> -	vc_uniscr_scroll(vc, t, b, dir, nr);
> -	if (con_is_visible(vc) && vc->vc_sw->con_scroll(vc, t, b, dir, nr))
> +
> +	vc_uniscr_scroll(vc, top, bottom, dir, nr);
> +	if (con_is_visible(vc) &&
> +			vc->vc_sw->con_scroll(vc, top, bottom, dir, nr))

I'd keep this on one line.

>  		return;
>  
> -	s = clear = (u16 *)(vc->vc_origin + vc->vc_size_row * t);
> -	d = (u16 *)(vc->vc_origin + vc->vc_size_row * (t + nr));
> +	src = clear = (u16 *)(vc->vc_origin + vc->vc_size_row * top);
> +	dst = (u16 *)(vc->vc_origin + vc->vc_size_row * (top + nr));
>  
>  	if (dir == SM_UP) {
> -		clear = s + (b - t - nr) * vc->vc_cols;
> -		swap(s, d);
> +		clear = src + (bottom - top - nr) * vc->vc_cols;
> +		swap(src, dst);
>  	}
> -	scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row);
> +	scr_memmovew(dst, src, (bottom - top - nr) * vc->vc_size_row);
>  	scr_memsetw(clear, vc->vc_video_erase_char, vc->vc_size_row * nr);
>  }
>  
> 

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

-- 
 i.

  reply	other threads:[~2023-01-12 10:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-12  8:01 [PATCH 01/11] tty: vt: remove vc_uniscr_debug_check() Jiri Slaby (SUSE)
2023-01-12  8:01 ` [PATCH 02/11] tty: vt: drop get_vc_uniscr() Jiri Slaby (SUSE)
2023-01-12  8:41   ` Ilpo Järvinen
2023-01-12  8:01 ` [PATCH 03/11] tty: vt: remove reference to undefined NO_VC_UNI_SCREEN Jiri Slaby (SUSE)
2023-01-12  8:44   ` Ilpo Järvinen
2023-01-12  8:01 ` [PATCH 04/11] tty: vt: use sizeof(*variable) where possible Jiri Slaby (SUSE)
2023-01-12  8:58   ` Ilpo Järvinen
2023-01-12  8:01 ` [PATCH 05/11] tty: vt: remove char32_t typedef Jiri Slaby (SUSE)
2023-01-12  8:52   ` Ilpo Järvinen
2023-01-12  9:34   ` Ilpo Järvinen
2023-01-12  8:01 ` [PATCH 06/11] tty: vt: remove struct uni_screen Jiri Slaby (SUSE)
2023-01-12  9:42   ` Ilpo Järvinen
2023-01-12  8:01 ` [PATCH 07/11] tty: vt: replace BUG_ON() by WARN_ON_ONCE() Jiri Slaby (SUSE)
2023-01-12  9:42   ` Ilpo Järvinen
2023-01-12  8:01 ` [PATCH 08/11] tty: vt: simplify some unicode conditions Jiri Slaby (SUSE)
2023-01-12  9:52   ` Ilpo Järvinen
2023-01-12  8:01 ` [PATCH 09/11] tty: vt: separate array juggling to juggle_array() Jiri Slaby (SUSE)
2023-01-12 10:15   ` Ilpo Järvinen
2023-01-12  8:01 ` [PATCH 10/11] tty: vt: saner names for more scroll variables Jiri Slaby (SUSE)
2023-01-12  9:59   ` Ilpo Järvinen [this message]
2023-01-12  8:01 ` [PATCH 11/11] tty: vt: cache row count in con_scroll() Jiri Slaby (SUSE)
2023-01-12 10:00   ` Ilpo Järvinen
2023-01-12  8:43 ` [PATCH 01/11] tty: vt: remove vc_uniscr_debug_check() Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f48acfdd-779d-2f6-27a5-39168e6f4ac0@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox