Re: [PATCH v2 1/2] mtd: spi-nor: Move m25p80 code in spi-nor.c
Date: Thu Jul 25 2019 - 14:06:39 EST
On 07/25/2019 04:17 PM, Tudor Ambarus wrote:
>>>> +static ssize_t spi_nor_spimem_xfer_data(struct spi_nor *nor,
>>>> + struct spi_mem_op *op,
>>>> + enum spi_nor_protocol proto)
>>>> + bool usebouncebuf = false;
>>> declare bool at the end to avoid stack padding.
>> But it breaks the reverse-xmas-tree formatting :-).
>>>> + void *rdbuf = NULL;
>>>> + const void *buf;
>>> you can get rid of rdbuf and buf if you pass buf as argument.
>> Hm, passing the buffer to send data from/receive data into is already
>> part of the spi_mem_op definition process (which is done in the caller
>> of this func) so why bother passing an extra arg to the function.
>> Note that you had the exact opposite argument for the
>> spi_nor_spimem_xfer_reg() prototype you suggested above (which I
>> agree with BTW) :P.
> In order to avoid if clauses like "if (op->data.dir == SPI_MEM_DATA_IN)". You
> can't use op->data.buf directly, the *out const qualifier can be discarded.
I'm wrong, the const qualifier will be discarded when passing the buf argument.