When CONFIG_UAPI_HEADER_TEST=y, exported headers are compile-tested to make sure they can be included from user-space. Currently, header.h and fw.h are excluded from the test coverage. To make them join the compile-test, we need to fix the build errors attached below. For a case like this, we decided to use __u{8,16,32,64} variable types in this discussion: https://lkml.org/lkml/2019/6/5/18 Build log: CC usr/include/sound/sof/header.h.s CC usr/include/sound/sof/fw.h.s In file included from <command-line>:32:0: ./usr/include/sound/sof/header.h:19:2: error: unknown type name ‘uint32_t’ uint32_t magic; /**< 'S', 'O', 'F', '\0' */ ^~~~~~~~ ./usr/include/sound/sof/header.h:20:2: error: unknown type name ‘uint32_t’ uint32_t type; /**< component specific type */ ^~~~~~~~ ./usr/include/sound/sof/header.h:21:2: error: unknown type name ‘uint32_t’ uint32_t size; /**< size in bytes of data excl. this struct */ ^~~~~~~~ ./usr/include/sound/sof/header.h:22:2: error: unknown type name ‘uint32_t’ uint32_t abi; /**< SOF ABI version */ ^~~~~~~~ ./usr/include/sound/sof/header.h:23:2: error: unknown type name ‘uint32_t’ uint32_t reserved[4]; /**< reserved for future use */ ^~~~~~~~ ./usr/include/sound/sof/header.h:24:2: error: unknown type name ‘uint32_t’ uint32_t data[0]; /**< Component data - opaque to core */ ^~~~~~~~ In file included from <command-line>:32:0: ./usr/include/sound/sof/fw.h:49:2: error: unknown type name ‘uint32_t’ uint32_t size; /* bytes minus this header */ ^~~~~~~~ ./usr/include/sound/sof/fw.h:50:2: error: unknown type name ‘uint32_t’ uint32_t offset; /* offset from base */ ^~~~~~~~ ./usr/include/sound/sof/fw.h:64:2: error: unknown type name ‘uint32_t’ uint32_t size; /* bytes minus this header */ ^~~~~~~~ ./usr/include/sound/sof/fw.h:65:2: error: unknown type name ‘uint32_t’ uint32_t num_blocks; /* number of blocks */ ^~~~~~~~ ./usr/include/sound/sof/fw.h:73:2: error: unknown type name ‘uint32_t’ uint32_t file_size; /* size of file minus this header */ ^~~~~~~~ ./usr/include/sound/sof/fw.h:74:2: error: unknown type name ‘uint32_t’ uint32_t num_modules; /* number of modules */ ^~~~~~~~ ./usr/include/sound/sof/fw.h:75:2: error: unknown type name ‘uint32_t’ uint32_t abi; /* version of header format */ ^~~~~~~~
Showing the changes to include/uapi (2 of 2 files). Show all
Unified · Split
| @@ -13,6 +13,8 @@ · 12 unmodified lines | |||
| 13 | #ifndef __INCLUDE_UAPI_SOF_FW_H__ | 13 | #ifndef __INCLUDE_UAPI_SOF_FW_H__ |
| 14 | #define __INCLUDE_UAPI_SOF_FW_H__ | 14 | #define __INCLUDE_UAPI_SOF_FW_H__ |
| 15 | 15 | ||
| 16 | #include <linux/types.h> | ||
| 17 | |||
| 16 | #define SND_SOF_FW_SIG_SIZE 4 | 18 | #define SND_SOF_FW_SIG_SIZE 4 |
| 17 | #define SND_SOF_FW_ABI 1 | 19 | #define SND_SOF_FW_ABI 1 |
| 18 | #define SND_SOF_FW_SIG "Reef" | 20 | #define SND_SOF_FW_SIG "Reef" |
| @@ -46,8 +48,8 @@ enum snd_sof_fw_blk_type { · 27 unmodified lines | |||
| 46 | 48 | ||
| 47 | struct snd_sof_blk_hdr { | 49 | struct snd_sof_blk_hdr { |
| 48 | enum snd_sof_fw_blk_type type; | 50 | enum snd_sof_fw_blk_type type; |
| 49 | uint32_t size; /* bytes minus this header */ | 51 | __u32 size; /* bytes minus this header */ |
| 50 | uint32_t offset; /* offset from base */ | 52 | __u32 offset; /* offset from base */ |
| 51 | } __packed; | 53 | } __packed; |
| 52 | 54 | ||
| 53 | /* | 55 | /* |
| @@ -61,8 +63,8 @@ enum snd_sof_fw_mod_type { · 7 unmodified lines | |||
| 61 | 63 | ||
| 62 | struct snd_sof_mod_hdr { | 64 | struct snd_sof_mod_hdr { |
| 63 | enum snd_sof_fw_mod_type type; | 65 | enum snd_sof_fw_mod_type type; |
| 64 | uint32_t size; /* bytes minus this header */ | 66 | __u32 size; /* bytes minus this header */ |
| 65 | uint32_t num_blocks; /* number of blocks */ | 67 | __u32 num_blocks; /* number of blocks */ |
| 66 | } __packed; | 68 | } __packed; |
| 67 | 69 | ||
| 68 | /* | 70 | /* |
| @@ -70,9 +72,9 @@ struct snd_sof_mod_hdr { · 1 unmodified line | |||
| 70 | */ | 72 | */ |
| 71 | struct snd_sof_fw_header { | 73 | struct snd_sof_fw_header { |
| 72 | unsigned char sig[SND_SOF_FW_SIG_SIZE]; /* "Reef" */ | 74 | unsigned char sig[SND_SOF_FW_SIG_SIZE]; /* "Reef" */ |
| 73 | uint32_t file_size; /* size of file minus this header */ | 75 | __u32 file_size; /* size of file minus this header */ |
| 74 | uint32_t num_modules; /* number of modules */ | 76 | __u32 num_modules; /* number of modules */ |
| 75 | uint32_t abi; /* version of header format */ | 77 | __u32 abi; /* version of header format */ |
| 76 | } __packed; | 78 | } __packed; |
| 77 | 79 | ||
| 78 | #endif | 80 | #endif |
| @@ -9,6 +9,8 @@ · 8 unmodified lines | |||
| 9 | #ifndef __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__ | 9 | #ifndef __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__ |
| 10 | #define __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__ | 10 | #define __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__ |
| 11 | 11 | ||
| 12 | #include <linux/types.h> | ||
| 13 | |||
| 12 | /* | 14 | /* |
| 13 | * Header for all non IPC ABI data. | 15 | * Header for all non IPC ABI data. |
| 14 | * | 16 | * |
| @@ -16,12 +18,12 @@ · 1 unmodified line | |||
| 16 | * Used by any bespoke component data structures or binary blobs. | 18 | * Used by any bespoke component data structures or binary blobs. |
| 17 | */ | 19 | */ |
| 18 | struct sof_abi_hdr { | 20 | struct sof_abi_hdr { |
| 19 | uint32_t magic; /**< 'S', 'O', 'F', '\0' */ | 21 | __u32 magic; /**< 'S', 'O', 'F', '\0' */ |
| 20 | uint32_t type; /**< component specific type */ | 22 | __u32 type; /**< component specific type */ |
| 21 | uint32_t size; /**< size in bytes of data excl. this struct */ | 23 | __u32 size; /**< size in bytes of data excl. this struct */ |
| 22 | uint32_t abi; /**< SOF ABI version */ | 24 | __u32 abi; /**< SOF ABI version */ |
| 23 | uint32_t reserved[4]; /**< reserved for future use */ | 25 | __u32 reserved[4]; /**< reserved for future use */ |
| 24 | uint32_t data[0]; /**< Component data - opaque to core */ | 26 | __u32 data[0]; /**< Component data - opaque to core */ |
| 25 | } __packed; | 27 | } __packed; |
| 26 | 28 | ||
| 27 | #endif | 29 | #endif |