[PATCH 3/9] _exports.h: simplify condition for including spi functions

Rasmus Villemoes ravi at prevas.dk
Fri Sep 19 12:09:56 CEST 2025


As for the i2c functions, drop the dummy entries that, if ever used,
would just have the standalone app get some random content in the
return register.

While deprecated, the spi_{setup,free}_slave functions do exist even
with CONFIG_DM_SPI - and a standalone app can't really do anything but
refer to a spi device via a (bus, cs) pair.

Eventually, one should probably export some function that could allow
a standalone app to get a struct udevice* corresponding to either a
full DT path, an alias, or perhaps a label (provided one builds with
-@), and then export functions that can operate on that.

Signed-off-by: Rasmus Villemoes <ravi at prevas.dk>
---
 include/_exports.h | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/include/_exports.h b/include/_exports.h
index 39278a34942..c1511903088 100644
--- a/include/_exports.h
+++ b/include/_exports.h
@@ -47,19 +47,10 @@
 	EXPORT_FUNC(i2c_read, int, i2c_read, uchar, uint, int , uchar * , int)
 #endif
 
-#if !defined(CONFIG_CMD_SPI) || defined(CONFIG_DM_SPI)
-	EXPORT_FUNC(dummy, void, spi_setup_slave, void)
-	EXPORT_FUNC(dummy, void, spi_free_slave, void)
-#else
+#if defined(CONFIG_CMD_SPI)
 	EXPORT_FUNC(spi_setup_slave, struct spi_slave *, spi_setup_slave,
 		    unsigned int, unsigned int, unsigned int, unsigned int)
 	EXPORT_FUNC(spi_free_slave, void, spi_free_slave, struct spi_slave *)
-#endif
-#ifndef CONFIG_CMD_SPI
-	EXPORT_FUNC(dummy, void, spi_claim_bus, void)
-	EXPORT_FUNC(dummy, void, spi_release_bus, void)
-	EXPORT_FUNC(dummy, void, spi_xfer, void)
-#else
 	EXPORT_FUNC(spi_claim_bus, int, spi_claim_bus, struct spi_slave *)
 	EXPORT_FUNC(spi_release_bus, void, spi_release_bus, struct spi_slave *)
 	EXPORT_FUNC(spi_xfer, int, spi_xfer, struct spi_slave *,
-- 
2.51.0



More information about the U-Boot mailing list