@@ -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)
{
@@ -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 */
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(-)