Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Laura Abbott and committed by
Greg Kroah-Hartman
e4231bcd f318dd08

+16
+2
include/linux/cma.h
··· 34 34 extern struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align, 35 35 gfp_t gfp_mask); 36 36 extern bool cma_release(struct cma *cma, const struct page *pages, unsigned int count); 37 + 38 + extern int cma_for_each_area(int (*it)(struct cma *cma, void *data), void *data); 37 39 #endif
+14
mm/cma.c
··· 504 504 505 505 return true; 506 506 } 507 + 508 + int cma_for_each_area(int (*it)(struct cma *cma, void *data), void *data) 509 + { 510 + int i; 511 + 512 + for (i = 0; i < cma_area_count; i++) { 513 + int ret = it(&cma_areas[i], data); 514 + 515 + if (ret) 516 + return ret; 517 + } 518 + 519 + return 0; 520 + }