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/30/2019 09:04 PM, Vignesh Raghavendra wrote:
>>> + */
>>> +static int spi_nor_exec_op(struct spi_nor *nor, struct spi_mem_op *op,
>>> +			   u64 *addr, void *buf, size_t len)
>>> +{
>>> +	int ret;
>>> +	bool usebouncebuf = false;
>> I don't think we need a bounce buffer for regs. What is the maximum size that we
>> read/write regs, SPI_NOR_MAX_CMD_SIZE(8)?
>>
>> In spi-nor.c the maximum length that we pass to nor->read_reg()/write_reg() is
>> SPI_NOR_MAX_ID_LEN(6).
>>
>> I can provide a patch to always use nor->cmd_buf when reading/writing regs so
>> you respin the series on top of it, if you feel the same.
>>
> 
>> With nor->cmd_buf this function will be reduced to the following:
>>
> I will move the code introducing bounce buffer into separate patch at
> the beginning of this series and switch over all read/write regs
> functions to use bounce buffer instead of cmd_buf. cmd_buf will be dropped.
> And then simplify this patch to spi_nor_spimem_xfer_reg() to you pointed
> out below. Does that sound good?
> 

Please do. Probably we can get rid of spi_nor_spimem_xfer_reg entirely and use
spi_mem_exec_op() directly when interacting with registers. I'll wait for your v3.

Cheers,
ta

>> static int spi_nor_spimem_xfer_reg(struct spi_nor *nor, struct spi_mem_op *op)
>> {
>> 	if (!op || (op->data.nbytes && !nor->cmd_buf))
>> 		return -EINVAL;
>>
>> 	return spi_mem_exec_op(nor->spimem, op);
>> }
>>
>> spi_nor_exec_op() always received a NULL addr, let's get rid of it. We won't
>> need buf anymore and you can retrieve the length from op->data.nbytes. Now that
>> we trimmed the arguments, I think I would get rid of the
>> spi_nor_data/nodata_op() wrappers and use spi_nor_spimem_xfer_reg() directly.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



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

  Powered by Linux