All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH 2/4] Add lmb_free
Date: Tue, 20 May 2008 23:11:04 +0200	[thread overview]
Message-ID: <20080520211104.GC18756@game.jcrosoft.org> (raw)
In-Reply-To: <1211315046-8460-2-git-send-email-afleming@freescale.com>

On 15:24 Tue 20 May     , Andy Fleming wrote:
> lmb_free allows us to unreserve some memory so we can use lmb_alloc_base or
> lmb_reserve to temporarily reserve some memory.
> 
> Signed-off-by: Andy Fleming <afleming@freescale.com>
> ---
>  lib_generic/lmb.c |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 49 insertions(+), 0 deletions(-)
> 
> diff --git a/lib_generic/lmb.c b/lib_generic/lmb.c
> index 3b8c805..a34e2d3 100644
> --- a/lib_generic/lmb.c
> +++ b/lib_generic/lmb.c
> @@ -180,6 +180,55 @@ long lmb_add(struct lmb *lmb, ulong base, ulong size)
>  	return lmb_add_region(_rgn, base, size);
>  }
>  
> +long lmb_free(struct lmb *lmb, u64 base, u64 size)
> +{
> +	struct lmb_region *rgn = &(lmb->reserved);
> +	u64 rgnbegin, rgnend;
> +	u64 end = base + size;
> +	int i;
> +
> +	rgnbegin = rgnend = 0; /* supress gcc warnings */
> +
> +	/* Find the region where (base, size) belongs to */
> +	for (i=0; i < rgn->cnt; i++) {
please i = 0
> +		rgnbegin = rgn->region[i].base;
> +		rgnend = rgnbegin + rgn->region[i].size;
> +
> +		if ((rgnbegin <= base) && (end <= rgnend))
> +			break;
Best Regards,
J.

  parent reply	other threads:[~2008-05-20 21:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-20 20:24 [U-Boot-Users] [PATCH 1/4] Add ALIGN() macro Andy Fleming
2008-05-20 20:24 ` [U-Boot-Users] [PATCH 2/4] Add lmb_free Andy Fleming
2008-05-20 20:24   ` [U-Boot-Users] [PATCH 3/4] Fix an underflow bug in __lmb_alloc_base Andy Fleming
2008-05-20 20:24     ` [U-Boot-Users] [PATCH 4/4] Resize device tree to allow space for board changes and the chosen node Andy Fleming
2008-05-20 21:11   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2008-05-20 22:31     ` [U-Boot-Users] [PATCH 2/4] Add lmb_free Wolfgang Denk
2008-05-20 21:09 ` [U-Boot-Users] [PATCH 1/4] Add ALIGN() macro Jean-Christophe PLAGNIOL-VILLARD
2008-05-20 21:54   ` Scott Wood
2008-05-20 22:33     ` Wolfgang Denk
2008-05-20 22:29   ` Wolfgang Denk

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=20080520211104.GC18756@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.