diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 4970d43952db41154a192db253bbd5c39b637ea7..54727ef005d6cb02e525dbf0d1c7b4a72f156f7d 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -38,6 +38,7 @@
 #include <linux/of.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
+#include <linux/irq.h>
 #include <linux/irqdomain.h>
 
 #include <linux/regulator/machine.h>
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 242fa3563e2ee0073f72af7ad2e74093d939581e..b47d2040c9f23a0dfa3599de4d4212a41122422e 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -94,7 +94,12 @@ extern int of_platform_populate(struct device_node *root,
 				const struct of_device_id *matches,
 				const struct of_dev_auxdata *lookup,
 				struct device *parent);
-#else
+#endif /* CONFIG_OF_ADDRESS */
+
+#endif /* CONFIG_OF_DEVICE */
+
+#if !defined(CONFIG_OF_ADDRESS)
+struct of_dev_auxdata;
 static inline int of_platform_populate(struct device_node *root,
 					const struct of_device_id *matches,
 					const struct of_dev_auxdata *lookup,
@@ -104,6 +109,4 @@ static inline int of_platform_populate(struct device_node *root,
 }
 #endif /* !CONFIG_OF_ADDRESS */
 
-#endif /* CONFIG_OF_DEVICE */
-
 #endif	/* _LINUX_OF_PLATFORM_H */