Re: [PATCH v18 1/2] fpga: lattice-sysconfig-spi: add Lattice sysCONFIG FPGA manager

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

 



On 2022-10-14 at 23:27:49 +0300, Ivan Bornyakov wrote:
> Add support to the FPGA manager for programming Lattice ECP5 FPGA over
> slave SPI sysCONFIG interface.
> 
> sysCONFIG interface core functionality is separate from both ECP5 and
> SPI specifics, so support for other FPGAs with different port types can
> be added in the future.
> 
> Signed-off-by: Ivan Bornyakov <i.bornyakov@xxxxxxxxxxx>
> ---

[...]

> +static int sysconfig_poll_gpio(struct gpio_desc *gpio, bool is_active)
> +{
> +	int ret, val;
> +
> +	ret = read_poll_timeout(gpiod_get_value, val, val < 0 ||
> +				(val && is_active) || (!val && !is_active),

val < 0 || (!!val == is_active)

is it better?

> +				SYSCONFIG_POLL_INTERVAL_US,
> +				SYSCONFIG_POLL_GPIO_TIMEOUT_US, false, gpio);
> +
> +	return val < 0 ? val : ret;

Try not to use ternery operator here.

  if (ret)
	return ret;
  else if (val < 0)
	return val;

  return 0;

Is it OK?

Thanks,
Yilun



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux