lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 19 Oct 2022 12:54:14 +0800
From:   Xu Yilun <yilun.xu@...el.com>
To:     Ivan Bornyakov <i.bornyakov@...rotek.ru>
Cc:     mdf@...nel.org, hao.wu@...el.com, trix@...hat.com, dg@...ix.com,
        j.zink@...gutronix.de, robh+dt@...nel.org,
        krzysztof.kozlowski+dt@...aro.org, linux-fpga@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel@...gutronix.de, system@...rotek.ru
Subject: Re: [PATCH v18 1/2] fpga: lattice-sysconfig-spi: add Lattice
 sysCONFIG FPGA manager

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@...rotek.ru>
> ---

[...]

> +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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ