diff mbox series

[3/6] fbcon: fbcon_cursor_noblink -> fbcon_cursor_blink

Message ID 20240923155749.30846-4-ville.syrjala@linux.intel.com (mailing list archive)
State New
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>

Invert fbcon_cursor_noblink into fbcon_cursor_blink so that:
- it matches the sysfs attribute exactly
- avoids having to do these NOT operations all over the place

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

Comments

Helge Deller Sept. 23, 2024, 7:46 p.m. UTC | #1
On 9/23/24 17:57, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Invert fbcon_cursor_noblink into fbcon_cursor_blink so that:
> - it matches the sysfs attribute exactly
> - avoids having to do these NOT operations all over the place
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>   drivers/video/fbdev/core/fbcon.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index bbe332572ca7..eb30aa872371 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -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_noblink;
> +static int fbcon_cursor_blink;

Shouldn't it default then to value 1, e.g.
+static int fbcon_cursor_blink = 1;

Looks good otherwise.

Helge

>
>   #define divides(a, b)	((!(a) || (b)%(a)) ? 0 : 1)
>
> @@ -399,7 +399,7 @@ static void fbcon_add_cursor_work(struct fb_info *info)
>   {
>   	struct fbcon_ops *ops = info->fbcon_par;
>
> -	if (!fbcon_cursor_noblink)
> +	if (fbcon_cursor_blink)
>   		queue_delayed_work(system_power_efficient_wq, &ops->cursor_work,
>   				   ops->cur_blink_jiffies);
>   }
> @@ -3214,7 +3214,7 @@ static ssize_t rotate_show(struct device *device,
>   static ssize_t cursor_blink_show(struct device *device,
>   				 struct device_attribute *attr, char *buf)
>   {
> -	return sysfs_emit(buf, "%d\n", !fbcon_cursor_noblink);
> +	return sysfs_emit(buf, "%d\n", fbcon_cursor_blink);
>   }
>
>   static ssize_t cursor_blink_store(struct device *device,
> @@ -3230,7 +3230,7 @@ static ssize_t cursor_blink_store(struct device *device,
>   	console_lock();
>   	idx = con2fb_map[fg_console];
>
> -	fbcon_cursor_noblink = !blink;
> +	fbcon_cursor_blink = blink;
>
>   	if (idx == -1 || fbcon_registered_fb[idx] == NULL)
>   		goto err;
Ville Syrjälä Sept. 23, 2024, 8:26 p.m. UTC | #2
On Mon, Sep 23, 2024 at 09:46:03PM +0200, Helge Deller wrote:
> On 9/23/24 17:57, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Invert fbcon_cursor_noblink into fbcon_cursor_blink so that:
> > - it matches the sysfs attribute exactly
> > - avoids having to do these NOT operations all over the place
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >   drivers/video/fbdev/core/fbcon.c | 8 ++++----
> >   1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> > index bbe332572ca7..eb30aa872371 100644
> > --- a/drivers/video/fbdev/core/fbcon.c
> > +++ b/drivers/video/fbdev/core/fbcon.c
> > @@ -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_noblink;
> > +static int fbcon_cursor_blink;
> 
> Shouldn't it default then to value 1, e.g.
> +static int fbcon_cursor_blink = 1;

Indeed, good catch. Thanks. 

Had to double check that my udev rule still actually works
and it wasn't just caused by this fumble. Fortunately it
still seems effective. Phew.

> 
> Looks good otherwise.
> 
> Helge
> 
> >
> >   #define divides(a, b)	((!(a) || (b)%(a)) ? 0 : 1)
> >
> > @@ -399,7 +399,7 @@ static void fbcon_add_cursor_work(struct fb_info *info)
> >   {
> >   	struct fbcon_ops *ops = info->fbcon_par;
> >
> > -	if (!fbcon_cursor_noblink)
> > +	if (fbcon_cursor_blink)
> >   		queue_delayed_work(system_power_efficient_wq, &ops->cursor_work,
> >   				   ops->cur_blink_jiffies);
> >   }
> > @@ -3214,7 +3214,7 @@ static ssize_t rotate_show(struct device *device,
> >   static ssize_t cursor_blink_show(struct device *device,
> >   				 struct device_attribute *attr, char *buf)
> >   {
> > -	return sysfs_emit(buf, "%d\n", !fbcon_cursor_noblink);
> > +	return sysfs_emit(buf, "%d\n", fbcon_cursor_blink);
> >   }
> >
> >   static ssize_t cursor_blink_store(struct device *device,
> > @@ -3230,7 +3230,7 @@ static ssize_t cursor_blink_store(struct device *device,
> >   	console_lock();
> >   	idx = con2fb_map[fg_console];
> >
> > -	fbcon_cursor_noblink = !blink;
> > +	fbcon_cursor_blink = blink;
> >
> >   	if (idx == -1 || fbcon_registered_fb[idx] == NULL)
> >   		goto err;
diff mbox series

Patch

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index bbe332572ca7..eb30aa872371 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -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_noblink;
+static int fbcon_cursor_blink;
 
 #define divides(a, b)	((!(a) || (b)%(a)) ? 0 : 1)
 
@@ -399,7 +399,7 @@  static void fbcon_add_cursor_work(struct fb_info *info)
 {
 	struct fbcon_ops *ops = info->fbcon_par;
 
-	if (!fbcon_cursor_noblink)
+	if (fbcon_cursor_blink)
 		queue_delayed_work(system_power_efficient_wq, &ops->cursor_work,
 				   ops->cur_blink_jiffies);
 }
@@ -3214,7 +3214,7 @@  static ssize_t rotate_show(struct device *device,
 static ssize_t cursor_blink_show(struct device *device,
 				 struct device_attribute *attr, char *buf)
 {
-	return sysfs_emit(buf, "%d\n", !fbcon_cursor_noblink);
+	return sysfs_emit(buf, "%d\n", fbcon_cursor_blink);
 }
 
 static ssize_t cursor_blink_store(struct device *device,
@@ -3230,7 +3230,7 @@  static ssize_t cursor_blink_store(struct device *device,
 	console_lock();
 	idx = con2fb_map[fg_console];
 
-	fbcon_cursor_noblink = !blink;
+	fbcon_cursor_blink = blink;
 
 	if (idx == -1 || fbcon_registered_fb[idx] == NULL)
 		goto err;