k3dma: Fix memory handling in preparation for cyclic mode
authorJohn Stultz <john.stultz@linaro.org>
Mon, 29 Aug 2016 17:30:51 +0000 (10:30 -0700)
committerVinod Koul <vinod.koul@intel.com>
Wed, 31 Aug 2016 04:39:32 +0000 (10:09 +0530)
commit36387a2b1f62b5c087c5fe6f0f7b23b94f722ad7
tree44e1b2bb543d2b4f9c80aef802dfd6cd17c36399
parentb77f262ae351d467c22b056f6d13afeeab7ea69a
k3dma: Fix memory handling in preparation for cyclic mode

With cyclic mode, the shared virt-dma logic doesn't actually
manage the descriptor state, nor the calling of the descriptor
free callback. This results in leaking a desc structure every
time we start an audio transfer.

Thus we must manage it ourselves. The k3dma driver already keeps
track of the active and finished descriptors via ds_run and ds_done
pointers, so cleanup how we handle those two values, so when we
tear down everything in terminate_all, call free_desc on the ds_run
and ds_done pointers if they are not null.

NOTE: HiKey doesn't use the non-cyclic dma modes, so I'm not been
able to test those modes. But with this patch we no longer leak
the desc structures.

Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Andy Green <andy@warmcat.com>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/k3dma.c