Skip to content

Commit 311b078

Browse files
vsyrjalahdeller
authored andcommitted
fbcon: Introduce get_{fg,bg}_color()
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ä <[email protected]> Acked-by: Helge Deller <[email protected]> Reviewed-by: Thomas Zimmermann <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent ffc825a commit 311b078

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

drivers/video/fbdev/core/fbcon.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,16 @@ static int get_color(struct vc_data *vc, struct fb_info *info,
363363
return color;
364364
}
365365

366+
static int get_fg_color(struct vc_data *vc, struct fb_info *info, u16 c)
367+
{
368+
return get_color(vc, info, c, 1);
369+
}
370+
371+
static int get_bg_color(struct vc_data *vc, struct fb_info *info, u16 c)
372+
{
373+
return get_color(vc, info, c, 0);
374+
}
375+
366376
static void fb_flashcursor(struct work_struct *work)
367377
{
368378
struct fbcon_ops *ops = container_of(work, struct fbcon_ops, cursor_work.work);
@@ -394,8 +404,9 @@ static void fb_flashcursor(struct work_struct *work)
394404

395405
c = scr_readw((u16 *) vc->vc_pos);
396406
enable = ops->cursor_flash && !ops->cursor_state.enable;
397-
ops->cursor(vc, info, enable, get_color(vc, info, c, 1),
398-
get_color(vc, info, c, 0));
407+
ops->cursor(vc, info, enable,
408+
get_fg_color(vc, info, c),
409+
get_bg_color(vc, info, c));
399410
console_unlock();
400411

401412
queue_delayed_work(system_power_efficient_wq, &ops->cursor_work,
@@ -1312,8 +1323,8 @@ static void fbcon_putcs(struct vc_data *vc, const u16 *s, unsigned int count,
13121323

13131324
if (fbcon_is_active(vc, info))
13141325
ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
1315-
get_color(vc, info, scr_readw(s), 1),
1316-
get_color(vc, info, scr_readw(s), 0));
1326+
get_fg_color(vc, info, scr_readw(s)),
1327+
get_bg_color(vc, info, scr_readw(s)));
13171328
}
13181329

13191330
static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
@@ -1346,8 +1357,9 @@ static void fbcon_cursor(struct vc_data *vc, bool enable)
13461357
if (!ops->cursor)
13471358
return;
13481359

1349-
ops->cursor(vc, info, enable, get_color(vc, info, c, 1),
1350-
get_color(vc, info, c, 0));
1360+
ops->cursor(vc, info, enable,
1361+
get_fg_color(vc, info, c),
1362+
get_bg_color(vc, info, c));
13511363
}
13521364

13531365
static int scrollback_phys_max = 0;

0 commit comments

Comments
 (0)