On Tue, Oct 22, 2013 at 8:06 PM, Lars-Peter Clausen lars@metafoo.de wrote:
On 10/22/2013 05:00 AM, Nicolin Chen wrote: [...]
+/**
- snd_free_dev_iram - free allocated specific memory from on-chip
internal memory
- @dev: DMA device pointer
- @size: size in bytes of memory to free
- @ptr: cpu-view address returned from snd_malloc_dev_iram
- This function requires iram phandle provided via of_node
- */
+void snd_free_dev_iram(struct device *dev, size_t size, void *ptr) +{
struct gen_pool *pool = NULL;
if (!dev->of_node)
return;
pool = of_get_named_gen_pool(dev->of_node, "iram", 0);
if (!pool)
return;
I've had a closer look at the other SNDRV_DMA_TYPE implementations and I think a better way to handle this is to assign the pool to the snd_dma_buffer's private_data field and then use it here instead of looking the pool up again. This will also make it easier to use a non-OF lookup scheme.
By saving the pool to pdata during the allocating? Hmm..that should be
nicer.
Just need to change the parameter "struct device *" to "struct gen_pool
*" directly
I'll see what I can do to refine it. Thank you for the suggestion.
Nicolin Chen
gen_pool_free(pool, (unsigned long)ptr, size);
+} #endif /* CONFIG_HAS_DMA */
/*
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel