[<prev] [next>] [day] [month] [year] [list]
Message-ID: <3cb5e071-c5c0-47f8-96e9-526ca5dbfc62@redhat.com>
Date: Tue, 14 Jan 2020 10:02:25 +0100
From: David Hildenbrand <david@...hat.com>
To: buddy.zhang@...yun.com, akpm@...ux-foundation.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/cma.c: find a named CMA area by name
On 14.01.20 08:51, buddy.zhang@...yun.com wrote:
> From: BuddyZhang <buddy.zhang@...yun.com>
>
> This function could help developer who want to find a special
> named CMA area.
*could help* - if there is no user, why do we need it? Or do you have a
user?
>
> The CMA supports multiple named CMA areas, and the device could
> use or exclusive a special CAM arae via "cma_area" on "struct
> device". When probing, the device can setup special CMA area which
> find by "cma_find_by_name()".
>
> If device can't find named CMA area, "cma_find_by_name()" will
> return NULL, and device will used default CMA area.
>
> Signed-off-by: BuddyZhang <buddy.zhang@...yun.com>
> ---
> mm/cma.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/mm/cma.c b/mm/cma.c
> index be55d1988c67..b562557572c4 100644
> --- a/mm/cma.c
> +++ b/mm/cma.c
> @@ -40,6 +40,18 @@ struct cma cma_areas[MAX_CMA_AREAS];
> unsigned cma_area_count;
> static DEFINE_MUTEX(cma_mutex);
>
> +struct cma *cma_find_by_name(const char *name)
> +{
> + int idx;
> +
> + for (idx = 0; idx < MAX_CMA_AREAS; idx++) {
> + if (cma_areas[idx].name && !strcmp(name, cma_areas[idx].name))
> + return &cma_areas[idx];
> + }
> + return NULL;
> +}
> +EXPORT_SYMBOL(cma_find_by_name)
> +
> phys_addr_t cma_get_base(const struct cma *cma)
> {
> return PFN_PHYS(cma->base_pfn);
>
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists