hw/display/macfb: Constify macfb_mode_table[] array

macfb_mode_table[] is only read, never updated, so can be const.

Update the call sites accordingly.
Make the MacfbState::mode pointer to const.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260216213121.47122-3-philmd@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé
2026-02-11 14:45:37 +01:00
parent 10b63551b6
commit ee56761607
3 changed files with 7 additions and 7 deletions

View File

@@ -100,7 +100,7 @@ static const MacFbSense macfb_sense_table[] = {
{ MACFB_DISPLAY_SVGA, 0x7, 0x5 },
};
static MacFbMode macfb_mode_table[] = {
static const MacFbMode macfb_mode_table[] = {
{ MACFB_DISPLAY_VGA, 1, 0x100, 0x71e, 640, 480, 0x400, 0x1000 },
{ MACFB_DISPLAY_VGA, 2, 0x100, 0x70e, 640, 480, 0x400, 0x1000 },
{ MACFB_DISPLAY_VGA, 4, 0x100, 0x706, 640, 480, 0x400, 0x1000 },
@@ -397,7 +397,7 @@ static void macfb_update_mode(MacfbState *s)
static void macfb_mode_write(MacfbState *s)
{
MacFbMode *macfb_mode;
const MacFbMode *macfb_mode;
int i;
for (i = 0; i < ARRAY_SIZE(macfb_mode_table); i++) {
@@ -418,11 +418,11 @@ static void macfb_mode_write(MacfbState *s)
}
}
static MacFbMode *macfb_find_mode(MacfbDisplayType display_type,
static const MacFbMode *macfb_find_mode(MacfbDisplayType display_type,
uint16_t width, uint16_t height,
uint8_t depth)
{
MacFbMode *macfb_mode;
const MacFbMode *macfb_mode;
int i;
for (i = 0; i < ARRAY_SIZE(macfb_mode_table); i++) {
@@ -440,7 +440,7 @@ static MacFbMode *macfb_find_mode(MacfbDisplayType display_type,
static gchar *macfb_mode_list(void)
{
GString *list = g_string_new("");
MacFbMode *macfb_mode;
const MacFbMode *macfb_mode;
int i;
for (i = 0; i < ARRAY_SIZE(macfb_mode_table); i++) {

View File

@@ -255,7 +255,7 @@ static void q800_machine_init(MachineState *machine)
int32_t initrd_size;
uint8_t *prom;
int i, checksum;
MacFbMode *macfb_mode;
const MacFbMode *macfb_mode;
ram_addr_t ram_size = machine->ram_size;
const char *kernel_filename = machine->kernel_filename;
const char *initrd_filename = machine->initrd_filename;

View File

@@ -66,7 +66,7 @@ typedef struct MacfbState {
uint8_t type;
uint32_t regs[MACFB_NUM_REGS];
MacFbMode *mode;
const MacFbMode *mode;
QEMUTimer *vbl_timer;
qemu_irq irq;