Re: [PATCH v2 1/2] mtd: spi-nor: Move m25p80 code in spi-nor.c

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

 




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.
Please ignore.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux