Re: [PATCH 4/6] fbcon: fbcon_is_inactive() -> fbcon_is_active()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/23/24 17:57, Ville Syrjala wrote:
From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

Invert fbcon_is_inactive() into fbcon_is_active(). Much easier
on the poor brain when you don't have to do dobule negations
all over the place.

Agreed.
Acked-by: Helge Deller <deller@xxxxxx>


Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
---
  drivers/video/fbdev/core/fbcon.c | 30 +++++++++++++++---------------
  1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index eb30aa872371..2a78cca3e9de 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -281,12 +281,12 @@ static bool fbcon_skip_panic(struct fb_info *info)
  #endif
  }

-static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info)
+static inline int fbcon_is_active(struct vc_data *vc, struct fb_info *info)
  {
  	struct fbcon_ops *ops = info->fbcon_par;

-	return (info->state != FBINFO_STATE_RUNNING ||
-		vc->vc_mode != KD_TEXT || ops->graphics || fbcon_skip_panic(info));
+	return info->state == FBINFO_STATE_RUNNING &&
+		vc->vc_mode == KD_TEXT && !ops->graphics && !fbcon_skip_panic(info);
  }

  static int get_color(struct vc_data *vc, struct fb_info *info,
@@ -1253,7 +1253,7 @@ static void __fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx,
  	struct fbcon_display *p = &fb_display[vc->vc_num];
  	u_int y_break;

-	if (fbcon_is_inactive(vc, info))
+	if (!fbcon_is_active(vc, info))
  		return;

  	if (!height || !width)
@@ -1295,7 +1295,7 @@ static void fbcon_putcs(struct vc_data *vc, const u16 *s, unsigned int count,
  	struct fbcon_display *p = &fb_display[vc->vc_num];
  	struct fbcon_ops *ops = info->fbcon_par;

-	if (!fbcon_is_inactive(vc, info))
+	if (fbcon_is_active(vc, info))
  		ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
  			   get_color(vc, info, scr_readw(s), 1),
  			   get_color(vc, info, scr_readw(s), 0));
@@ -1306,7 +1306,7 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
  	struct fb_info *info = fbcon_info_from_console(vc->vc_num);
  	struct fbcon_ops *ops = info->fbcon_par;

-	if (!fbcon_is_inactive(vc, info))
+	if (fbcon_is_active(vc, info))
  		ops->clear_margins(vc, info, margin_color, bottom_only);
  }

@@ -1318,7 +1318,7 @@ static void fbcon_cursor(struct vc_data *vc, bool enable)

  	ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);

-	if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1)
+	if (!fbcon_is_active(vc, info) || vc->vc_deccm != 1)
  		return;

  	if (vc->vc_cursor_type & CUR_SW)
@@ -1724,7 +1724,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
  	struct fb_info *info = fbcon_info_from_console(vc->vc_num);
  	struct fbcon_display *p = &fb_display[vc->vc_num];

-	if (fbcon_is_inactive(vc, info))
+	if (!fbcon_is_active(vc, info))
  		return;

  	if (!width || !height)
@@ -1748,7 +1748,7 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
  	struct fbcon_display *p = &fb_display[vc->vc_num];
  	int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK;

-	if (fbcon_is_inactive(vc, info))
+	if (!fbcon_is_active(vc, info))
  		return true;

  	fbcon_cursor(vc, false);
@@ -2132,7 +2132,7 @@ static bool fbcon_switch(struct vc_data *vc)
  			fbcon_del_cursor_work(old_info);
  	}

-	if (fbcon_is_inactive(vc, info) ||
+	if (!fbcon_is_active(vc, info) ||
  	    ops->blank_state != FB_BLANK_UNBLANK)
  		fbcon_del_cursor_work(info);
  	else
@@ -2172,7 +2172,7 @@ static bool fbcon_switch(struct vc_data *vc)
  	scrollback_max = 0;
  	scrollback_current = 0;

-	if (!fbcon_is_inactive(vc, info)) {
+	if (fbcon_is_active(vc, info)) {
  	    ops->var.xoffset = ops->var.yoffset = p->yscroll = 0;
  	    ops->update_start(info);
  	}
@@ -2228,7 +2228,7 @@ static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
  		}
  	}

- 	if (!fbcon_is_inactive(vc, info)) {
+	if (fbcon_is_active(vc, info)) {
  		if (ops->blank_state != blank) {
  			ops->blank_state = blank;
  			fbcon_cursor(vc, !blank);
@@ -2242,7 +2242,7 @@ static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
  			update_screen(vc);
  	}

-	if (mode_switch || fbcon_is_inactive(vc, info) ||
+	if (mode_switch || !fbcon_is_active(vc, info) ||
  	    ops->blank_state != FB_BLANK_UNBLANK)
  		fbcon_del_cursor_work(info);
  	else
@@ -2572,7 +2572,7 @@ static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table)
  	int i, j, k, depth;
  	u8 val;

-	if (fbcon_is_inactive(vc, info))
+	if (!fbcon_is_active(vc, info))
  		return;

  	if (!con_is_visible(vc))
@@ -2672,7 +2672,7 @@ static void fbcon_modechanged(struct fb_info *info)
  		scrollback_max = 0;
  		scrollback_current = 0;

-		if (!fbcon_is_inactive(vc, info)) {
+		if (fbcon_is_active(vc, info)) {
  		    ops->var.xoffset = ops->var.yoffset = p->yscroll = 0;
  		    ops->update_start(info);
  		}






[Index of Archives]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Tourism]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux