]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
efi: Use struct efi_gop_mode_info in struct efi_entry_gopmode
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tue, 4 Nov 2025 11:07:02 +0000 (12:07 +0100)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 6 Nov 2025 22:26:28 +0000 (23:26 +0100)
Since C99 flexible array members are allowed at the end of structures.
We require C11.

Use struct efi_gop_mode_info in the definition of struct efi_entry_gopmode
to avoid code duplication and unnecessary conversions.

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
include/efi.h
include/efi_api.h

index f9bbb175c3a94d1302ff74818fa5c071b7ed40c5..66725b876f9fbb022b0542414ff1b2d0fa1c2d83 100644 (file)
@@ -385,6 +385,28 @@ struct efi_entry_memmap {
        struct efi_mem_desc desc[];
 };
 
+/**
+ * struct efi_gop_mode_info - graphics output mode information
+ */
+struct efi_gop_mode_info {
+       /** @version:   version of the data structure (use zero) */
+       u32 version;
+       /** @width:     horizontal screen size */
+       u32 width;
+       /** @height:    vertical screen size */
+       u32 height;
+       /** @pixel_format:   enum that specifies the storage format of pixels */
+       u32 pixel_format;
+       /**
+        * @pixel_bitmask:   bitmasks used with PixelPixelBitMask
+        *
+        * The values which bits are used for red, green, blue, and alpha.
+        */
+       u32 pixel_bitmask[4];
+       /** @pixels_per_scanline:       pixels per video memory line */
+       u32 pixels_per_scanline;
+};
+
 /**
  * struct efi_entry_gopmode - a GOP mode table passed to U-Boot
  *
@@ -404,19 +426,7 @@ struct efi_entry_gopmode {
         */
        u64 fb_size;
        u64 info_size;
-       /*
-        * We cannot directly use 'struct efi_gop_mode_info info[]' here as
-        * it causes compiler to complain: array type has incomplete element
-        * type 'struct efi_gop_mode_info'.
-        */
-       struct /* efi_gop_mode_info */ {
-               u32 version;
-               u32 width;
-               u32 height;
-               u32 pixel_format;
-               u32 pixel_bitmask[4];
-               u32 pixels_per_scanline;
-       } info[];
+       struct efi_gop_mode_info info[];
 };
 
 /**
index 77a05f752e5690556e890ba9ad6107b80204cb20..d4fdd50c49e6c554836745100764747ae1530014 100644 (file)
@@ -1490,15 +1490,6 @@ struct efi_hii_config_access_protocol {
 #define EFI_GOT_BGRA8          1
 #define EFI_GOT_BITMASK                2
 
-struct efi_gop_mode_info {
-       u32 version;
-       u32 width;
-       u32 height;
-       u32 pixel_format;
-       u32 pixel_bitmask[4];
-       u32 pixels_per_scanline;
-};
-
 struct efi_gop_mode {
        u32 max_mode;
        u32 mode;