2022-02-09 18:13:07

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 3/3] spi: amd: Add support for version AMDI0062

On Wed, Feb 09, 2022 at 02:18:59PM -0300, Andr? Almeida wrote:
> ?s 14:14 de 09/02/22, Mark Brown escreveu:

> >> +
> >> + if (amd_spi->version == AMD_SPI_V2)
> >> + amd_spi_clear_chip(amd_spi, message->spi->chip_select);
> >> spi_finalize_current_message(master);
> >>
> >> return 0;

> > Why is this one not a switch statement - what happens with v3?

> A switch statement should work as well, but currently v1 does nothing
> and there's no v3 for now. I think we can change for a switch if v3
> requires to do something here as well.

Please write it in an extensible fashion now so people aren't tempted to
add an if/else tree.


Attachments:
(No filename) (657.00 B)
signature.asc (499.00 B)
Download all attachments

2022-02-09 19:21:09

by André Almeida

[permalink] [raw]
Subject: Re: [PATCH 3/3] spi: amd: Add support for version AMDI0062

Às 14:28 de 09/02/22, Mark Brown escreveu:
> On Wed, Feb 09, 2022 at 02:18:59PM -0300, André Almeida wrote:
>> Às 14:14 de 09/02/22, Mark Brown escreveu:
>
>>>> +
>>>> + if (amd_spi->version == AMD_SPI_V2)
>>>> + amd_spi_clear_chip(amd_spi, message->spi->chip_select);
>>>> spi_finalize_current_message(master);
>>>>
>>>> return 0;
>
>>> Why is this one not a switch statement - what happens with v3?
>
>> A switch statement should work as well, but currently v1 does nothing
>> and there's no v3 for now. I think we can change for a switch if v3
>> requires to do something here as well.
>
> Please write it in an extensible fashion now so people aren't tempted to
> add an if/else tree.

Got it, I will fix it for the next patch version, thanks!