/*-------------------------------------------------------------------------*/
-#if IS_ENABLED(CONFIG_OF_DYNAMIC)
-/* Must call put_device() when done with returned spi_device device */
-static struct spi_device *of_find_spi_device_by_node(struct device_node *node)
-{
- struct device *dev = bus_find_device_by_of_node(&spi_bus_type, node);
-
- return dev ? to_spi_device(dev) : NULL;
-}
-
+#if IS_ENABLED(CONFIG_OF)
/* The spi controllers are not using spi_bus, so we find it with another way */
struct spi_controller *of_find_spi_controller_by_node(struct device_node *node)
{
return container_of(dev, struct spi_controller, dev);
}
EXPORT_SYMBOL_GPL(of_find_spi_controller_by_node);
+#endif
+
+#if IS_ENABLED(CONFIG_OF_DYNAMIC)
+/* Must call put_device() when done with returned spi_device device */
+static struct spi_device *of_find_spi_device_by_node(struct device_node *node)
+{
+ struct device *dev = bus_find_device_by_of_node(&spi_bus_type, node);
+
+ return dev ? to_spi_device(dev) : NULL;
+}
static int of_spi_notify(struct notifier_block *nb, unsigned long action,
void *arg)
struct spi_controller *ctlr);
extern void spi_unregister_controller(struct spi_controller *ctlr);
-#if IS_ENABLED(CONFIG_OF_DYNAMIC)
+#if IS_ENABLED(CONFIG_OF)
extern struct spi_controller *of_find_spi_controller_by_node(struct device_node *node);
#else
static inline struct spi_controller *of_find_spi_controller_by_node(struct device_node *node)