[Concept,3/5] Kconfig: Rename API to LEGACY_API

Message ID 20250905131816.3344908-4-sjg@u-boot.org
State New
Headers
Series api: Deprecate the API |

Commit Message

Simon Glass Sept. 5, 2025, 1:18 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Update Kconfig use use CONFIG_LEGACY_API since the API is now
deprecated.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 Makefile             |  2 +-
 common/board_r.c     |  4 ++--
 examples/Makefile    |  2 +-
 include/net-common.h |  2 +-
 include/net-legacy.h |  2 +-
 legacy_api/Kconfig   | 22 +++++++++++++---------
 legacy_api/README    |  2 +-
 net/lwip/net-lwip.c  |  4 ++--
 net/net.c            |  4 ++--
 9 files changed, 24 insertions(+), 20 deletions(-)
  

Patch

diff --git a/Makefile b/Makefile
index 088de1d1de4..7011535bb2f 100644
--- a/Makefile
+++ b/Makefile
@@ -865,7 +865,7 @@  c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
 
 HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
 
-libs-$(CONFIG_API) += legacy_api/
+libs-$(CONFIG_LEGACY_API) += legacy_api/
 libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
 libs-y += boot/
 libs-$(CONFIG_CMDLINE) += cmd/
diff --git a/common/board_r.c b/common/board_r.c
index a141312f918..1bb0eb37e9b 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -686,8 +686,8 @@  static void initcall_run_r(void)
 #endif
 	INITCALL(stdio_add_devices);
 	INITCALL(jumptable_init);
-#if CONFIG_IS_ENABLED(API)
-	INITCALL(api_init);
+#if CONFIG_IS_ENABLED(LEGACY_API)
+	INITCALL(legacy_api_init);
 #endif
 	INITCALL(console_init_r);	/* fully init console as a device */
 #if CONFIG_IS_ENABLED(DISPLAY_BOARDINFO_LATE)
diff --git a/examples/Makefile b/examples/Makefile
index bf518bd221b..bf51f1a5018 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -7,5 +7,5 @@  subdir-ccflags-y += -finstrument-functions -DFTRACE
 endif
 
 subdir-y += standalone
-subdir-$(CONFIG_API) += api
+subdir-$(CONFIG_LEGACY_API) += api
 endif
diff --git a/include/net-common.h b/include/net-common.h
index 0829e05f94b..9d26c26cf5f 100644
--- a/include/net-common.h
+++ b/include/net-common.h
@@ -198,7 +198,7 @@  int usb_ether_init(void);
 int eth_init(void);			/* Initialize the device */
 int eth_start_udev(struct udevice *dev); /* ->start() if not already running */
 int eth_send(void *packet, int length);	   /* Send a packet */
-#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER)
+#if defined(CONFIG_LEGACY_API) || defined(CONFIG_EFI_LOADER)
 int eth_receive(void *packet, int length); /* Receive a packet*/
 extern void (*push_packet)(void *packet, int length);
 #endif
diff --git a/include/net-legacy.h b/include/net-legacy.h
index a7dbcec1506..41a898bb7d1 100644
--- a/include/net-legacy.h
+++ b/include/net-legacy.h
@@ -105,7 +105,7 @@  int eth_env_get_enetaddr_by_index(const char *base_name, int index,
 
 int eth_send(void *packet, int length);	   /* Send a packet */
 
-#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER)
+#if defined(CONFIG_LEGACY_API) || defined(CONFIG_EFI_LOADER)
 int eth_receive(void *packet, int length); /* Receive a packet*/
 extern void (*push_packet)(void *packet, int length);
 #endif
diff --git a/legacy_api/Kconfig b/legacy_api/Kconfig
index b58f293107f..6dc96455ff0 100644
--- a/legacy_api/Kconfig
+++ b/legacy_api/Kconfig
@@ -1,23 +1,27 @@ 
-config API
-	bool "Enable U-Boot API"
+config LEGACY_API
+	bool "Enable Legacy U-Boot API"
 	depends on CC_IS_GCC
 	help
-	  This option enables the U-Boot API. See api/README for more information.
+	  This option enables the legcay U-Boot API. See legacy_api/README for
+	  more information.
 
-menu "API"
-	depends on API
+	  Note that this is deprecated and not intended to be used. It will be
+	  removed by the end of 2027.
+
+menu "LEGACY API"
+	depends on LEGACY_API
 
 config SYS_MMC_MAX_DEVICE
-	int  "Maximum number of MMC devices exposed via the API"
+	int  "Maximum number of MMC devices exposed via the legacy API"
 	default 1
 
 config EXAMPLES
-	bool "Compile API examples"
+	bool "Compile legacy API examples"
 	depends on !SANDBOX
 	default y if ARCH_QEMU_ARM
 	help
-	  U-Boot provides an API for standalone applications. Examples are
-	  provided in directory examples/.
+	  U-Boot provides an legacy API for standalone applications. Examples
+	  are provided in directory examples/.
 
 config STANDALONE_LOAD_ADDR
 	depends on EXAMPLES
diff --git a/legacy_api/README b/legacy_api/README
index 6df225f584b..e635735f689 100644
--- a/legacy_api/README
+++ b/legacy_api/README
@@ -24,7 +24,7 @@  U-Boot machine/arch independent API for external apps
     for example it doesn't keep states, but relies on hints from the app and
     so on
 
-  - optional (CONFIG_API)
+  - optional (CONFIG_LEGACY_API)
 
 
 2. Calls
diff --git a/net/lwip/net-lwip.c b/net/lwip/net-lwip.c
index 2cc5749d459..bf3bdd6f950 100644
--- a/net/lwip/net-lwip.c
+++ b/net/lwip/net-lwip.c
@@ -18,7 +18,7 @@ 
 /* xx:xx:xx:xx:xx:xx\0 */
 #define MAC_ADDR_STRLEN 18
 
-#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER)
+#if defined(CONFIG_LEGACY_API) || defined(CONFIG_EFI_LOADER)
 void (*push_packet)(void *, int len) = 0;
 #endif
 static int net_try_count;
@@ -303,7 +303,7 @@  int net_lwip_rx(struct udevice *udev, struct netif *netif)
 
 void net_process_received_packet(uchar *in_packet, int len)
 {
-#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER)
+#if defined(CONFIG_LEGACY_API) || defined(CONFIG_EFI_LOADER)
 	if (push_packet)
 		(*push_packet)(in_packet, len);
 #endif
diff --git a/net/net.c b/net/net.c
index 7b9fc3fb0df..d2a698aea2f 100644
--- a/net/net.c
+++ b/net/net.c
@@ -158,7 +158,7 @@  static unsigned	net_ip_id;
 /* Ethernet bcast address */
 const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 const u8 net_null_ethaddr[6];
-#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER)
+#if defined(CONFIG_LEGACY_API) || defined(CONFIG_EFI_LOADER)
 void (*push_packet)(void *, int len) = 0;
 #endif
 /* Network loop state */
@@ -1248,7 +1248,7 @@  void net_process_received_packet(uchar *in_packet, int len)
 	if (len < ETHER_HDR_SIZE)
 		return;
 
-#if defined(CONFIG_API) || defined(CONFIG_EFI_LOADER)
+#if defined(CONFIG_LEGACY_API) || defined(CONFIG_EFI_LOADER)
 	if (push_packet) {
 		(*push_packet)(in_packet, len);
 		return;