OSDN Git Service

ASoC: SOF: IPC: make sof_ipc_window monosized
authorKarol Trzcinski <karolx.trzcinski@linux.intel.com>
Tue, 25 Aug 2020 23:58:51 +0000 (16:58 -0700)
committerMark Brown <broonie@kernel.org>
Wed, 26 Aug 2020 11:44:07 +0000 (12:44 +0100)
This step is needed to add possibility to pack sof_ipc_window inside
another one in used FW build tools - for example in extended manifest.
Structure reusability leads to easy parsing function reuse, so source
code is shorter and easier to maintain.

Using structures with constant size is less tricky and properly
supported by each toolchain by contrast to variable size elements.

This is minor ABI change - backward compatibility is kept.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200825235854.1588034-2-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/sof/info.h
include/uapi/sound/sof/abi.h
sound/soc/sof/loader.c

index 5a55ba8..313e3e7 100644 (file)
@@ -99,7 +99,7 @@ struct sof_ipc_window_elem {
 struct sof_ipc_window {
        struct sof_ipc_ext_data_hdr ext_hdr;
        uint32_t num_windows;
-       struct sof_ipc_window_elem window[];
+       struct sof_ipc_window_elem window[SOF_IPC_MAX_ELEMS];
 }  __packed;
 
 struct sof_ipc_cc_version {
index d54be30..6af32f8 100644 (file)
@@ -26,7 +26,7 @@
 
 /* SOF ABI version major, minor and patch numbers */
 #define SOF_ABI_MAJOR 3
-#define SOF_ABI_MINOR 16
+#define SOF_ABI_MINOR 17
 #define SOF_ABI_PATCH 0
 
 /* SOF ABI version number. Format within 32bit word is MMmmmppp */
index b94fa5f..25dc28e 100644 (file)
@@ -20,13 +20,12 @@ static int get_ext_windows(struct snd_sof_dev *sdev,
 {
        const struct sof_ipc_window *w =
                container_of(ext_hdr, struct sof_ipc_window, ext_hdr);
-       size_t w_size = struct_size(w, window, w->num_windows);
 
        if (w->num_windows == 0 || w->num_windows > SOF_IPC_MAX_ELEMS)
                return -EINVAL;
 
        if (sdev->info_window) {
-               if (memcmp(sdev->info_window, w, w_size)) {
+               if (memcmp(sdev->info_window, w, ext_hdr->hdr.size)) {
                        dev_err(sdev->dev, "error: mismatch between window descriptor from extended manifest and mailbox");
                        return -EINVAL;
                }
@@ -34,7 +33,7 @@ static int get_ext_windows(struct snd_sof_dev *sdev,
        }
 
        /* keep a local copy of the data */
-       sdev->info_window = kmemdup(w, w_size, GFP_KERNEL);
+       sdev->info_window = kmemdup(w, ext_hdr->hdr.size, GFP_KERNEL);
        if (!sdev->info_window)
                return -ENOMEM;