Skip to content

Commit 5ccbf60

Browse files
ktrzcinxplbossart
authored andcommitted
ASoC: SOF: IPC: make sof_ipc_window monosized
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>
1 parent 5fa59c1 commit 5ccbf60

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

include/sound/sof/info.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ struct sof_ipc_window_elem {
9999
struct sof_ipc_window {
100100
struct sof_ipc_ext_data_hdr ext_hdr;
101101
uint32_t num_windows;
102-
struct sof_ipc_window_elem window[];
102+
struct sof_ipc_window_elem window[SOF_IPC_MAX_ELEMS];
103103
} __packed;
104104

105105
struct sof_ipc_cc_version {

include/uapi/sound/sof/abi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
/* SOF ABI version major, minor and patch numbers */
2828
#define SOF_ABI_MAJOR 3
29-
#define SOF_ABI_MINOR 16
29+
#define SOF_ABI_MINOR 17
3030
#define SOF_ABI_PATCH 0
3131

3232
/* SOF ABI version number. Format within 32bit word is MMmmmppp */

sound/soc/sof/loader.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,20 @@ static int get_ext_windows(struct snd_sof_dev *sdev,
2020
{
2121
const struct sof_ipc_window *w =
2222
container_of(ext_hdr, struct sof_ipc_window, ext_hdr);
23-
size_t w_size = struct_size(w, window, w->num_windows);
2423

2524
if (w->num_windows == 0 || w->num_windows > SOF_IPC_MAX_ELEMS)
2625
return -EINVAL;
2726

2827
if (sdev->info_window) {
29-
if (memcmp(sdev->info_window, w, w_size)) {
28+
if (memcmp(sdev->info_window, w, ext_hdr->hdr.size)) {
3029
dev_err(sdev->dev, "error: mismatch between window descriptor from extended manifest and mailbox");
3130
return -EINVAL;
3231
}
3332
return 0;
3433
}
3534

3635
/* keep a local copy of the data */
37-
sdev->info_window = kmemdup(w, w_size, GFP_KERNEL);
36+
sdev->info_window = kmemdup(w, ext_hdr->hdr.size, GFP_KERNEL);
3837
if (!sdev->info_window)
3938
return -ENOMEM;
4039

0 commit comments

Comments
 (0)