Re: [PATCH v3 2/3] spi: Add a mechanism to use the fwnode name for the SPI device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fri, Mar 29, 2024 at 11:47:29AM +0000, Charles Keepax kirjoitti:
> Add a mechanism to force the use of the fwnode name for the name of the
> SPI device itself. This is useful when devices need to be manually added
> within the kernel.

...

>  static void spi_dev_set_name(struct spi_device *spi)
>  {
>  	struct acpi_device *adev = ACPI_COMPANION(&spi->dev);
> +	struct fwnode_handle *fwnode = dev_fwnode(&spi->dev);
> +
> +	if (spi->use_fwnode_name && fwnode) {
> +		dev_set_name(&spi->dev, "spi-%s", fwnode_get_name(fwnode));
> +		return;
> +	}
>  
>  	if (adev) {
>  		dev_set_name(&spi->dev, "spi-%s", acpi_dev_name(adev));

This should be something like this

	struct device *dev = &spi->dev;
	struct fwnode_handle *fwnode = dev_fwnode(dev);

	if (is_acpi_device_node(fwnode)) {
		dev_set_name(dev, "spi-%s", acpi_dev_name(to_acpi_device_node(fwnode)));
		return;
	}

	if (is_software_node(fwnode)) {
		dev_set_name(dev, "spi-%s", fwnode_get_name(fwnode));
		return;
	}

i.o.w. we don't need to have two ways of checking fwnode type and you may get
rid of unneeded variable, and always use fwnode name for swnode.

...

> +	proxy->use_fwnode_name = chip->use_fwnode_name;

Unneeded variable. See above.

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux