summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2022-04-19 08:14:15 -0400
committerTom Rini <[email protected]>2022-04-19 08:14:15 -0400
commitaec75a3d1d8ad9268881c8e9d03bc205b5063848 (patch)
tree3a1b5cdaf53927f248bace6f6face7155788687f /include
parent9859465bfe838bc8264d45e1a1bed847bba74bad (diff)
parentcdd73e7215b838095984f02554fc1bc4186124af (diff)
Merge branch '2022-04-18-dm-reducing-spl-memory-usage'
- Assorted DM cleanups from Simon. This results in some noticeable binary size savings in SPL.
Diffstat (limited to 'include')
-rw-r--r--include/dm/device-internal.h6
-rw-r--r--include/dm/device.h10
-rw-r--r--include/dm/devres.h4
3 files changed, 14 insertions, 6 deletions
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index e24b0336409..94844d30d85 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -397,7 +397,7 @@ fdt_addr_t simple_bus_translate(struct udevice *dev, fdt_addr_t addr);
#define DM_UCLASS_ROOT_S_NON_CONST (((gd_t *)gd)->uclass_root_s)
/* device resource management */
-#ifdef CONFIG_DEVRES
+#if CONFIG_IS_ENABLED(DEVRES)
/**
* devres_release_probe - Release managed resources allocated after probing
@@ -417,7 +417,7 @@ void devres_release_probe(struct udevice *dev);
*/
void devres_release_all(struct udevice *dev);
-#else /* ! CONFIG_DEVRES */
+#else /* ! DEVRES */
static inline void devres_release_probe(struct udevice *dev)
{
@@ -427,7 +427,7 @@ static inline void devres_release_all(struct udevice *dev)
{
}
-#endif /* ! CONFIG_DEVRES */
+#endif /* DEVRES */
static inline int device_notify(const struct udevice *dev, enum event_t type)
{
diff --git a/include/dm/device.h b/include/dm/device.h
index cb52a0997c8..e0f86f5df9f 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -184,7 +184,7 @@ struct udevice {
#if CONFIG_IS_ENABLED(OF_REAL)
ofnode node_;
#endif
-#ifdef CONFIG_DEVRES
+#if CONFIG_IS_ENABLED(DEVRES)
struct list_head devres_head;
#endif
#if CONFIG_IS_ENABLED(DM_DMA)
@@ -192,6 +192,14 @@ struct udevice {
#endif
};
+static inline int dm_udevice_size(void)
+{
+ if (CONFIG_IS_ENABLED(OF_PLATDATA_RT))
+ return ALIGN(sizeof(struct udevice), CONFIG_LINKER_LIST_ALIGN);
+
+ return sizeof(struct udevice);
+}
+
/**
* struct udevice_rt - runtime information set up by U-Boot
*
diff --git a/include/dm/devres.h b/include/dm/devres.h
index 0ab277ec38e..697534aa5be 100644
--- a/include/dm/devres.h
+++ b/include/dm/devres.h
@@ -30,7 +30,7 @@ struct devres_stats {
int total_size;
};
-#ifdef CONFIG_DEVRES
+#if CONFIG_IS_ENABLED(DEVRES)
#ifdef CONFIG_DEBUG_DEVRES
void *__devres_alloc(dr_release_t release, size_t size, gfp_t gfp,
@@ -207,7 +207,7 @@ void devm_kfree(struct udevice *dev, void *ptr);
/* Get basic stats on allocations */
void devres_get_stats(const struct udevice *dev, struct devres_stats *stats);
-#else /* ! CONFIG_DEVRES */
+#else /* ! DEVRES */
static inline void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp)
{