[PATCH 03/10] spi: switch to using class_find_device_by_fwnode()
From: Dmitry Torokhov
Date: Sun Mar 22 2026 - 21:57:09 EST
In preparation to class_find_device_by_of_node() going away switch to
using class_find_device_by_fwnode().
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
drivers/spi/spi.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index bf1df365f795..071a9ffdb59d 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -21,6 +21,7 @@
#include <linux/kthread.h>
#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
+#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_irq.h>
#include <linux/percpu.h>
@@ -4948,11 +4949,12 @@ EXPORT_SYMBOL_GPL(spi_write_then_read);
/* 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)
{
+ struct fwnode_handle *fwnode = of_fwnode_handle(node);
struct device *dev;
- dev = class_find_device_by_of_node(&spi_controller_class, node);
+ dev = class_find_device_by_fwnode(&spi_controller_class, fwnode);
if (!dev && IS_ENABLED(CONFIG_SPI_SLAVE))
- dev = class_find_device_by_of_node(&spi_target_class, node);
+ dev = class_find_device_by_fwnode(&spi_target_class, fwnode);
if (!dev)
return NULL;
--
2.53.0.959.g497ff81fa9-goog