]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: SOF: ipc: replace "enum sof_comp_type" field with "uint32_t"
authorLaurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Mon, 26 Aug 2024 18:24:42 +0000 (14:24 -0400)
committerMark Brown <broonie@kernel.org>
Mon, 26 Aug 2024 18:29:39 +0000 (19:29 +0100)
Normally, the type of enums is "unsigned int" or "int". GCC has
the "-fshort-enums" option, which instructs the compiler to
use the smallest data type that can hold all the values in
the enum (i.e: char, short, int or their unsigned variants).

According to the GCC documentation, "-fshort-enums" may be
default on some targets. This seems to be the case for SOF
when built for a certain 32-bit ARM platform.

On Linux, this is not the case (tested with "aarch64-linux-gnu-gcc")
which means enums such as "enum sof_comp_type" will end up having
different sizes on Linux and SOF. Since "enum sof_comp_type" is used in
IPC-related structures such as "struct sof_ipc_comp", this means
the fields of the structures will end up being placed at different
offsets. This, in turn, leads to SOF not being able to properly
interpret data passed from Linux.

With this in mind, replace "enum sof_comp_type" from
"struct sof_ipc_comp" with "uint32_t".

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://patch.msgid.link/20240826182442.6191-1-laurentiumihalcea111@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/sof/topology.h
include/uapi/sound/sof/abi.h

index 3ba086f6198312202e0c91f5bacb669c02453a47..449e93c251842f4ab05208daf1fc63a05785307f 100644 (file)
@@ -54,7 +54,7 @@ enum sof_comp_type {
 struct sof_ipc_comp {
        struct sof_ipc_cmd_hdr hdr;
        uint32_t id;
-       enum sof_comp_type type;
+       uint32_t type;
        uint32_t pipeline_id;
        uint32_t core;
 
index 937ed9408c2390b2d701ab8fb940f70a2091868a..c1b158ec5dab55658646f61e496f8a12cb0831b3 100644 (file)
@@ -29,7 +29,7 @@
 /* SOF ABI version major, minor and patch numbers */
 #define SOF_ABI_MAJOR 3
 #define SOF_ABI_MINOR 23
-#define SOF_ABI_PATCH 0
+#define SOF_ABI_PATCH 1
 
 /* SOF ABI version number. Format within 32bit word is MMmmmppp */
 #define SOF_ABI_MAJOR_SHIFT    24