From dfc1fa39b6f86c045da786d8d2dc4df532fe1f52 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Sun, 18 Jul 2021 14:20:25 +0200 Subject: [PATCH] Bluetooth: Audio: Guard VCS cli/srv structs Add guards to the structs. This has two purposes: 1) Reduce size of only one of them are enabled 2) Fix a compile issue if only one of them were enabled. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/vcs_internal.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/subsys/bluetooth/audio/vcs_internal.h b/subsys/bluetooth/audio/vcs_internal.h index dd6a3f52dba..3f4763bafb2 100644 --- a/subsys/bluetooth/audio/vcs_internal.h +++ b/subsys/bluetooth/audio/vcs_internal.h @@ -36,6 +36,7 @@ struct vcs_control_vol { uint8_t volume; } __packed; +#if defined(CONFIG_BT_VCS_CLIENT) struct bt_vcs_client { struct vcs_state state; uint8_t flags; @@ -62,7 +63,9 @@ struct bt_vcs_client { uint8_t aics_inst_cnt; struct bt_aics *aics[CONFIG_BT_VCS_CLIENT_MAX_AICS_INST]; }; +#endif /* CONFIG_BT_VCS_CLIENT */ +#if defined(CONFIG_BT_VCS) struct bt_vcs_server { struct vcs_state state; uint8_t flags; @@ -73,13 +76,18 @@ struct bt_vcs_server { struct bt_vocs *vocs_insts[CONFIG_BT_VCS_VOCS_INSTANCE_COUNT]; struct bt_aics *aics_insts[CONFIG_BT_VCS_AICS_INSTANCE_COUNT]; }; +#endif /* CONFIG_BT_VCS */ /* Struct used as a common type for the api */ struct bt_vcs { bool client_instance; union { +#if defined(CONFIG_BT_VCS) struct bt_vcs_server srv; +#endif /* CONFIG_BT_VCS */ +#if defined(CONFIG_BT_VCS_CLIENT) struct bt_vcs_client cli; +#endif /* CONFIG_BT_VCS_CLIENT */ }; };