linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	linux-fbdev@vger.kernel.org
Cc: Simona Vetter <simona@ffwll.ch>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 5/6] fbcon: Introduce get_{fg,bg}_color()
Date: Mon, 23 Sep 2024 21:44:12 +0200	[thread overview]
Message-ID: <6aee9b03-af5c-4aff-b4a3-4e7ba84954dc@gmx.de> (raw)
In-Reply-To: <20240923155749.30846-6-ville.syrjala@linux.intel.com>

On 9/23/24 17:57, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Make the code more legible by adding get_{fg,bg}_color()
> which hide the obscure 'is_fg' parameter of get_color()
> from the caller.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

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


> ---
>   drivers/video/fbdev/core/fbcon.c | 24 ++++++++++++++++++------
>   1 file changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 2a78cca3e9de..17540cdf1edf 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -356,6 +356,16 @@ static int get_color(struct vc_data *vc, struct fb_info *info,
>   	return color;
>   }
>
> +static int get_fg_color(struct vc_data *vc, struct fb_info *info, u16 c)
> +{
> +	return get_color(vc, info, c, 1);
> +}
> +
> +static int get_bg_color(struct vc_data *vc, struct fb_info *info, u16 c)
> +{
> +	return get_color(vc, info, c, 0);
> +}
> +
>   static void fb_flashcursor(struct work_struct *work)
>   {
>   	struct fbcon_ops *ops = container_of(work, struct fbcon_ops, cursor_work.work);
> @@ -387,8 +397,9 @@ static void fb_flashcursor(struct work_struct *work)
>
>   	c = scr_readw((u16 *) vc->vc_pos);
>   	enable = ops->cursor_flash && !ops->cursor_state.enable;
> -	ops->cursor(vc, info, enable, get_color(vc, info, c, 1),
> -		    get_color(vc, info, c, 0));
> +	ops->cursor(vc, info, enable,
> +		    get_fg_color(vc, info, c),
> +		    get_bg_color(vc, info, c));
>   	console_unlock();
>
>   	queue_delayed_work(system_power_efficient_wq, &ops->cursor_work,
> @@ -1297,8 +1308,8 @@ static void fbcon_putcs(struct vc_data *vc, const u16 *s, unsigned int count,
>
>   	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));
> +			   get_fg_color(vc, info, scr_readw(s)),
> +			   get_bg_color(vc, info, scr_readw(s)));
>   }
>
>   static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
> @@ -1331,8 +1342,9 @@ static void fbcon_cursor(struct vc_data *vc, bool enable)
>   	if (!ops->cursor)
>   		return;
>
> -	ops->cursor(vc, info, enable, get_color(vc, info, c, 1),
> -		    get_color(vc, info, c, 0));
> +	ops->cursor(vc, info, enable,
> +		    get_fg_color(vc, info, c),
> +		    get_bg_color(vc, info, c));
>   }
>
>   static int scrollback_phys_max = 0;


  reply	other threads:[~2024-09-23 19:44 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23 15:57 [PATCH 0/6] fbcon: Fix 'cursor_blink' sysfs attribute Ville Syrjala
2024-09-23 15:57 ` [PATCH 1/6] fbcon: Make cursor_blink=0 work when configured before fb devices appear Ville Syrjala
2024-09-23 21:04   ` Helge Deller
2024-09-23 21:30     ` Ville Syrjälä
2024-09-23 21:50       ` Helge Deller
2024-09-24  8:27         ` Helge Deller
2024-09-24  8:30           ` Ville Syrjälä
2024-09-26  6:08   ` Helge Deller
2024-09-26  9:57     ` Ville Syrjälä
2024-09-26 10:13       ` Helge Deller
2025-02-13 14:42         ` Ville Syrjälä
2025-02-13 22:47           ` Helge Deller
2025-02-14 17:41             ` Ville Syrjälä
2025-02-14 19:17               ` Helge Deller
2024-09-23 15:57 ` [PATCH 2/6] fbcon: Add sysfs attributes before registering the device Ville Syrjala
2024-09-24  7:34   ` Thomas Zimmermann
2024-09-23 15:57 ` [PATCH 3/6] fbcon: fbcon_cursor_noblink -> fbcon_cursor_blink Ville Syrjala
2024-09-23 19:46   ` Helge Deller
2024-09-23 20:26     ` Ville Syrjälä
2024-09-23 20:48   ` [PATCH v2 " Ville Syrjala
2024-09-24  7:35   ` [PATCH " Thomas Zimmermann
2024-09-23 15:57 ` [PATCH 4/6] fbcon: fbcon_is_inactive() -> fbcon_is_active() Ville Syrjala
2024-09-23 19:44   ` Helge Deller
2024-09-24  7:37   ` Thomas Zimmermann
2024-09-23 15:57 ` [PATCH 5/6] fbcon: Introduce get_{fg,bg}_color() Ville Syrjala
2024-09-23 19:44   ` Helge Deller [this message]
2024-09-24  7:42   ` Thomas Zimmermann
2024-09-23 15:57 ` [PATCH 6/6] fbcon: Use 'bool' where appopriate Ville Syrjala
2024-09-23 19:47   ` Helge Deller
2024-09-23 20:50   ` [PATCH v2 " Ville Syrjala
2024-09-24  7:51   ` [PATCH " Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6aee9b03-af5c-4aff-b4a3-4e7ba84954dc@gmx.de \
    --to=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).