[PATCH 1/8] hw/display/macfb: Constify macfb_sense_table[] array

Philippe Mathieu-Daudé posted 8 patches 1 month, 3 weeks ago
There is a newer version of this series
[PATCH 1/8] hw/display/macfb: Constify macfb_sense_table[] array
Posted by Philippe Mathieu-Daudé 1 month, 3 weeks ago
macfb_sense_table[] is only read, never updated, so can be const.

Update the single call site, macfb_sense_read().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/display/macfb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/display/macfb.c b/hw/display/macfb.c
index 388f8de5070..57ad8ad5587 100644
--- a/hw/display/macfb.c
+++ b/hw/display/macfb.c
@@ -82,7 +82,7 @@ typedef struct MacFbSense {
     uint8_t ext_sense;
 } MacFbSense;
 
-static MacFbSense macfb_sense_table[] = {
+static const MacFbSense macfb_sense_table[] = {
     { MACFB_DISPLAY_APPLE_21_COLOR, 0x0, 0 },
     { MACFB_DISPLAY_APPLE_PORTRAIT, 0x1, 0 },
     { MACFB_DISPLAY_APPLE_12_RGB, 0x2, 0 },
@@ -342,7 +342,7 @@ static void macfb_invalidate_display(void *opaque)
 
 static uint32_t macfb_sense_read(MacfbState *s)
 {
-    MacFbSense *macfb_sense;
+    const MacFbSense *macfb_sense;
     uint8_t sense;
 
     assert(s->type < ARRAY_SIZE(macfb_sense_table));
-- 
2.52.0


Re: [PATCH 1/8] hw/display/macfb: Constify macfb_sense_table[] array
Posted by Mark Cave-Ayland 1 month, 3 weeks ago
On 14/02/2026 02:12, Philippe Mathieu-Daudé wrote:

> macfb_sense_table[] is only read, never updated, so can be const.
> 
> Update the single call site, macfb_sense_read().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/display/macfb.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/display/macfb.c b/hw/display/macfb.c
> index 388f8de5070..57ad8ad5587 100644
> --- a/hw/display/macfb.c
> +++ b/hw/display/macfb.c
> @@ -82,7 +82,7 @@ typedef struct MacFbSense {
>       uint8_t ext_sense;
>   } MacFbSense;
>   
> -static MacFbSense macfb_sense_table[] = {
> +static const MacFbSense macfb_sense_table[] = {
>       { MACFB_DISPLAY_APPLE_21_COLOR, 0x0, 0 },
>       { MACFB_DISPLAY_APPLE_PORTRAIT, 0x1, 0 },
>       { MACFB_DISPLAY_APPLE_12_RGB, 0x2, 0 },
> @@ -342,7 +342,7 @@ static void macfb_invalidate_display(void *opaque)
>   
>   static uint32_t macfb_sense_read(MacfbState *s)
>   {
> -    MacFbSense *macfb_sense;
> +    const MacFbSense *macfb_sense;
>       uint8_t sense;
>   
>       assert(s->type < ARRAY_SIZE(macfb_sense_table));

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.


Re: [PATCH 1/8] hw/display/macfb: Constify macfb_sense_table[] array
Posted by Pierrick Bouvier 1 month, 3 weeks ago
On 2/13/26 6:12 PM, Philippe Mathieu-Daudé wrote:
> macfb_sense_table[] is only read, never updated, so can be const.
> 
> Update the single call site, macfb_sense_read().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/display/macfb.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>