[RFC PATCH 40/57] drivers: spi: Use class_find_device_by_of_node helper

Suzuki K Poulose
2019-06-03T15:53:26Z

Use the generic helper to find a device matching the of_node.

Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
drivers/spi/spi.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 5224ded..e1295e9 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -3549,21 +3549,14 @@ 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 device *dev;

- dev = class_find_device(&spi_master_class, NULL, node,
- __spi_of_controller_match);
+ dev = class_find_device_by_of_node(&spi_master_class, NULL, node);
if (!dev && IS_ENABLED(CONFIG_SPI_SLAVE))
- dev = class_find_device(&spi_slave_class, NULL, node,
- __spi_of_controller_match);
+ dev = class_find_device_by_of_node(&spi_slave_class, NULL, node);
if (!dev)
return NULL;

--
2.7.4