lkml.org 
[lkml]   [2017]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH 09/12] cma: Introduce cma_for_each_area
    Date

    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>
    ---
    include/linux/cma.h | 2 ++
    mm/cma.c | 14 ++++++++++++++
    2 files changed, 16 insertions(+)

    diff --git a/include/linux/cma.h b/include/linux/cma.h
    index 49f98ea..b521e3c 100644
    --- a/include/linux/cma.h
    +++ b/include/linux/cma.h
    @@ -33,4 +33,6 @@ extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,
    struct cma **res_cma);
    extern struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align);
    extern bool cma_release(struct cma *cma, const struct page *pages, unsigned int count);
    +
    +extern int cma_for_each_area(int (*it)(struct cma *cma, void *data), void *data);
    #endif
    diff --git a/mm/cma.c b/mm/cma.c
    index 4a93d2b..a430df0 100644
    --- a/mm/cma.c
    +++ b/mm/cma.c
    @@ -464,3 +464,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;
    +}
    --
    2.7.4
    \
     
     \ /
      Last update: 2017-03-02 22:46    [W:2.469 / U:0.532 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site