Re: [RESEND PATCH v7] mtd: spi-nor: add hisilicon spi-nor flash controller driver

From: Jiancheng Xue
Date: Tue Mar 08 2016 - 22:39:14 EST


Hi Boris,

On 2016/3/8 17:46, Boris Brezillon wrote:
>> [...]
>>>> +static int hisi_spi_nor_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf,
>>>> + int len)
>>>> +{
>>>> + struct hifmc_priv *priv = nor->priv;
>>>> + struct hifmc_host *host = priv->host;
>>>> + int ret;
>>>> +
>>>> + ret = hisi_spi_nor_send_cmd(nor, opcode, len);
>>>> + if (ret)
>>>> + return ret;
>>>> +
>>>> + memcpy(buf, host->iobase, len);
>>>
>>> sparse doesn't like any of these memcpy()'s, since that's __iomem. Are
>>> you sure you want a regular memcpy here, and elsewhere?
>>>
>> It's not a must to use memcpy though host->iobase represents a segment of inner memory
>> which stores data from flash device byte by byte. I will give up using memcpy here and
>> hisi_spi_nor_write_reg() in next version. Thank you!
>
> Or you can use memcpy_fromio(), which should give you better perfs than
> using readX() accessors in a loop.
>

Thank you very much for your suggestion. I'll look into sparse and this function.

Regards,
Jiancheng