From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751959AbcCIDjM (ORCPT ); Tue, 8 Mar 2016 22:39:12 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:62639 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751266AbcCIDjJ (ORCPT ); Tue, 8 Mar 2016 22:39:09 -0500 Subject: Re: [RESEND PATCH v7] mtd: spi-nor: add hisilicon spi-nor flash controller driver To: Boris Brezillon References: <1456474316-24473-1-git-send-email-xuejiancheng@huawei.com> <20160307225229.GC55664@google.com> <56DE9A79.30704@huawei.com> <20160308104628.6224bde2@bbrezillon> CC: Brian Norris , , , , , , , , , , , , , , , , , , , , , , , , , , , , Binquan Peng From: Jiancheng Xue Message-ID: <56DF9A1D.8090100@huawei.com> Date: Wed, 9 Mar 2016 11:35:57 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160308104628.6224bde2@bbrezillon> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.217.211] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090205.56DF9A35.008A,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: f005e6b70563f8f7cebe916a813b991b Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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