diff mbox series

[12/14] staging: android: ion: Declare helpers for carveout and chunk heaps

Message ID 20190111180523.27862-13-afd@ti.com (mailing list archive)
State New, archived
Headers show
Series Misc ION cleanups and adding unmapped heap | expand

Commit Message

Andrew Davis Jan. 11, 2019, 6:05 p.m. UTC
When enabled the helpers functions for creating carveout and chunk heaps
should have declarations in the ION header.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 drivers/staging/android/ion/ion.h | 33 +++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Comments

Greg KH Jan. 18, 2019, 9:59 a.m. UTC | #1
On Fri, Jan 11, 2019 at 12:05:21PM -0600, Andrew F. Davis wrote:
> When enabled the helpers functions for creating carveout and chunk heaps
> should have declarations in the ION header.

Why?  No one calls these from what I can tell.

Which makes me believe we should just delete the
drivers/staging/android/ion/ion_carveout_heap.c and
drivers/staging/android/ion/ion_chunk_heap.c files as there are no
in-tree users?

Any objection to me doing that?

thanks,

greg k-h
Andrew Davis Jan. 18, 2019, 4:09 p.m. UTC | #2
On 1/18/19 3:59 AM, Greg Kroah-Hartman wrote:
> On Fri, Jan 11, 2019 at 12:05:21PM -0600, Andrew F. Davis wrote:
>> When enabled the helpers functions for creating carveout and chunk heaps
>> should have declarations in the ION header.
> 
> Why?  No one calls these from what I can tell.
> 
> Which makes me believe we should just delete the
> drivers/staging/android/ion/ion_carveout_heap.c and
> drivers/staging/android/ion/ion_chunk_heap.c files as there are no
> in-tree users?
> 
> Any objection to me doing that?
> 

I use those when creating carveout heaps. My exporter is out of tree
still as it uses DT and the proper bindings have not been agreed upon
yet. These helpers also make good heap creation references, even if not
called by anyone in-tree right now.

Thanks,
Andrew

> thanks,
> 
> greg k-h
>
Laura Abbott Jan. 18, 2019, 7:54 p.m. UTC | #3
On 1/18/19 1:59 AM, Greg Kroah-Hartman wrote:
> On Fri, Jan 11, 2019 at 12:05:21PM -0600, Andrew F. Davis wrote:
>> When enabled the helpers functions for creating carveout and chunk heaps
>> should have declarations in the ION header.
> 
> Why?  No one calls these from what I can tell.
> 
> Which makes me believe we should just delete the
> drivers/staging/android/ion/ion_carveout_heap.c and
> drivers/staging/android/ion/ion_chunk_heap.c files as there are no
> in-tree users?
> 
> Any objection to me doing that?
> 
> thanks,
> 
> greg k-h
> 

I'd rather not delete it quite yet. Part of this entire thread is a
discussion on how to let those heaps and associated function actually
be called in some way in tree. I expect them to either get called
in tree or be replaced.

Thanks,
Laura
diff mbox series

Patch

diff --git a/drivers/staging/android/ion/ion.h b/drivers/staging/android/ion/ion.h
index e291299fd35f..97b2876b165a 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -308,4 +308,37 @@  void ion_page_pool_free(struct ion_page_pool *pool, struct page *page);
 int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask,
 			 int nr_to_scan);
 
+#ifdef CONFIG_ION_CARVEOUT_HEAP
+/**
+ * ion_carveout_heap_create
+ * @base:		base address of carveout memory
+ * @size:		size of carveout memory region
+ *
+ * Creates a carveout ion_heap using the passed in data
+ */
+struct ion_heap *ion_carveout_heap_create(phys_addr_t base, size_t size);
+#else
+static inline struct ion_heap *ion_carveout_heap_create(phys_addr_t base, size_t size)
+{
+	return ERR_PTR(-ENODEV);
+}
+#endif
+
+#ifdef CONFIG_ION_CHUNK_HEAP
+/**
+ * ion_chunk_heap_create
+ * @base:		base address of carveout memory
+ * @size:		size of carveout memory region
+ * @chunk_size:		minimum allocation granularity
+ *
+ * Creates a chunk ion_heap using the passed in data
+ */
+struct ion_heap *ion_chunk_heap_create(phys_addr_t base, size_t size, size_t chunk_size);
+#else
+static inline struct ion_heap *ion_chunk_heap_create(phys_addr_t base, size_t size, size_t chunk_size)
+{
+	return ERR_PTR(-ENODEV);
+}
+#endif
+
 #endif /* _ION_H */