summaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/sst-firmware.c
diff options
context:
space:
mode:
authorJie Yang2014-12-23 02:12:45 +0100
committerMark Brown2014-12-24 13:14:06 +0100
commit25f97549b5a19a373922e07c3e0f0b0b56a49148 (patch)
treeb5154fd08d25e99429438c5250db49bee016335e /sound/soc/intel/sst-firmware.c
parentASoC: Intel: Fix BYTCR machine driver MODULE_ALIAS (diff)
downloadkernel-qcow2-linux-25f97549b5a19a373922e07c3e0f0b0b56a49148.tar.gz
kernel-qcow2-linux-25f97549b5a19a373922e07c3e0f0b0b56a49148.tar.xz
kernel-qcow2-linux-25f97549b5a19a373922e07c3e0f0b0b56a49148.zip
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. Signed-off-by: Jie Yang <yang.jie@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/sst-firmware.c')
-rw-r--r--sound/soc/intel/sst-firmware.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sound/soc/intel/sst-firmware.c b/sound/soc/intel/sst-firmware.c
index 4a5bde9c686b..ef2e8b5766a1 100644
--- a/sound/soc/intel/sst-firmware.c
+++ b/sound/soc/intel/sst-firmware.c
@@ -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)