Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: vt: define a common enum for VESA blanking constants

There are currently two places with VESA blanking constants definitions:
fb.h and console.h. Extract/unify the two to a separate header (vesa.h).

Given the fb's is in an uapi header, create the common header in uapi
too.

Note that instead of macros, an enum (vesa_blank_mode) is created. But
the macros are kept too (they now expand to the enum constants), just in
case someone in userspace performs some #ifdeffery.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-kernel@vger.kernel.org
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Helge Deller <deller@gmx.de> # parisc STI console
Link: https://lore.kernel.org/r/20240122110401.7289-33-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
ace4ebf9 735a5194

+20 -13
+1 -6
include/linux/console.h
··· 18 18 #include <linux/bits.h> 19 19 #include <linux/rculist.h> 20 20 #include <linux/types.h> 21 + #include <linux/vesa.h> 21 22 22 23 struct vc_data; 23 24 struct console_font_op; ··· 520 519 * WARN_CONSOLE_UNLOCKED() for debugging purposes. 521 520 */ 522 521 extern atomic_t ignore_console_lock_warning; 523 - 524 - /* VESA Blanking Levels */ 525 - #define VESA_NO_BLANKING 0 526 - #define VESA_VSYNC_SUSPEND 1 527 - #define VESA_HSYNC_SUSPEND 2 528 - #define VESA_POWERDOWN 3 529 522 530 523 extern void console_init(void); 531 524
+1 -7
include/uapi/linux/fb.h
··· 4 4 5 5 #include <linux/types.h> 6 6 #include <linux/i2c.h> 7 + #include <linux/vesa.h> 7 8 8 9 /* Definitions of frame buffers */ 9 10 ··· 293 292 __u32 console; 294 293 __u32 framebuffer; 295 294 }; 296 - 297 - /* VESA Blanking Levels */ 298 - #define VESA_NO_BLANKING 0 299 - #define VESA_VSYNC_SUSPEND 1 300 - #define VESA_HSYNC_SUSPEND 2 301 - #define VESA_POWERDOWN 3 302 - 303 295 304 296 enum { 305 297 /* screen: unblanked, hsync: on, vsync: on */
+18
include/uapi/linux/vesa.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + #ifndef _UAPI_LINUX_VESA_H 3 + #define _UAPI_LINUX_VESA_H 4 + 5 + /* VESA Blanking Levels */ 6 + enum vesa_blank_mode { 7 + VESA_NO_BLANKING = 0, 8 + #define VESA_NO_BLANKING VESA_NO_BLANKING 9 + VESA_VSYNC_SUSPEND = 1, 10 + #define VESA_VSYNC_SUSPEND VESA_VSYNC_SUSPEND 11 + VESA_HSYNC_SUSPEND = 2, 12 + #define VESA_HSYNC_SUSPEND VESA_HSYNC_SUSPEND 13 + VESA_POWERDOWN = VESA_VSYNC_SUSPEND | VESA_HSYNC_SUSPEND, 14 + #define VESA_POWERDOWN VESA_POWERDOWN 15 + VESA_BLANK_MAX = VESA_POWERDOWN, 16 + }; 17 + 18 + #endif