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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 12 May 2023 12:40:28 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     zhuyinbo <zhuyinbo@...ngson.cn>
Cc:     Mark Brown <broonie@...nel.org>, Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        linux-spi@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, Jianmin Lv <lvjianmin@...ngson.cn>,
        wanghongliang@...ngson.cn, Liu Peibao <liupeibao@...ngson.cn>,
        loongson-kernel@...ts.loongnix.cn
Subject: Re: [PATCH v9 2/2] spi: loongson: add bus driver for the loongson spi controller

On Fri, May 12, 2023 at 11:12 AM zhuyinbo <zhuyinbo@...ngson.cn> wrote:
> 在 2023/5/10 下午3:03, Andy Shevchenko 写道:

...

> so, I think it is better
> to confiure clk and mode separately.

Agree, but at the same time you can split the conditional bodies to
the separate functions. In this case the indentation of each of them
can be decreased.

...

> > Also the check can be modified to have less indented code:
> >
> >         if (hz && loongson_spi->hz == hz)
> >            return 0;
> >
> >         if (!((spi->mode ^ loongson_spi->mode) & SPI_MODE_X_MASK))
> >            return 0;
>
> The setting register about clk and mode was the same SPCR register, so
> only the clk and mode don't need to be updated in the same, then return
> 0, so the code seems to be as follows. But setting clk and mode
> separately doesn't require follows judgement.
>
>          if ((hz && loongson_spi->hz == hz) &&
>              !((spi->mode ^ loongson_spi->mode) & SPI_MODE_X_MASK))
>                  return 0;

Correct, sorry for the mistake I made.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ