linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: buddy.zhang@aliyun.com
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/cma.c: find a named CMA area by name
Date: Thu, 16 Jan 2020 13:12:40 +0100	[thread overview]
Message-ID: <20200116121240.GS19428@dhcp22.suse.cz> (raw)
In-Reply-To: <20200116101322.17795-1-buddy.zhang@aliyun.com>

On Thu 16-01-20 18:13:22, buddy.zhang@aliyun.com wrote:
> From: BuddyZhang <buddy.zhang@aliyun.com>
> 
> This function could help developer who want to find a special
> named CMA area.
> 
> 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.

Please do not add new exported symbols without actual users.

> Signed-off-by: BuddyZhang <buddy.zhang@aliyun.com>
> ---
>  mm/cma.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/mm/cma.c b/mm/cma.c
> index be55d1988c67..6581dabcaf34 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);
> 
> base-commit: 5b483a1a0ea1ab19a5734051c9692c2cfabe1327
> -- 
> 2.17.1
> 

-- 
Michal Hocko
SUSE Labs

       reply	other threads:[~2020-01-16 12:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200116101322.17795-1-buddy.zhang@aliyun.com>
2020-01-16 12:12 ` Michal Hocko [this message]
     [not found]   ` <6EE060CC-A19D-4F9D-BE36-14CB20C44AE2@aliyun.com>
2020-01-17  6:28     ` [PATCH] mm/cma.c: find a named CMA area by name Michal Hocko
     [not found] <20200114075147.30672-1-buddy.zhang@aliyun.com>
2020-01-14  9:02 ` David Hildenbrand
2020-01-16  4:21 ` kbuild test robot
2020-01-17  4:17 ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200116121240.GS19428@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=buddy.zhang@aliyun.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).