diff mbox series

[6/6] fbcon: Use 'bool' where appopriate

Message ID 20240923155749.30846-7-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series fbcon: Fix 'cursor_blink' sysfs attribute | expand

Commit Message

Ville Syrjälä Sept. 23, 2024, 3:57 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Use 'bool' type where it makes more sense than 'int'.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/video/fbdev/core/fbcon.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

Comments

Helge Deller Sept. 23, 2024, 7:47 p.m. UTC | #1
On 9/23/24 17:57, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Use 'bool' type where it makes more sense than 'int'.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Looks good.

Acked-by: Helge Deller <deller@gmx.de>

Helge

> ---
>   drivers/video/fbdev/core/fbcon.c | 23 ++++++++++++-----------
>   1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 17540cdf1edf..03d48e665bba 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -129,9 +129,9 @@ static int logo_shown = FBCON_LOGO_CANSHOW;
>   /* console mappings */
>   static unsigned int first_fb_vc;
>   static unsigned int last_fb_vc = MAX_NR_CONSOLES - 1;
> -static int fbcon_is_default = 1;
> +static bool fbcon_is_default = true;
>   static int primary_device = -1;
> -static int fbcon_has_console_bind;
> +static bool fbcon_has_console_bind;
>
>   #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
>   static int map_override;
> @@ -166,7 +166,7 @@ static const struct consw fb_con;
>
>   #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
>
> -static int fbcon_cursor_blink;
> +static bool fbcon_cursor_blink;
>
>   #define divides(a, b)	((!(a) || (b)%(a)) ? 0 : 1)
>
> @@ -281,7 +281,7 @@ static bool fbcon_skip_panic(struct fb_info *info)
>   #endif
>   }
>
> -static inline int fbcon_is_active(struct vc_data *vc, struct fb_info *info)
> +static inline bool fbcon_is_active(struct vc_data *vc, struct fb_info *info)
>   {
>   	struct fbcon_ops *ops = info->fbcon_par;
>
> @@ -290,7 +290,7 @@ static inline int fbcon_is_active(struct vc_data *vc, struct fb_info *info)
>   }
>
>   static int get_color(struct vc_data *vc, struct fb_info *info,
> -	      u16 c, int is_fg)
> +		     u16 c, bool is_fg)
>   {
>   	int depth = fb_get_color_depth(&info->var, &info->fix);
>   	int color = 0;
> @@ -358,12 +358,12 @@ static int get_color(struct vc_data *vc, struct fb_info *info,
>
>   static int get_fg_color(struct vc_data *vc, struct fb_info *info, u16 c)
>   {
> -	return get_color(vc, info, c, 1);
> +	return get_color(vc, info, c, true);
>   }
>
>   static int get_bg_color(struct vc_data *vc, struct fb_info *info, u16 c)
>   {
> -	return get_color(vc, info, c, 0);
> +	return get_color(vc, info, c, false);
>   }
>
>   static void fb_flashcursor(struct work_struct *work)
> @@ -467,7 +467,7 @@ static int __init fb_console_setup(char *this_opt)
>   				last_fb_vc = simple_strtoul(options, &options, 10) - 1;
>   			if (last_fb_vc < first_fb_vc || last_fb_vc >= MAX_NR_CONSOLES)
>   				last_fb_vc = MAX_NR_CONSOLES - 1;
> -			fbcon_is_default = 0;
> +			fbcon_is_default = false;
>   			continue;
>   		}
>
> @@ -558,7 +558,7 @@ static int do_fbcon_takeover(int show_logo)
>   			con2fb_map[i] = -1;
>   		info_idx = -1;
>   	} else {
> -		fbcon_has_console_bind = 1;
> +		fbcon_has_console_bind = true;
>   	}
>
>   	return err;
> @@ -2802,7 +2802,7 @@ static void fbcon_unbind(void)
>   				fbcon_is_default);
>
>   	if (!ret)
> -		fbcon_has_console_bind = 0;
> +		fbcon_has_console_bind = false;
>   }
>   #else
>   static inline void fbcon_unbind(void) {}
> @@ -3234,8 +3234,9 @@ static ssize_t cursor_blink_store(struct device *device,
>   				  const char *buf, size_t count)
>   {
>   	struct fb_info *info;
> -	int blink, idx;
>   	char **last = NULL;
> +	bool blink;
> +	int idx;
>
>   	blink = simple_strtoul(buf, last, 0);
>
Thomas Zimmermann Sept. 24, 2024, 7:51 a.m. UTC | #2
Am 23.09.24 um 17:57 schrieb Ville Syrjala:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Use 'bool' type where it makes more sense than 'int'.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/video/fbdev/core/fbcon.c | 23 ++++++++++++-----------
>   1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 17540cdf1edf..03d48e665bba 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -129,9 +129,9 @@ static int logo_shown = FBCON_LOGO_CANSHOW;
>   /* console mappings */
>   static unsigned int first_fb_vc;
>   static unsigned int last_fb_vc = MAX_NR_CONSOLES - 1;
> -static int fbcon_is_default = 1;
> +static bool fbcon_is_default = true;
>   static int primary_device = -1;
> -static int fbcon_has_console_bind;
> +static bool fbcon_has_console_bind;
>   
>   #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
>   static int map_override;
> @@ -166,7 +166,7 @@ static const struct consw fb_con;
>   
>   #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
>   
> -static int fbcon_cursor_blink;
> +static bool fbcon_cursor_blink;
>   
>   #define divides(a, b)	((!(a) || (b)%(a)) ? 0 : 1)
>   
> @@ -281,7 +281,7 @@ static bool fbcon_skip_panic(struct fb_info *info)
>   #endif
>   }
>   
> -static inline int fbcon_is_active(struct vc_data *vc, struct fb_info *info)
> +static inline bool fbcon_is_active(struct vc_data *vc, struct fb_info *info)
>   {
>   	struct fbcon_ops *ops = info->fbcon_par;
>   
> @@ -290,7 +290,7 @@ static inline int fbcon_is_active(struct vc_data *vc, struct fb_info *info)
>   }
>   
>   static int get_color(struct vc_data *vc, struct fb_info *info,
> -	      u16 c, int is_fg)
> +		     u16 c, bool is_fg)
>   {
>   	int depth = fb_get_color_depth(&info->var, &info->fix);
>   	int color = 0;
> @@ -358,12 +358,12 @@ static int get_color(struct vc_data *vc, struct fb_info *info,
>   
>   static int get_fg_color(struct vc_data *vc, struct fb_info *info, u16 c)
>   {
> -	return get_color(vc, info, c, 1);
> +	return get_color(vc, info, c, true);
>   }
>   
>   static int get_bg_color(struct vc_data *vc, struct fb_info *info, u16 c)
>   {
> -	return get_color(vc, info, c, 0);
> +	return get_color(vc, info, c, false);
>   }
>   
>   static void fb_flashcursor(struct work_struct *work)
> @@ -467,7 +467,7 @@ static int __init fb_console_setup(char *this_opt)
>   				last_fb_vc = simple_strtoul(options, &options, 10) - 1;
>   			if (last_fb_vc < first_fb_vc || last_fb_vc >= MAX_NR_CONSOLES)
>   				last_fb_vc = MAX_NR_CONSOLES - 1;
> -			fbcon_is_default = 0;
> +			fbcon_is_default = false;
>   			continue;
>   		}
>   
> @@ -558,7 +558,7 @@ static int do_fbcon_takeover(int show_logo)
>   			con2fb_map[i] = -1;
>   		info_idx = -1;
>   	} else {
> -		fbcon_has_console_bind = 1;
> +		fbcon_has_console_bind = true;
>   	}
>   
>   	return err;
> @@ -2802,7 +2802,7 @@ static void fbcon_unbind(void)
>   				fbcon_is_default);
>   
>   	if (!ret)
> -		fbcon_has_console_bind = 0;
> +		fbcon_has_console_bind = false;
>   }
>   #else
>   static inline void fbcon_unbind(void) {}
> @@ -3234,8 +3234,9 @@ static ssize_t cursor_blink_store(struct device *device,
>   				  const char *buf, size_t count)
>   {
>   	struct fb_info *info;
> -	int blink, idx;
>   	char **last = NULL;
> +	bool blink;
> +	int idx;
>   
>   	blink = simple_strtoul(buf, last, 0);
>
diff mbox series

Patch

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 17540cdf1edf..03d48e665bba 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -129,9 +129,9 @@  static int logo_shown = FBCON_LOGO_CANSHOW;
 /* console mappings */
 static unsigned int first_fb_vc;
 static unsigned int last_fb_vc = MAX_NR_CONSOLES - 1;
-static int fbcon_is_default = 1;
+static bool fbcon_is_default = true;
 static int primary_device = -1;
-static int fbcon_has_console_bind;
+static bool fbcon_has_console_bind;
 
 #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
 static int map_override;
@@ -166,7 +166,7 @@  static const struct consw fb_con;
 
 #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
 
-static int fbcon_cursor_blink;
+static bool fbcon_cursor_blink;
 
 #define divides(a, b)	((!(a) || (b)%(a)) ? 0 : 1)
 
@@ -281,7 +281,7 @@  static bool fbcon_skip_panic(struct fb_info *info)
 #endif
 }
 
-static inline int fbcon_is_active(struct vc_data *vc, struct fb_info *info)
+static inline bool fbcon_is_active(struct vc_data *vc, struct fb_info *info)
 {
 	struct fbcon_ops *ops = info->fbcon_par;
 
@@ -290,7 +290,7 @@  static inline int fbcon_is_active(struct vc_data *vc, struct fb_info *info)
 }
 
 static int get_color(struct vc_data *vc, struct fb_info *info,
-	      u16 c, int is_fg)
+		     u16 c, bool is_fg)
 {
 	int depth = fb_get_color_depth(&info->var, &info->fix);
 	int color = 0;
@@ -358,12 +358,12 @@  static int get_color(struct vc_data *vc, struct fb_info *info,
 
 static int get_fg_color(struct vc_data *vc, struct fb_info *info, u16 c)
 {
-	return get_color(vc, info, c, 1);
+	return get_color(vc, info, c, true);
 }
 
 static int get_bg_color(struct vc_data *vc, struct fb_info *info, u16 c)
 {
-	return get_color(vc, info, c, 0);
+	return get_color(vc, info, c, false);
 }
 
 static void fb_flashcursor(struct work_struct *work)
@@ -467,7 +467,7 @@  static int __init fb_console_setup(char *this_opt)
 				last_fb_vc = simple_strtoul(options, &options, 10) - 1;
 			if (last_fb_vc < first_fb_vc || last_fb_vc >= MAX_NR_CONSOLES)
 				last_fb_vc = MAX_NR_CONSOLES - 1;
-			fbcon_is_default = 0;
+			fbcon_is_default = false;
 			continue;
 		}
 
@@ -558,7 +558,7 @@  static int do_fbcon_takeover(int show_logo)
 			con2fb_map[i] = -1;
 		info_idx = -1;
 	} else {
-		fbcon_has_console_bind = 1;
+		fbcon_has_console_bind = true;
 	}
 
 	return err;
@@ -2802,7 +2802,7 @@  static void fbcon_unbind(void)
 				fbcon_is_default);
 
 	if (!ret)
-		fbcon_has_console_bind = 0;
+		fbcon_has_console_bind = false;
 }
 #else
 static inline void fbcon_unbind(void) {}
@@ -3234,8 +3234,9 @@  static ssize_t cursor_blink_store(struct device *device,
 				  const char *buf, size_t count)
 {
 	struct fb_info *info;
-	int blink, idx;
 	char **last = NULL;
+	bool blink;
+	int idx;
 
 	blink = simple_strtoul(buf, last, 0);