diff mbox series

[03/18] video: bochs: Drop the useless argument of bochs_vga_write()

Message ID 20230723044041.1089804-4-bmeng@tinylab.org
State Accepted
Commit caae795a1c6a205498470e9dfc2725ae3052ad12
Delegated to: Anatolij Gustschin
Headers show
Series video: bochs: Remove the x86 limitation | expand

Commit Message

Bin Meng July 23, 2023, 4:40 a.m. UTC
bochs_vga_write() takes 'index' as one argument, but never uses it.

While we are here, use macros instead of magic numbers for the
VGA IO port register name and value.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
---

 drivers/video/bochs.c | 7 ++++---
 drivers/video/bochs.h | 5 ++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

Comments

Simon Glass July 23, 2023, 10:58 p.m. UTC | #1
On Sat, 22 Jul 2023 at 22:41, Bin Meng <bmeng@tinylab.org> wrote:
>
> bochs_vga_write() takes 'index' as one argument, but never uses it.
>
> While we are here, use macros instead of magic numbers for the
> VGA IO port register name and value.
>
> Signed-off-by: Bin Meng <bmeng@tinylab.org>
> ---
>
>  drivers/video/bochs.c | 7 ++++---
>  drivers/video/bochs.h | 5 ++++-
>  2 files changed, 8 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>  # qemu-x86_64
Anatolij Gustschin Aug. 1, 2023, 12:59 p.m. UTC | #2
On Sun, 23 Jul 2023 12:40:26 +0800
Bin Meng bmeng@tinylab.org wrote:

> bochs_vga_write() takes 'index' as one argument, but never uses it.
> 
> While we are here, use macros instead of magic numbers for the
> VGA IO port register name and value.
> 
> Signed-off-by: Bin Meng <bmeng@tinylab.org>
> ---
> 
>  drivers/video/bochs.c | 7 ++++---
>  drivers/video/bochs.h | 5 ++++-
>  2 files changed, 8 insertions(+), 4 deletions(-)

applied to u-boot-video/master, thanks!

--
Anatolij
diff mbox series

Patch

diff --git a/drivers/video/bochs.c b/drivers/video/bochs.c
index fa0283c158..2d4526c714 100644
--- a/drivers/video/bochs.c
+++ b/drivers/video/bochs.c
@@ -27,9 +27,9 @@  static int bochs_read(void *mmio, int index)
 	return readw(mmio + MMIO_BASE + index * 2);
 }
 
-static void bochs_vga_write(int index, uint8_t val)
+static void bochs_vga_write(uint8_t val)
 {
-	outb(val, VGA_INDEX);
+	outb(val, VGA_ATT_W);
 }
 
 static int bochs_init_fb(struct udevice *dev)
@@ -78,7 +78,8 @@  static int bochs_init_fb(struct udevice *dev)
 	bochs_write(mmio, INDEX_Y_OFFSET, 0);
 	bochs_write(mmio, INDEX_ENABLE, ENABLED | LFB_ENABLED);
 
-	bochs_vga_write(0, 0x20);	/* disable blanking */
+	/* disable blanking */
+	bochs_vga_write(VGA_AR_ENABLE_DISPLAY);
 
 	plat->base = fb;
 
diff --git a/drivers/video/bochs.h b/drivers/video/bochs.h
index 4c8ec83a55..71d3d60141 100644
--- a/drivers/video/bochs.h
+++ b/drivers/video/bochs.h
@@ -6,7 +6,10 @@ 
 #ifndef __BOCHS_H
 #define __BOCHS_H
 
-#define VGA_INDEX	0x3c0
+#define VGA_INDEX		0x3c0
+
+#define VGA_ATT_W		0x3c0
+#define VGA_AR_ENABLE_DISPLAY	0x20
 
 #define IOPORT_INDEX	0x01ce
 #define IOPORT_DATA	0x01cf