@@ -135,9 +135,9 @@ static int logo_shown = FBCON_LOGO_CANSHOW;
135
135
/* console mappings */
136
136
static unsigned int first_fb_vc ;
137
137
static unsigned int last_fb_vc = MAX_NR_CONSOLES - 1 ;
138
- static int fbcon_is_default = 1 ;
138
+ static bool fbcon_is_default = true ;
139
139
static int primary_device = -1 ;
140
- static int fbcon_has_console_bind ;
140
+ static bool fbcon_has_console_bind ;
141
141
142
142
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
143
143
static int map_override ;
@@ -172,7 +172,7 @@ static const struct consw fb_con;
172
172
173
173
#define advance_row (p , delta ) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
174
174
175
- static int fbcon_cursor_noblink ;
175
+ static bool fbcon_cursor_blink = true ;
176
176
177
177
#define divides (a , b ) ((!(a) || (b)%(a)) ? 0 : 1)
178
178
@@ -289,16 +289,16 @@ static bool fbcon_skip_panic(struct fb_info *info)
289
289
#endif
290
290
}
291
291
292
- static inline int fbcon_is_inactive (struct vc_data * vc , struct fb_info * info )
292
+ static inline bool fbcon_is_active (struct vc_data * vc , struct fb_info * info )
293
293
{
294
294
struct fbcon_ops * ops = info -> fbcon_par ;
295
295
296
- return ( info -> state != FBINFO_STATE_RUNNING ||
297
- vc -> vc_mode != KD_TEXT || ops -> graphics || fbcon_skip_panic (info ) );
296
+ return info -> state == FBINFO_STATE_RUNNING &&
297
+ vc -> vc_mode == KD_TEXT && ! ops -> graphics && ! fbcon_skip_panic (info );
298
298
}
299
299
300
300
static int get_color (struct vc_data * vc , struct fb_info * info ,
301
- u16 c , int is_fg )
301
+ u16 c , bool is_fg )
302
302
{
303
303
int depth = fb_get_color_depth (& info -> var , & info -> fix );
304
304
int color = 0 ;
@@ -364,6 +364,16 @@ static int get_color(struct vc_data *vc, struct fb_info *info,
364
364
return color ;
365
365
}
366
366
367
+ static int get_fg_color (struct vc_data * vc , struct fb_info * info , u16 c )
368
+ {
369
+ return get_color (vc , info , c , true);
370
+ }
371
+
372
+ static int get_bg_color (struct vc_data * vc , struct fb_info * info , u16 c )
373
+ {
374
+ return get_color (vc , info , c , false);
375
+ }
376
+
367
377
static void fb_flashcursor (struct work_struct * work )
368
378
{
369
379
struct fbcon_ops * ops = container_of (work , struct fbcon_ops , cursor_work .work );
@@ -395,8 +405,9 @@ static void fb_flashcursor(struct work_struct *work)
395
405
396
406
c = scr_readw ((u16 * ) vc -> vc_pos );
397
407
enable = ops -> cursor_flash && !ops -> cursor_state .enable ;
398
- ops -> cursor (vc , info , enable , get_color (vc , info , c , 1 ),
399
- get_color (vc , info , c , 0 ));
408
+ ops -> cursor (vc , info , enable ,
409
+ get_fg_color (vc , info , c ),
410
+ get_bg_color (vc , info , c ));
400
411
console_unlock ();
401
412
402
413
queue_delayed_work (system_power_efficient_wq , & ops -> cursor_work ,
@@ -407,7 +418,7 @@ static void fbcon_add_cursor_work(struct fb_info *info)
407
418
{
408
419
struct fbcon_ops * ops = info -> fbcon_par ;
409
420
410
- if (! fbcon_cursor_noblink )
421
+ if (fbcon_cursor_blink )
411
422
queue_delayed_work (system_power_efficient_wq , & ops -> cursor_work ,
412
423
ops -> cur_blink_jiffies );
413
424
}
@@ -464,7 +475,7 @@ static int __init fb_console_setup(char *this_opt)
464
475
last_fb_vc = simple_strtoul (options , & options , 10 ) - 1 ;
465
476
if (last_fb_vc < first_fb_vc || last_fb_vc >= MAX_NR_CONSOLES )
466
477
last_fb_vc = MAX_NR_CONSOLES - 1 ;
467
- fbcon_is_default = 0 ;
478
+ fbcon_is_default = false ;
468
479
continue ;
469
480
}
470
481
@@ -559,7 +570,7 @@ static int do_fbcon_takeover(int show_logo)
559
570
con2fb_map [i ] = -1 ;
560
571
info_idx = -1 ;
561
572
} else {
562
- fbcon_has_console_bind = 1 ;
573
+ fbcon_has_console_bind = true ;
563
574
}
564
575
565
576
return err ;
@@ -1267,7 +1278,7 @@ static void __fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx,
1267
1278
struct fbcon_display * p = & fb_display [vc -> vc_num ];
1268
1279
u_int y_break ;
1269
1280
1270
- if (fbcon_is_inactive (vc , info ))
1281
+ if (! fbcon_is_active (vc , info ))
1271
1282
return ;
1272
1283
1273
1284
if (!height || !width )
@@ -1311,18 +1322,18 @@ static void fbcon_putcs(struct vc_data *vc, const u16 *s, unsigned int count,
1311
1322
struct fbcon_display * p = & fb_display [vc -> vc_num ];
1312
1323
struct fbcon_ops * ops = info -> fbcon_par ;
1313
1324
1314
- if (! fbcon_is_inactive (vc , info ))
1325
+ if (fbcon_is_active (vc , info ))
1315
1326
ops -> putcs (vc , info , s , count , real_y (p , ypos ), xpos ,
1316
- get_color (vc , info , scr_readw (s ), 1 ),
1317
- get_color (vc , info , scr_readw (s ), 0 ));
1327
+ get_fg_color (vc , info , scr_readw (s )),
1328
+ get_bg_color (vc , info , scr_readw (s )));
1318
1329
}
1319
1330
1320
1331
static void fbcon_clear_margins (struct vc_data * vc , int bottom_only )
1321
1332
{
1322
1333
struct fb_info * info = fbcon_info_from_console (vc -> vc_num );
1323
1334
struct fbcon_ops * ops = info -> fbcon_par ;
1324
1335
1325
- if (! fbcon_is_inactive (vc , info ))
1336
+ if (fbcon_is_active (vc , info ))
1326
1337
ops -> clear_margins (vc , info , margin_color , bottom_only );
1327
1338
}
1328
1339
@@ -1334,7 +1345,7 @@ static void fbcon_cursor(struct vc_data *vc, bool enable)
1334
1345
1335
1346
ops -> cur_blink_jiffies = msecs_to_jiffies (vc -> vc_cur_blink_ms );
1336
1347
1337
- if (fbcon_is_inactive (vc , info ) || vc -> vc_deccm != 1 )
1348
+ if (! fbcon_is_active (vc , info ) || vc -> vc_deccm != 1 )
1338
1349
return ;
1339
1350
1340
1351
if (vc -> vc_cursor_type & CUR_SW )
@@ -1347,8 +1358,9 @@ static void fbcon_cursor(struct vc_data *vc, bool enable)
1347
1358
if (!ops -> cursor )
1348
1359
return ;
1349
1360
1350
- ops -> cursor (vc , info , enable , get_color (vc , info , c , 1 ),
1351
- get_color (vc , info , c , 0 ));
1361
+ ops -> cursor (vc , info , enable ,
1362
+ get_fg_color (vc , info , c ),
1363
+ get_bg_color (vc , info , c ));
1352
1364
}
1353
1365
1354
1366
static int scrollback_phys_max = 0 ;
@@ -1740,7 +1752,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
1740
1752
struct fb_info * info = fbcon_info_from_console (vc -> vc_num );
1741
1753
struct fbcon_display * p = & fb_display [vc -> vc_num ];
1742
1754
1743
- if (fbcon_is_inactive (vc , info ))
1755
+ if (! fbcon_is_active (vc , info ))
1744
1756
return ;
1745
1757
1746
1758
if (!width || !height )
@@ -1764,7 +1776,7 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
1764
1776
struct fbcon_display * p = & fb_display [vc -> vc_num ];
1765
1777
int scroll_partial = info -> flags & FBINFO_PARTIAL_PAN_OK ;
1766
1778
1767
- if (fbcon_is_inactive (vc , info ))
1779
+ if (! fbcon_is_active (vc , info ))
1768
1780
return true;
1769
1781
1770
1782
fbcon_cursor (vc , false);
@@ -2148,7 +2160,7 @@ static bool fbcon_switch(struct vc_data *vc)
2148
2160
fbcon_del_cursor_work (old_info );
2149
2161
}
2150
2162
2151
- if (fbcon_is_inactive (vc , info ) ||
2163
+ if (! fbcon_is_active (vc , info ) ||
2152
2164
ops -> blank_state != FB_BLANK_UNBLANK )
2153
2165
fbcon_del_cursor_work (info );
2154
2166
else
@@ -2188,7 +2200,7 @@ static bool fbcon_switch(struct vc_data *vc)
2188
2200
scrollback_max = 0 ;
2189
2201
scrollback_current = 0 ;
2190
2202
2191
- if (! fbcon_is_inactive (vc , info )) {
2203
+ if (fbcon_is_active (vc , info )) {
2192
2204
ops -> var .xoffset = ops -> var .yoffset = p -> yscroll = 0 ;
2193
2205
ops -> update_start (info );
2194
2206
}
@@ -2244,7 +2256,7 @@ static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
2244
2256
}
2245
2257
}
2246
2258
2247
- if (! fbcon_is_inactive (vc , info )) {
2259
+ if (fbcon_is_active (vc , info )) {
2248
2260
if (ops -> blank_state != blank ) {
2249
2261
ops -> blank_state = blank ;
2250
2262
fbcon_cursor (vc , !blank );
@@ -2258,7 +2270,7 @@ static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
2258
2270
update_screen (vc );
2259
2271
}
2260
2272
2261
- if (mode_switch || fbcon_is_inactive (vc , info ) ||
2273
+ if (mode_switch || ! fbcon_is_active (vc , info ) ||
2262
2274
ops -> blank_state != FB_BLANK_UNBLANK )
2263
2275
fbcon_del_cursor_work (info );
2264
2276
else
@@ -2588,7 +2600,7 @@ static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table)
2588
2600
int i , j , k , depth ;
2589
2601
u8 val ;
2590
2602
2591
- if (fbcon_is_inactive (vc , info ))
2603
+ if (! fbcon_is_active (vc , info ))
2592
2604
return ;
2593
2605
2594
2606
if (!con_is_visible (vc ))
@@ -2688,7 +2700,7 @@ static void fbcon_modechanged(struct fb_info *info)
2688
2700
scrollback_max = 0 ;
2689
2701
scrollback_current = 0 ;
2690
2702
2691
- if (! fbcon_is_inactive (vc , info )) {
2703
+ if (fbcon_is_active (vc , info )) {
2692
2704
ops -> var .xoffset = ops -> var .yoffset = p -> yscroll = 0 ;
2693
2705
ops -> update_start (info );
2694
2706
}
@@ -2806,7 +2818,7 @@ static void fbcon_unbind(void)
2806
2818
fbcon_is_default );
2807
2819
2808
2820
if (!ret )
2809
- fbcon_has_console_bind = 0 ;
2821
+ fbcon_has_console_bind = false ;
2810
2822
}
2811
2823
#else
2812
2824
static inline void fbcon_unbind (void ) {}
@@ -3257,8 +3269,9 @@ static ssize_t cursor_blink_store(struct device *device,
3257
3269
const char * buf , size_t count )
3258
3270
{
3259
3271
struct fb_info * info ;
3260
- int blink , idx ;
3261
3272
char * * last = NULL ;
3273
+ bool blink ;
3274
+ int idx ;
3262
3275
3263
3276
console_lock ();
3264
3277
idx = con2fb_map [fg_console ];
@@ -3274,10 +3287,10 @@ static ssize_t cursor_blink_store(struct device *device,
3274
3287
blink = simple_strtoul (buf , last , 0 );
3275
3288
3276
3289
if (blink ) {
3277
- fbcon_cursor_noblink = 0 ;
3290
+ fbcon_cursor_blink = true ;
3278
3291
fbcon_add_cursor_work (info );
3279
3292
} else {
3280
- fbcon_cursor_noblink = 1 ;
3293
+ fbcon_cursor_blink = false ;
3281
3294
fbcon_del_cursor_work (info );
3282
3295
}
3283
3296
0 commit comments