Skip to content

Commit 465f6aa

Browse files
serhiy-katsyuba-intellgirdwood
authored andcommitted
dai-zephyr: enforce type check for dai_get_device()
Allow the compiler to issue a warning/error if the wrong DAI type enum is passed as a parameter, as it is easy to incorrectly use Zephyr's enum dai_type instead of the proper SOF enum sof_ipc_dai_type. Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
1 parent 5a286c8 commit 465f6aa

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/include/sof/lib/dai-zephyr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <sof/ipc/topology.h>
2929
#include <sof/audio/pcm_converter.h>
3030
#include <sof/audio/ipc-config.h>
31+
#include <ipc/dai.h>
3132
#include <errno.h>
3233
#include <stddef.h>
3334
#include <stdint.h>
@@ -305,7 +306,7 @@ void dai_release_llp_slot(struct dai_data *dd);
305306
/**
306307
* \brief Retrieve a pointer to the Zephyr device structure for a DAI of a given type and index.
307308
*/
308-
const struct device *dai_get_device(uint32_t type, uint32_t index);
309+
const struct device *dai_get_device(enum sof_ipc_dai_type type, uint32_t index);
309310

310311
/**
311312
* \brief Retrieve the list of all DAI devices.

src/lib/dai.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ static int sof_dai_type_to_zephyr(uint32_t type)
231231
}
232232
}
233233

234-
const struct device *dai_get_device(uint32_t type, uint32_t index)
234+
const struct device *dai_get_device(enum sof_ipc_dai_type type, uint32_t index)
235235
{
236236
struct dai_config cfg;
237237
int z_type;

0 commit comments

Comments
 (0)