of_mtd: Add no-op stubs to support CONFIG_OF=n

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed Nov 13 13:59:02 EST 2013


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=a6eaa2ae7820f0cca742917f85f34ef1eed2c95d
Commit:     a6eaa2ae7820f0cca742917f85f34ef1eed2c95d
Parent:     d41f950e27f0e155d0118e71403d2bd564d94787
Author:     Ezequiel Garcia <ezequiel.garcia at free-electrons.com>
AuthorDate: Mon Sep 2 23:37:53 2013 -0300
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Sun Oct 27 16:26:58 2013 -0700

    of_mtd: Add no-op stubs to support CONFIG_OF=n
    
    Just like the rest of the subsystems, let's add the required no-op
    functions to implement stubs when CONFIG_OF=n.
    
    This prevents MTD drivers from having ugly ifdefs in their code,
    and instead hide the ifdef monster in the header closet (far away
    from people's sight).
    
    Signed-off-by: Ezequiel Garcia <ezequiel.garcia at free-electrons.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 include/linux/of_mtd.h | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h
index ed7f267..6f10e93 100644
--- a/include/linux/of_mtd.h
+++ b/include/linux/of_mtd.h
@@ -10,10 +10,29 @@
 #define __LINUX_OF_NET_H
 
 #ifdef CONFIG_OF_MTD
+
 #include <linux/of.h>
 int of_get_nand_ecc_mode(struct device_node *np);
 int of_get_nand_bus_width(struct device_node *np);
 bool of_get_nand_on_flash_bbt(struct device_node *np);
-#endif
+
+#else /* CONFIG_OF_MTD */
+
+static inline int of_get_nand_ecc_mode(struct device_node *np)
+{
+	return -ENOSYS;
+}
+
+static inline int of_get_nand_bus_width(struct device_node *np)
+{
+	return -ENOSYS;
+}
+
+static inline bool of_get_nand_on_flash_bbt(struct device_node *np)
+{
+	return false;
+}
+
+#endif /* CONFIG_OF_MTD */
 
 #endif /* __LINUX_OF_MTD_H */



More information about the linux-mtd-cvs mailing list