From e4231bcda72daef497af45e195a33daa0f9357d0 Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Tue, 18 Apr 2017 11:27:04 -0700 Subject: cma: Introduce cma_for_each_area Frameworks (e.g. Ion) may want to iterate over each possible CMA area to allow for enumeration. Introduce a function to allow a callback. Signed-off-by: Laura Abbott Signed-off-by: Greg Kroah-Hartman --- mm/cma.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mm/cma.c') diff --git a/mm/cma.c b/mm/cma.c index 43c1b2c1ac67..978b4a1441ef 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -504,3 +504,17 @@ bool cma_release(struct cma *cma, const struct page *pages, unsigned int count) return true; } + +int cma_for_each_area(int (*it)(struct cma *cma, void *data), void *data) +{ + int i; + + for (i = 0; i < cma_area_count; i++) { + int ret = it(&cma_areas[i], data); + + if (ret) + return ret; + } + + return 0; +} -- cgit v1.2.3-70-g09d2