summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-09-07 05:27:12 +0300
committerTom Rini <trini@konsulko.com>2022-09-29 23:11:14 +0300
commit1701359f752b9622752df6a6c6a1326c225a5616 (patch)
tree7bdc9520706948180e781da76345becbc39d7e7c /include
parent8d468a188f69424b3461ba681a26b95bb9679f53 (diff)
downloadu-boot-1701359f752b9622752df6a6c6a1326c225a5616.tar.xz
dm: core: Reduce code size with dev_of_offset()
Update the function to mark it with the const attribute. Also avoid calling it multiple times in the devfdt_get_addr_index() function. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/dm/device.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/dm/device.h b/include/dm/device.h
index 12c6ba37ff..f3f953c9af 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -253,7 +253,7 @@ static inline void dev_bic_flags(struct udevice *dev, u32 bic)
* @dev: device to check
* Return: reference of the device's DT node
*/
-static inline ofnode dev_ofnode(const struct udevice *dev)
+static inline __attribute_const__ ofnode dev_ofnode(const struct udevice *dev)
{
#if CONFIG_IS_ENABLED(OF_REAL)
return dev->node_;
@@ -273,7 +273,7 @@ static inline ofnode dev_ofnode(const struct udevice *dev)
#define dev_get_dma_offset(_dev) 0
#endif
-static inline int dev_of_offset(const struct udevice *dev)
+static inline __attribute_const__ int dev_of_offset(const struct udevice *dev)
{
#if CONFIG_IS_ENABLED(OF_REAL)
return ofnode_to_offset(dev_ofnode(dev));
@@ -282,7 +282,7 @@ static inline int dev_of_offset(const struct udevice *dev)
#endif
}
-static inline bool dev_has_ofnode(const struct udevice *dev)
+static inline __attribute_const__ bool dev_has_ofnode(const struct udevice *dev)
{
#if CONFIG_IS_ENABLED(OF_REAL)
return ofnode_valid(dev_ofnode(dev));