Skip to contentSkip to conversation

ASoC: Intel: correct the fixed free block allocation

PATCH Applied Jie Yang 2 participants 2 messages Dec 23, 2014 – Dec 24, 2014

Subsystems (3)
lore
Share & tools
lore

Jie Yang

author
#0 lore raw

PATCH 1/1 ASoC: Intel: correct the fixed free block allocation

For block span more than 1 section, when allocate it from a free block, we need allocate the remain buffers within the block, and then continue alloc the rest of needed size buffer.

Here also make sure this free block is moved from free list to used list, and add it to block_list which may be used for power gating disabling later.

---
 sound/soc/intel/sst-firmware.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/intel/sst-firmware.c +5 -1
index 4a5bde9..ef2e8b5 100644
@@ -763,8 +763,12 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba
 		/* does block span more than 1 section */
 		if (ba->offset >= block->offset && ba->offset < block_end) {
 
+			/* add block */
+			list_move(&block->list, &dsp->used_block_list);
+			list_add(&block->module_list, block_list);
 			/* align ba to block boundary */
-			ba->offset = block->offset;
+			ba->size -= block_end - ba->offset;
+			ba->offset = block_end;
 
 			err = block_alloc_contiguous(dsp, ba, block_list);
 			if (err < 0)
Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw
Quoted 4 lines · Jie Yang

For block span more than 1 section, when allocate it from a free block, we need allocate the remain buffers within the block, and then continue alloc the rest of needed size buffer.

Applied, thanks.