Re: [PATCH 3/3] spi: add ACPI support for SPI controller chip select lines(cs-gpios)

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

 



On Mon, Dec 03, 2018 at 11:15:51AM +0800, Jay Fang wrote:

> -static int of_spi_register_master(struct spi_controller *ctlr)
> -{
> +	if (IS_ENABLED(CONFIG_OF) && np) {
> +		for (i = 0; i < nb; i++)
> +			cs[i] = of_get_named_gpio(np, "cs-gpios", i);
> +	} else if (IS_ENABLED(CONFIG_ACPI) && ACPI_HANDLE(&ctlr->dev)) {
> +		for (i = 0; i < nb; i++) {
> +			desc = devm_gpiod_get_index(&ctlr->dev, "cs",
> +						    i, GPIOD_ASIS);
> +			if (IS_ERR(desc))
> +				continue;
> +			cs[i] = desc_to_gpio(desc);
> +		}
> +	}
>  	return 0;

Given that both properties are called "cs" won't devm_gpiod_get_index()
do the right thing for DT systems as well as ACPI allowing us to move
entirely to descriptors and remove the need for separate code paths here?

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [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