diff mbox series

[2/3] spi: Make of_find_spi_controller_by_node visible

Message ID 20190412050213.17698-3-chris.packham@alliedtelesis.co.nz (mailing list archive)
State New, archived
Headers show
Series spi: SPI bus multiplexer | expand

Commit Message

Chris Packham April 12, 2019, 5:02 a.m. UTC
Drop the static and add of_find_spi_controller_by_node() to spi.h. Also
move it outside of the CONFIG_OF_DYNAMIC so it is available with just
CONFIG_OF.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 drivers/spi/spi.c       | 7 ++++---
 include/linux/spi/spi.h | 7 +++++++
 2 files changed, 11 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 93986f879b09..19929163a45b 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -3531,16 +3531,14 @@  struct spi_device *of_find_spi_device_by_node(struct device_node *node)
 	return dev ? to_spi_device(dev) : NULL;
 }
 EXPORT_SYMBOL_GPL(of_find_spi_device_by_node);
-#endif /* IS_ENABLED(CONFIG_OF) */
 
-#if IS_ENABLED(CONFIG_OF_DYNAMIC)
 static int __spi_of_controller_match(struct device *dev, const void *data)
 {
 	return dev->of_node == data;
 }
 
 /* the spi controllers are not using spi_bus, so we find it with another way */
-static struct spi_controller *of_find_spi_controller_by_node(struct device_node *node)
+struct spi_controller *of_find_spi_controller_by_node(struct device_node *node)
 {
 	struct device *dev;
 
@@ -3555,7 +3553,10 @@  static struct spi_controller *of_find_spi_controller_by_node(struct device_node
 	/* reference got in class_find_device */
 	return container_of(dev, struct spi_controller, dev);
 }
+EXPORT_SYMBOL_GPL(of_find_spi_controller_by_node);
+#endif /* IS_ENABLED(CONFIG_OF) */
 
+#if IS_ENABLED(CONFIG_OF_DYNAMIC)
 static int of_spi_notify(struct notifier_block *nb, unsigned long action,
 			 void *arg)
 {
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 662b336aa2e4..e763290767ea 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -1334,6 +1334,8 @@  spi_transfer_is_last(struct spi_controller *ctlr, struct spi_transfer *xfer)
 extern struct spi_device *
 of_find_spi_device_by_node(struct device_node *node);
 
+extern struct spi_controller *
+of_find_spi_controller_by_node(struct device_node *node);
 #else
 
 static inline struct spi_device *
@@ -1342,6 +1344,11 @@  of_find_spi_device_by_node(struct device_node *node)
 	return NULL;
 }
 
+static inline struct spi_controller *
+of_find_spi_controller_by_node(struct device_node *node)
+{
+	return NULL;
+}
 #endif /* IS_ENABLED(CONFIG_OF) */
 
 /* Compatibility layer */