Re: [PATCH 03/10] spi: switch to using class_find_device_by_fwnode()

Mark Brown <[email protected]> Mon, 23 Mar 2026 17:16:04 +0000
Newsgroups org.kernel.vger.linux-fpga,dev.linux.lists.driver-core,org.infradead.lists.linux-phy,org.kernel.vger.linux-kernel,org.kernel.vger.linux-leds,org.kernel.vger.linux-spi,org.kernel.vger.netdev
Message-ID <[email protected]>
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.
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmnBdVMACgkQJNaLcl1U
h9AZpwf+IYUP90323AiTlXT8gw1Dypm0TDgs0IOfZCsY6eI2ifZgGPN9bmjL/nqn
qOCQnievL6WWoQiEOvgXsLRJl9rBwFIoqSVqZ5KSwziQt3eVC1C8h2BBG1RRNUTs
iAN2o35mqWmLWMjutA6YleGKMYmsZYLPhv47Bn89wSF5X2/KO2oAUR3pc4t1UZwV
iB4S4xXHm268iBSZduYC+IqDTV8Dd6HABhODhHHz96h17qZlzPM64vxVlOU30dlc
QEHhAL5tfwE+km7QmFrPh176jDVmndTGdXRJbtRICsUHDLuIPIjeuCFwom9RyzhN
v8Jk4nJOfxCXEkLHHAlP8AtJaBLsrw==
=ncpO
-----END PGP SIGNATURE-----