From 66bda092cf2af51f2731991fe7d2d14de8aa32fa Mon Sep 17 00:00:00 2001
From: Tom Rini <trini@konsulko.com>
Date: Fri, 20 May 2022 12:36:05 -0400
Subject: [PATCH] Convert CONFIG_SPL_SYS_MALLOC_SIMPLE to Kconfig

This converts the following to Kconfig:
   CONFIG_SPL_SYS_MALLOC_SIMPLE

The problem here is that a few platforms have been doing:
#ifdef CONFIG_SPL_BUILD
#define CONFIG_SYS_MALLOC_SIMPLE
#endif

instead of defining CONFIG_SPL_SYS_MALLOC_SIMPLE directly.  Correct this
and update the documentation in a few places to match usage.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
 configs/clearfog_defconfig          | 1 +
 configs/db-88f6720_defconfig        | 1 +
 configs/db-88f6820-amc_defconfig    | 1 +
 configs/db-88f6820-gp_defconfig     | 1 +
 configs/db-mv784mp-gp_defconfig     | 1 +
 configs/ds414_defconfig             | 1 +
 configs/helios4_defconfig           | 1 +
 configs/maxbcm_defconfig            | 1 +
 configs/theadorable_debug_defconfig | 1 +
 configs/x530_defconfig              | 1 +
 doc/develop/driver-model/design.rst | 2 +-
 drivers/core/Kconfig                | 6 +++---
 include/configs/clearfog.h          | 4 ----
 include/configs/controlcenterdc.h   | 4 ----
 include/configs/db-88f6720.h        | 4 ----
 include/configs/db-88f6820-amc.h    | 4 ----
 include/configs/db-88f6820-gp.h     | 4 ----
 include/configs/db-mv784mp-gp.h     | 4 ----
 include/configs/ds414.h             | 4 ----
 include/configs/helios4.h           | 4 ----
 include/configs/maxbcm.h            | 4 ----
 include/configs/theadorable.h       | 4 ----
 include/configs/x530.h              | 4 ----
 23 files changed, 14 insertions(+), 48 deletions(-)

diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig
index 81588c897e..cbdf8f61b1 100644
--- a/configs/clearfog_defconfig
+++ b/configs/clearfog_defconfig
@@ -26,6 +26,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x22fd0
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_I2C=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_CMD_TLV_EEPROM=y
diff --git a/configs/db-88f6720_defconfig b/configs/db-88f6720_defconfig
index 8d48428c22..5970e750a8 100644
--- a/configs/db-88f6720_defconfig
+++ b/configs/db-88f6720_defconfig
@@ -25,6 +25,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x1ffd0
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_I2C=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_CMD_I2C=y
diff --git a/configs/db-88f6820-amc_defconfig b/configs/db-88f6820-amc_defconfig
index 248be49b02..79ed57ce6e 100644
--- a/configs/db-88f6820-amc_defconfig
+++ b/configs/db-88f6820-amc_defconfig
@@ -26,6 +26,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x22fd0
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_I2C=y
 CONFIG_SYS_MAXARGS=96
 # CONFIG_CMD_FLASH is not set
diff --git a/configs/db-88f6820-gp_defconfig b/configs/db-88f6820-gp_defconfig
index 6b7fb83348..dfb6d21635 100644
--- a/configs/db-88f6820-gp_defconfig
+++ b/configs/db-88f6820-gp_defconfig
@@ -25,6 +25,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x22fd0
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_I2C=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_CMD_I2C=y
diff --git a/configs/db-mv784mp-gp_defconfig b/configs/db-mv784mp-gp_defconfig
index 57bed92d4b..8aafb00c9a 100644
--- a/configs/db-mv784mp-gp_defconfig
+++ b/configs/db-mv784mp-gp_defconfig
@@ -25,6 +25,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x1bfd0
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_I2C=y
 CONFIG_SYS_MAXARGS=32
 # CONFIG_CMD_FLASH is not set
diff --git a/configs/ds414_defconfig b/configs/ds414_defconfig
index 64cecace0b..6e4b95eb90 100644
--- a/configs/ds414_defconfig
+++ b/configs/ds414_defconfig
@@ -33,6 +33,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_MAX_SIZE=0x1bfd0
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_I2C=y
 CONFIG_SYS_MAXARGS=32
 # CONFIG_CMD_FLASH is not set
diff --git a/configs/helios4_defconfig b/configs/helios4_defconfig
index 0b7cd74723..626469eb52 100644
--- a/configs/helios4_defconfig
+++ b/configs/helios4_defconfig
@@ -26,6 +26,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x22fd0
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_I2C=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_CMD_TLV_EEPROM=y
diff --git a/configs/maxbcm_defconfig b/configs/maxbcm_defconfig
index 50cf48d2e6..8856d34167 100644
--- a/configs/maxbcm_defconfig
+++ b/configs/maxbcm_defconfig
@@ -24,6 +24,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x1bfd0
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_I2C=y
 CONFIG_SYS_MAXARGS=32
 CONFIG_CMD_I2C=y
diff --git a/configs/theadorable_debug_defconfig b/configs/theadorable_debug_defconfig
index 3834c2b090..7e9d89442c 100644
--- a/configs/theadorable_debug_defconfig
+++ b/configs/theadorable_debug_defconfig
@@ -29,6 +29,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x1bfd0
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_I2C=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_MAXARGS=32
diff --git a/configs/x530_defconfig b/configs/x530_defconfig
index be05d8e433..61f61e4a16 100644
--- a/configs/x530_defconfig
+++ b/configs/x530_defconfig
@@ -29,6 +29,7 @@ CONFIG_MISC_INIT_R=y
 CONFIG_SPL_MAX_SIZE=0x22fd0
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
 CONFIG_SPL_BOARD_INIT=y
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
diff --git a/doc/develop/driver-model/design.rst b/doc/develop/driver-model/design.rst
index 5f33f9fbb3..a75d637ec3 100644
--- a/doc/develop/driver-model/design.rst
+++ b/doc/develop/driver-model/design.rst
@@ -1135,7 +1135,7 @@ constrained systems.
 To enable driver model in SPL, define CONFIG_SPL_DM. You might want to
 consider the following option also. See the main README for more details.
 
-   - CONFIG_SYS_MALLOC_SIMPLE
+   - CONFIG_SPL_SYS_MALLOC_SIMPLE
    - CONFIG_DM_WARN
    - CONFIG_DM_DEVICE_REMOVE
    - CONFIG_DM_STDIO
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index 408a8d8e28..27d6578772 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -15,7 +15,7 @@ config SPL_DM
 	  Enable driver model in SPL. You will need to provide a
 	  suitable malloc() implementation. If you are not using the
 	  full malloc() enabled by CONFIG_SYS_SPL_MALLOC_START,
-	  consider using CONFIG_SYS_MALLOC_SIMPLE. In that case you
+	  consider using CONFIG_SPL_SYS_MALLOC_SIMPLE. In that case you
 	  must provide CONFIG_SPL_SYS_MALLOC_F_LEN to set the size.
 	  In most cases driver model will only allocate a few uclasses
 	  and devices in SPL, so 1KB should be enable. See
@@ -28,7 +28,7 @@ config TPL_DM
 	  Enable driver model in TPL. You will need to provide a
 	  suitable malloc() implementation. If you are not using the
 	  full malloc() enabled by CONFIG_SYS_SPL_MALLOC_START,
-	  consider using CONFIG_SYS_MALLOC_SIMPLE. In that case you
+	  consider using CONFIG_TPL_SYS_MALLOC_SIMPLE. In that case you
 	  must provide CONFIG_SPL_SYS_MALLOC_F_LEN to set the size.
 	  In most cases driver model will only allocate a few uclasses
 	  and devices in SPL, so 1KB should be enough. See
@@ -43,7 +43,7 @@ config VPL_DM
 	  Enable driver model in VPL. You will need to provide a
 	  suitable malloc() implementation. If you are not using the
 	  full malloc() enabled by CONFIG_SYS_SPL_MALLOC_START,
-	  consider using CONFIG_SYS_MALLOC_SIMPLE.
+	  consider using CONFIG_SPL_SYS_MALLOC_SIMPLE.
 
 config DM_WARN
 	bool "Enable warnings in driver model"
diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h
index 22f3749529..b67a31981b 100644
--- a/include/configs/clearfog.h
+++ b/include/configs/clearfog.h
@@ -47,10 +47,6 @@
 
 #define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + CONFIG_SPL_SIZE)
 
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SYS_MALLOC_SIMPLE
-#endif
-
 #define CONFIG_SPL_STACK		(0x40000000 + ((192 - 16) << 10))
 #define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
 
diff --git a/include/configs/controlcenterdc.h b/include/configs/controlcenterdc.h
index 9fafa8fe35..08eb0dbbf9 100644
--- a/include/configs/controlcenterdc.h
+++ b/include/configs/controlcenterdc.h
@@ -39,10 +39,6 @@
 
 #define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + CONFIG_SPL_SIZE)
 
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SYS_MALLOC_SIMPLE
-#endif
-
 #define CONFIG_SPL_STACK		(0x40000000 + ((212 - 16) << 10))
 #define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
 
diff --git a/include/configs/db-88f6720.h b/include/configs/db-88f6720.h
index f8d50d2596..89786044c8 100644
--- a/include/configs/db-88f6720.h
+++ b/include/configs/db-88f6720.h
@@ -37,10 +37,6 @@
 
 #define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + (128 << 10))
 
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SYS_MALLOC_SIMPLE
-#endif
-
 #define CONFIG_SPL_STACK		(0x40000000 + ((192 - 16) << 10))
 #define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
 
diff --git a/include/configs/db-88f6820-amc.h b/include/configs/db-88f6820-amc.h
index 06161e4670..56fd872272 100644
--- a/include/configs/db-88f6820-amc.h
+++ b/include/configs/db-88f6820-amc.h
@@ -44,10 +44,6 @@
 
 #define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + CONFIG_SPL_SIZE)
 
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SYS_MALLOC_SIMPLE
-#endif
-
 #define CONFIG_SPL_STACK		(0x40000000 + ((192 - 16) << 10))
 #define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
 
diff --git a/include/configs/db-88f6820-gp.h b/include/configs/db-88f6820-gp.h
index 6294092f87..0c42ef415d 100644
--- a/include/configs/db-88f6820-gp.h
+++ b/include/configs/db-88f6820-gp.h
@@ -44,10 +44,6 @@
 
 #define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + CONFIG_SPL_SIZE)
 
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SYS_MALLOC_SIMPLE
-#endif
-
 #define CONFIG_SPL_STACK		(0x40000000 + ((192 - 16) << 10))
 #define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
 
diff --git a/include/configs/db-mv784mp-gp.h b/include/configs/db-mv784mp-gp.h
index 14b307343c..4e0563dd5d 100644
--- a/include/configs/db-mv784mp-gp.h
+++ b/include/configs/db-mv784mp-gp.h
@@ -56,10 +56,6 @@
 
 #define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + (128 << 10))
 
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SYS_MALLOC_SIMPLE
-#endif
-
 #define CONFIG_SPL_STACK		(0x40000000 + ((192 - 16) << 10))
 #define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
 
diff --git a/include/configs/ds414.h b/include/configs/ds414.h
index 94b4ebc393..41f72eef4f 100644
--- a/include/configs/ds414.h
+++ b/include/configs/ds414.h
@@ -48,10 +48,6 @@
 
 #define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + (128 << 10))
 
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SYS_MALLOC_SIMPLE
-#endif
-
 #define CONFIG_SPL_STACK		(0x40000000 + ((192 - 16) << 10))
 #define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
 
diff --git a/include/configs/helios4.h b/include/configs/helios4.h
index 3a748ea3b8..aed4d7e8f5 100644
--- a/include/configs/helios4.h
+++ b/include/configs/helios4.h
@@ -47,10 +47,6 @@
 
 #define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + CONFIG_SPL_SIZE)
 
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SYS_MALLOC_SIMPLE
-#endif
-
 #define CONFIG_SPL_STACK		(0x40000000 + ((192 - 16) << 10))
 #define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
 
diff --git a/include/configs/maxbcm.h b/include/configs/maxbcm.h
index a57946fb0f..0eaf08e18c 100644
--- a/include/configs/maxbcm.h
+++ b/include/configs/maxbcm.h
@@ -51,10 +51,6 @@
 
 #define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + (128 << 10))
 
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SYS_MALLOC_SIMPLE
-#endif
-
 #define CONFIG_SPL_STACK		(0x40000000 + ((192 - 16) << 10))
 #define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
 
diff --git a/include/configs/theadorable.h b/include/configs/theadorable.h
index dbc358d9d8..8e13b47eab 100644
--- a/include/configs/theadorable.h
+++ b/include/configs/theadorable.h
@@ -76,10 +76,6 @@
 
 #define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + (128 << 10))
 
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SYS_MALLOC_SIMPLE
-#endif
-
 #define CONFIG_SPL_STACK		(0x40000000 + ((192 - 16) << 10))
 #define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
 
diff --git a/include/configs/x530.h b/include/configs/x530.h
index 6218291c56..5065eb87a3 100644
--- a/include/configs/x530.h
+++ b/include/configs/x530.h
@@ -71,10 +71,6 @@
 
 #define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + CONFIG_SPL_SIZE)
 
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SYS_MALLOC_SIMPLE
-#endif
-
 #define CONFIG_SPL_STACK		(0x40000000 + ((192 - 16) << 10))
 #define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
 
-- 
2.39.5