Skip to content

Commit 87f77cf

Browse files
author
Jyri Sarha
committed
vregion: remove need to include rtos/alloc.h in !CONFIG_SOF_VREGIONS build
Remove need to include rtos/alloc.h in !CONFIG_SOF_VREGIONS build. We do not need the dummy vregion objects for anything, so get rid of them. From now on creating a vregion object when CONFIG_SOF_VREGIONS is not defined will fail. Also make sure the vregions is not tried to be used if its not enabled. Even before this change the failure would have happened couple of lines later. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent 1f4b8f0 commit 87f77cf

2 files changed

Lines changed: 3 additions & 12 deletions

File tree

src/audio/module_adapter/module_adapter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ static struct processing_module *module_adapter_mem_alloc(const struct comp_driv
9292
SOF_MEM_FLAG_USER | SOF_MEM_FLAG_COHERENT : SOF_MEM_FLAG_USER;
9393
size_t heap_size;
9494

95-
if (config->proc_domain == COMP_PROCESSING_DOMAIN_DP && IS_ENABLED(CONFIG_USERSPACE) &&
96-
!IS_ENABLED(CONFIG_SOF_USERSPACE_USE_DRIVER_HEAP)) {
95+
if (config->proc_domain == COMP_PROCESSING_DOMAIN_DP && IS_ENABLED(CONFIG_SOF_VREGIONS) &&
96+
IS_ENABLED(CONFIG_USERSPACE) && !IS_ENABLED(CONFIG_SOF_USERSPACE_USE_DRIVER_HEAP)) {
9797
mod_vreg = module_adapter_dp_heap_new(config, &heap_size);
9898
if (!mod_vreg) {
9999
comp_cl_err(drv, "Failed to allocate DP module heap / vregion");

src/include/sof/lib/vregion.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,29 +125,20 @@ void vregion_mem_info(struct vregion *vr, size_t *size, uintptr_t *start);
125125

126126
#else /* CONFIG_SOF_VREGIONS */
127127

128-
#include <rtos/alloc.h>
129-
130128
struct vregion {
131129
unsigned int use_count;
132130
};
133131

134132
static inline struct vregion *vregion_create(size_t lifetime_size, size_t interim_size)
135133
{
136-
struct vregion *vr = rmalloc(0, sizeof(*vr));
137-
138-
vr->use_count = 1;
139-
return vr;
134+
return NULL;
140135
}
141136
static inline struct vregion *vregion_get(struct vregion *vr)
142137
{
143-
if (vr)
144-
vr->use_count++;
145138
return vr;
146139
}
147140
static inline struct vregion *vregion_put(struct vregion *vr)
148141
{
149-
if (vr && !--vr->use_count)
150-
rfree(vr);
151142
return vr;
152143
}
153144
static inline void *vregion_alloc(struct vregion *vr, enum vregion_mem_type type, size_t size)

0 commit comments

Comments
 (0)