diff mbox series

[v2,4/8] lmb: move MAX_LMB_REGIONS value in Kconfig

Message ID 20210310101622.v2.4.Icdf0b7e662fc65658e591ce0f692a5695f607256@changeid
State Accepted
Commit 4fa0150d6c9c252af6887c55cbacd6734a40e9ab
Delegated to: Tom Rini
Headers show
Series lmb: Add config for the number of memory and reserved regions | expand

Commit Message

Patrick Delaunay March 10, 2021, 9:16 a.m. UTC
Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

Changes in v2:
- new in v2: introduced MAX_LMB_REGIONS

 include/lmb.h |  4 +---
 lib/Kconfig   | 10 +++++++++-
 lib/lmb.c     |  4 ++--
 3 files changed, 12 insertions(+), 6 deletions(-)

Comments

Tom Rini April 23, 2021, 4:23 p.m. UTC | #1
On Wed, Mar 10, 2021 at 10:16:28AM +0100, Patrick Delaunay wrote:

> Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
> in lmb library.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/include/lmb.h b/include/lmb.h
index f3397c7f73..d3adf8ef69 100644
--- a/include/lmb.h
+++ b/include/lmb.h
@@ -12,8 +12,6 @@ 
  * Copyright (C) 2001 Peter Bergner, IBM Corp.
  */
 
-#define MAX_LMB_REGIONS 8
-
 struct lmb_property {
 	phys_addr_t base;
 	phys_size_t size;
@@ -22,7 +20,7 @@  struct lmb_property {
 struct lmb_region {
 	unsigned long cnt;
 	unsigned long max;
-	struct lmb_property region[MAX_LMB_REGIONS+1];
+	struct lmb_property region[CONFIG_LMB_MAX_REGIONS + 1];
 };
 
 struct lmb {
diff --git a/lib/Kconfig b/lib/Kconfig
index 43bd7190b9..43798d7a91 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -438,7 +438,7 @@  config LZ4
 	  is included. The LZ4 algorithm can run in-place as long as the
 	  compressed image is loaded to the end of the output buffer, and
 	  trades lower compression ratios for much faster decompression.
-	  
+
 	  NOTE: This implements the release version of the LZ4 frame
 	  format as generated by default by the 'lz4' command line tool.
 	  This is not the same as the outdated, less efficient legacy
@@ -706,6 +706,14 @@  config LMB
 	help
 	  Support the library logical memory blocks.
 
+
+config LMB_MAX_REGIONS
+	int "Number of memory and reserved regions in lmb lib"
+	depends on LMB
+	default 8
+	help
+	  Define the number of supported regions, memory and reserved, in the
+	  library logical memory blocks.
 endmenu
 
 config PHANDLE_CHECK_SEQ
diff --git a/lib/lmb.c b/lib/lmb.c
index a926198d48..9fbc56619b 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -95,8 +95,8 @@  static void lmb_coalesce_regions(struct lmb_region *rgn, unsigned long r1,
 
 void lmb_init(struct lmb *lmb)
 {
-	lmb->memory.max = MAX_LMB_REGIONS;
-	lmb->reserved.max = MAX_LMB_REGIONS;
+	lmb->memory.max = CONFIG_LMB_MAX_REGIONS;
+	lmb->reserved.max = CONFIG_LMB_MAX_REGIONS;
 
 	lmb->memory.cnt = 0;
 	lmb->reserved.cnt = 0;