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

vt: make vc_data pointers const in selection.h



There are many functions declared in selection.h which only read from
struct vc_data passed as a parameter. Make all those uses const to hint
the compiler a bit.

Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20200818085706.12163-1-jslaby@suse.cz


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2b2dd9c6
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -268,7 +268,7 @@ unsigned short *set_translate(int m, struct vc_data *vc)
 *    was active.
 *    was active.
 * Still, it is now possible to a certain extent to cut and paste non-ASCII.
 * Still, it is now possible to a certain extent to cut and paste non-ASCII.
 */
 */
u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode)
u16 inverse_translate(const struct vc_data *conp, int glyph, int use_unicode)
{
{
	struct uni_pagedir *p;
	struct uni_pagedir *p;
	int m;
	int m;
+8 −7
Original line number Original line Diff line number Diff line
@@ -283,7 +283,8 @@ static inline bool con_should_update(const struct vc_data *vc)
	return con_is_visible(vc) && !console_blanked;
	return con_is_visible(vc) && !console_blanked;
}
}


static inline unsigned short *screenpos(struct vc_data *vc, int offset, int viewed)
static inline unsigned short *screenpos(const struct vc_data *vc, int offset,
		int viewed)
{
{
	unsigned short *p;
	unsigned short *p;
	
	
@@ -543,7 +544,7 @@ int vc_uniscr_check(struct vc_data *vc)
 * This must be preceded by a successful call to vc_uniscr_check() once
 * This must be preceded by a successful call to vc_uniscr_check() once
 * the console lock has been taken.
 * the console lock has been taken.
 */
 */
void vc_uniscr_copy_line(struct vc_data *vc, void *dest, int viewed,
void vc_uniscr_copy_line(const struct vc_data *vc, void *dest, int viewed,
			 unsigned int row, unsigned int col, unsigned int nr)
			 unsigned int row, unsigned int col, unsigned int nr)
{
{
	struct uni_screen *uniscr = get_vc_uniscr(vc);
	struct uni_screen *uniscr = get_vc_uniscr(vc);
@@ -4740,7 +4741,7 @@ int con_font_op(struct vc_data *vc, struct console_font_op *op)
 */
 */


/* used by selection */
/* used by selection */
u16 screen_glyph(struct vc_data *vc, int offset)
u16 screen_glyph(const struct vc_data *vc, int offset)
{
{
	u16 w = scr_readw(screenpos(vc, offset, 1));
	u16 w = scr_readw(screenpos(vc, offset, 1));
	u16 c = w & 0xff;
	u16 c = w & 0xff;
@@ -4751,7 +4752,7 @@ u16 screen_glyph(struct vc_data *vc, int offset)
}
}
EXPORT_SYMBOL_GPL(screen_glyph);
EXPORT_SYMBOL_GPL(screen_glyph);


u32 screen_glyph_unicode(struct vc_data *vc, int n)
u32 screen_glyph_unicode(const struct vc_data *vc, int n)
{
{
	struct uni_screen *uniscr = get_vc_uniscr(vc);
	struct uni_screen *uniscr = get_vc_uniscr(vc);


@@ -4762,13 +4763,13 @@ u32 screen_glyph_unicode(struct vc_data *vc, int n)
EXPORT_SYMBOL_GPL(screen_glyph_unicode);
EXPORT_SYMBOL_GPL(screen_glyph_unicode);


/* used by vcs - note the word offset */
/* used by vcs - note the word offset */
unsigned short *screen_pos(struct vc_data *vc, int w_offset, int viewed)
unsigned short *screen_pos(const struct vc_data *vc, int w_offset, int viewed)
{
{
	return screenpos(vc, 2 * w_offset, viewed);
	return screenpos(vc, 2 * w_offset, viewed);
}
}
EXPORT_SYMBOL_GPL(screen_pos);
EXPORT_SYMBOL_GPL(screen_pos);


void getconsxy(struct vc_data *vc, unsigned char *p)
void getconsxy(const struct vc_data *vc, unsigned char *p)
{
{
	/* clamp values if they don't fit */
	/* clamp values if they don't fit */
	p[0] = min(vc->state.x, 0xFFu);
	p[0] = min(vc->state.x, 0xFFu);
@@ -4782,7 +4783,7 @@ void putconsxy(struct vc_data *vc, unsigned char *p)
	set_cursor(vc);
	set_cursor(vc);
}
}


u16 vcs_scr_readw(struct vc_data *vc, const u16 *org)
u16 vcs_scr_readw(const struct vc_data *vc, const u16 *org)
{
{
	if ((unsigned long)org == vc->vc_pos && softcursor_original != -1)
	if ((unsigned long)org == vc->vc_pos && softcursor_original != -1)
		return softcursor_original;
		return softcursor_original;
+1 −1
Original line number Original line Diff line number Diff line
@@ -236,7 +236,7 @@ static int sticon_blank(struct vc_data *c, int blank, int mode_switch)
    return 1;
    return 1;
}
}


static u16 *sticon_screen_pos(struct vc_data *conp, int offset)
static u16 *sticon_screen_pos(const struct vc_data *conp, int offset)
{
{
    int line;
    int line;
    unsigned long p;
    unsigned long p;
+1 −1
Original line number Original line Diff line number Diff line
@@ -2765,7 +2765,7 @@ static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table)
	fb_set_cmap(&palette_cmap, info);
	fb_set_cmap(&palette_cmap, info);
}
}


static u16 *fbcon_screen_pos(struct vc_data *vc, int offset)
static u16 *fbcon_screen_pos(const struct vc_data *vc, int offset)
{
{
	unsigned long p;
	unsigned long p;
	int line;
	int line;
+1 −1
Original line number Original line Diff line number Diff line
@@ -74,7 +74,7 @@ struct consw {
			enum vc_intensity intensity,
			enum vc_intensity intensity,
			bool blink, bool underline, bool reverse, bool italic);
			bool blink, bool underline, bool reverse, bool italic);
	void	(*con_invert_region)(struct vc_data *vc, u16 *p, int count);
	void	(*con_invert_region)(struct vc_data *vc, u16 *p, int count);
	u16    *(*con_screen_pos)(struct vc_data *vc, int offset);
	u16    *(*con_screen_pos)(const struct vc_data *vc, int offset);
	unsigned long (*con_getxy)(struct vc_data *vc, unsigned long position,
	unsigned long (*con_getxy)(struct vc_data *vc, unsigned long position,
			int *px, int *py);
			int *px, int *py);
	/*
	/*
Loading