ANDROID: staging: ion: Add an in-kernel interface to request heap info.

Add an API to allow in-kernel clients to request heap ID info.

Test: make
Bug: 149961819

Change-Id: I59d26355115f100a60bcf8ade0e3afa4b89c5d0a
Signed-off-by: Hridya Valsaraju <hridya@google.com>
This commit is contained in:
Hridya Valsaraju
2020-02-25 16:30:06 -08:00
parent 5ef359df15
commit 0a6517f730
2 changed files with 51 additions and 0 deletions

View File

@@ -309,6 +309,21 @@ struct dma_buf *ion_alloc(size_t len, unsigned int heap_id_mask,
*/
int ion_free(struct ion_buffer *buffer);
/**
* ion_query_heaps_kernel - Returns information about available heaps to
* in-kernel clients.
*
* @hdata: pointer to array of struct ion_heap_data.
* @size: size of @hdata array.
*
* Returns the number of available heaps and populates @hdata with information
* regarding the same. When invoked with @size as 0, the function with return
* the number of available heaps without modifying @hdata. When the number of
* available heaps is higher than @size, @size is returned instead of the
* actual number of available heaps.
*/
size_t ion_query_heaps_kernel(struct ion_heap_data *hdata, size_t size);
#else
static inline int __ion_device_add_heap(struct ion_heap *heap,
@@ -380,5 +395,10 @@ static inline int ion_free(struct ion_buffer *buffer)
return 0;
}
static inline size_t ion_query_heaps_kernel(struct ion_heap_data *hdata,
size_t size)
{
return 0;
}
#endif /* CONFIG_ION */
#endif /* _ION_KERNEL_H */