Re: [PATCH 03/10] spi: switch to using class_find_device_by_fwnode()
From: Mark Brown
Date: Mon Mar 23 2026 - 14:09:20 EST
On Sun, Mar 22, 2026 at 06:54:21PM -0700, Dmitry Torokhov wrote:
> In preparation to class_find_device_by_of_node() going away switch to
> using class_find_device_by_fwnode().
> 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;
Actually, no - this just looks weird. We're in the middle of an OF
specific function but we're having to jump up to fwnode for no apparent
reason. If we actually decide to get rid of the OF specific function
then I guess but I'm really not convinced this is an improvement in
isolation.
Attachment:
signature.asc
Description: PGP signature