diff mbox series

fbdev: vga16fb: fix orig_video_isVGA confusion

Message ID b94a4fd7-f7fe-677a-4be5-b7a985b49523@singularcrew.hu (mailing list archive)
State Accepted, archived
Headers show
Series fbdev: vga16fb: fix orig_video_isVGA confusion | expand

Commit Message

Soci/Singular Jan. 18, 2025, 10:38 a.m. UTC
At some point the orig_video_isVGA field of screen_info was repurposed
for video type. Using it directly for video type check is unsafe as it can
still mean yes (1) or no-output (0) in certain configurations. I had one of those.

Signed-off-by: Zsolt Kajtar <soci@c64.rulez.org>
---
 drivers/video/fbdev/vga16fb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Helge Deller Jan. 18, 2025, 5:43 p.m. UTC | #1
On 1/18/25 11:38, Soci/Singular wrote:
>
> At some point the orig_video_isVGA field of screen_info was repurposed
> for video type. Using it directly for video type check is unsafe as it can
> still mean yes (1) or no-output (0) in certain configurations. I had one of those.
>
> Signed-off-by: Zsolt Kajtar <soci@c64.rulez.org>
> ---
>   drivers/video/fbdev/vga16fb.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)

applied.

Thanks!
Helge
diff mbox series

Patch

diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c
index fce0f5db7..eedab14c7 100644
--- a/drivers/video/fbdev/vga16fb.c
+++ b/drivers/video/fbdev/vga16fb.c
@@ -185,9 +185,10 @@  static inline void setindex(int index)
 /* Check if the video mode is supported by the driver */
 static inline int check_mode_supported(const struct screen_info *si)
 {
+	unsigned int type = screen_info_video_type(si);
+
 	/* only EGA and VGA in 16 color graphic mode are supported */
-	if (si->orig_video_isVGA != VIDEO_TYPE_EGAC &&
-	    si->orig_video_isVGA != VIDEO_TYPE_VGAC)
+	if (type != VIDEO_TYPE_EGAC && type != VIDEO_TYPE_VGAC)
 		return -ENODEV;

 	if (si->orig_video_mode != 0x0D &&	/* 320x200/4 (EGA) */
@@ -1338,7 +1339,7 @@  static int vga16fb_probe(struct platform_device *dev)
 	printk(KERN_INFO "vga16fb: mapped to 0x%p\n", info->screen_base);
 	par = info->par;

-	par->isVGA = si->orig_video_isVGA == VIDEO_TYPE_VGAC;
+	par->isVGA = screen_info_video_type(si) == VIDEO_TYPE_VGAC;
 	par->palette_blanked = 0;
 	par->vesa_blanked = 0;