[PATCH] mtd: consult CONFIG_OFDEVICE in mtd_get_of_node
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Jan 9 07:08:13 PST 2023
Get barebox on non-DT platforms with NAND a tiny bit smaller by using
dev_of_node: The helper will return NULL unconditionally when
CONFIG_OFDEVICE is not enabled, thereby allowing more code to be
discarded at compile-time in absence of link-time optimization.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
include/linux/mtd/mtd.h | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 6b539a9eceb5..2824853e2954 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -293,11 +293,7 @@ static inline void mtd_set_of_node(struct mtd_info *mtd,
static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd)
{
- if (mtd->dev.of_node)
- return mtd->dev.of_node;
- if (mtd->dev.parent)
- return mtd->dev.parent->of_node;
- return NULL;
+ return dev_of_node(&mtd->dev) ?: dev_of_node(mtd->dev.parent);
}
static inline u32 mtd_oobavail(struct mtd_info *mtd, struct mtd_oob_ops *ops)
--
2.30.2
More information about the barebox
mailing list