Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d705ff38 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

tty: vt, cleanup and document con_scroll



Scrolling helpers scrup and scrdown both accept 'top' and 'bottom' as
unsigned int. Number of lines 'nr' is accepted as int, but all callers
pass down unsigned too. So change the type of 'nr' to unsigned too.
Now, promote unsigned int from the helpers up to the con_scroll
hook which actually accepted all those as signed int.

Next, the 'dir' parameter can have only two values and we define
constants for that: SM_UP and SM_DOWN. Switch them to enum and do
proper type checking on 'dir' too.

Finally, document the behaviour of the hook.

Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: <linux-fbdev@vger.kernel.org>
Cc: <linux-usb@vger.kernel.org>
Cc: <linux-parisc@vger.kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent de48b099
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -315,7 +315,8 @@ void schedule_console_callback(void)
	schedule_work(&console_work);
	schedule_work(&console_work);
}
}


static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
static void scrup(struct vc_data *vc, unsigned int t, unsigned int b,
		unsigned int nr)
{
{
	unsigned short *d, *s;
	unsigned short *d, *s;


@@ -332,7 +333,8 @@ static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
		    vc->vc_size_row * nr);
		    vc->vc_size_row * nr);
}
}


static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b,
		unsigned int nr)
{
{
	unsigned short *s;
	unsigned short *s;
	unsigned int step;
	unsigned int step;
+10 −8
Original line number Original line Diff line number Diff line
@@ -808,9 +808,10 @@ sisusbcon_cursor(struct vc_data *c, int mode)
	mutex_unlock(&sisusb->lock);
	mutex_unlock(&sisusb->lock);
}
}


static int
static bool
sisusbcon_scroll_area(struct vc_data *c, struct sisusb_usb_data *sisusb,
sisusbcon_scroll_area(struct vc_data *c, struct sisusb_usb_data *sisusb,
					int t, int b, int dir, int lines)
		unsigned int t, unsigned int b, enum con_scroll dir,
		unsigned int lines)
{
{
	int cols = sisusb->sisusb_num_columns;
	int cols = sisusb->sisusb_num_columns;
	int length = ((b - t) * cols) * 2;
	int length = ((b - t) * cols) * 2;
@@ -852,8 +853,9 @@ sisusbcon_scroll_area(struct vc_data *c, struct sisusb_usb_data *sisusb,
}
}


/* Interface routine */
/* Interface routine */
static int
static bool
sisusbcon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
sisusbcon_scroll(struct vc_data *c, unsigned int t, unsigned int b,
		enum con_scroll dir, unsigned int lines)
{
{
	struct sisusb_usb_data *sisusb;
	struct sisusb_usb_data *sisusb;
	u16 eattr = c->vc_video_erase_char;
	u16 eattr = c->vc_video_erase_char;
@@ -870,17 +872,17 @@ sisusbcon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
	 */
	 */


	if (!lines)
	if (!lines)
		return 1;
		return true;


	sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
	sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
	if (!sisusb)
	if (!sisusb)
		return 0;
		return false;


	/* sisusb->lock is down */
	/* sisusb->lock is down */


	if (sisusb_is_inactive(c, sisusb)) {
	if (sisusb_is_inactive(c, sisusb)) {
		mutex_unlock(&sisusb->lock);
		mutex_unlock(&sisusb->lock);
		return 0;
		return false;
	}
	}


	/* Special case */
	/* Special case */
@@ -971,7 +973,7 @@ sisusbcon_scroll(struct vc_data *c, int t, int b, int dir, int lines)


	mutex_unlock(&sisusb->lock);
	mutex_unlock(&sisusb->lock);


	return 1;
	return true;
}
}


/* Interface routine */
/* Interface routine */
+8 −10
Original line number Original line Diff line number Diff line
@@ -164,8 +164,6 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
			int count, int ypos, int xpos);
			int count, int ypos, int xpos);
static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
static void fbcon_cursor(struct vc_data *vc, int mode);
static void fbcon_cursor(struct vc_data *vc, int mode);
static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
			int count);
static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
			int height, int width);
			int height, int width);
static int fbcon_switch(struct vc_data *vc);
static int fbcon_switch(struct vc_data *vc);
@@ -1795,15 +1793,15 @@ static inline void fbcon_softback_note(struct vc_data *vc, int t,
	softback_curr = softback_in;
	softback_curr = softback_in;
}
}


static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
			int count)
		enum con_scroll dir, unsigned int count)
{
{
	struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
	struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
	struct display *p = &fb_display[vc->vc_num];
	struct display *p = &fb_display[vc->vc_num];
	int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK;
	int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK;


	if (fbcon_is_inactive(vc, info))
	if (fbcon_is_inactive(vc, info))
		return -EINVAL;
		return true;


	fbcon_cursor(vc, CM_ERASE);
	fbcon_cursor(vc, CM_ERASE);


@@ -1831,7 +1829,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
							(b - count)),
							(b - count)),
				    vc->vc_video_erase_char,
				    vc->vc_video_erase_char,
				    vc->vc_size_row * count);
				    vc->vc_size_row * count);
			return 1;
			return true;
			break;
			break;


		case SCROLL_WRAP_MOVE:
		case SCROLL_WRAP_MOVE:
@@ -1903,7 +1901,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
							(b - count)),
							(b - count)),
				    vc->vc_video_erase_char,
				    vc->vc_video_erase_char,
				    vc->vc_size_row * count);
				    vc->vc_size_row * count);
			return 1;
			return true;
		}
		}
		break;
		break;


@@ -1922,7 +1920,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
							t),
							t),
				    vc->vc_video_erase_char,
				    vc->vc_video_erase_char,
				    vc->vc_size_row * count);
				    vc->vc_size_row * count);
			return 1;
			return true;
			break;
			break;


		case SCROLL_WRAP_MOVE:
		case SCROLL_WRAP_MOVE:
@@ -1992,10 +1990,10 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
							t),
							t),
				    vc->vc_video_erase_char,
				    vc->vc_video_erase_char,
				    vc->vc_size_row * count);
				    vc->vc_size_row * count);
			return 1;
			return true;
		}
		}
	}
	}
	return 0;
	return false;
}
}




+4 −3
Original line number Original line Diff line number Diff line
@@ -488,12 +488,13 @@ static void mdacon_cursor(struct vc_data *c, int mode)
	}
	}
}
}


static int mdacon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
static bool mdacon_scroll(struct vc_data *c, unsigned int t, unsigned int b,
		enum con_scroll dir, unsigned int lines)
{
{
	u16 eattr = mda_convert_attr(c->vc_video_erase_char);
	u16 eattr = mda_convert_attr(c->vc_video_erase_char);


	if (!lines)
	if (!lines)
		return 0;
		return false;


	if (lines > c->vc_rows)   /* maximum realistic size */
	if (lines > c->vc_rows)   /* maximum realistic size */
		lines = c->vc_rows;
		lines = c->vc_rows;
@@ -514,7 +515,7 @@ static int mdacon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
		break;
		break;
	}
	}


	return 0;
	return false;
}
}




+4 −4
Original line number Original line Diff line number Diff line
@@ -574,8 +574,8 @@ static int newport_font_set(struct vc_data *vc, struct console_font *font, unsig
	return newport_set_font(vc->vc_num, font);
	return newport_set_font(vc->vc_num, font);
}
}


static int newport_scroll(struct vc_data *vc, int t, int b, int dir,
static bool newport_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
			  int lines)
		enum con_scroll dir, unsigned int lines)
{
{
	int count, x, y;
	int count, x, y;
	unsigned short *s, *d;
	unsigned short *s, *d;
@@ -595,7 +595,7 @@ static int newport_scroll(struct vc_data *vc, int t, int b, int dir,
					    (vc->vc_color & 0xf0) >> 4);
					    (vc->vc_color & 0xf0) >> 4);
		}
		}
		npregs->cset.topscan = (topscan - 1) & 0x3ff;
		npregs->cset.topscan = (topscan - 1) & 0x3ff;
		return 0;
		return false;
	}
	}


	count = (b - t - lines) * vc->vc_cols;
	count = (b - t - lines) * vc->vc_cols;
@@ -670,7 +670,7 @@ static int newport_scroll(struct vc_data *vc, int t, int b, int dir,
			}
			}
		}
		}
	}
	}
	return 1;
	return true;
}
}


static int newport_dummy(struct vc_data *c)
static int newport_dummy(struct vc_data *c)
Loading