Re: [PATCH v9 2/2] spi: loongson: add bus driver for the loongson spi controller

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

 



On Fri, May 12, 2023 at 11:12 AM zhuyinbo <zhuyinbo@xxxxxxxxxxx> 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




[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