From: Jiancheng Xue <xuejiancheng@huawei.com>
To: Jagan Teki <jteki@openedev.com>, <robh+dt@kernel.org>,
<pawel.moll@arm.com>, <mark.rutland@arm.com>,
<ijc+devicetree@hellion.org.uk>, <galak@codeaurora.org>,
<dwmw2@infradead.org>, <computersforpeace@gmail.com>,
<zajec5@gmail.com>, <boris.brezillon@free-electrons.com>,
<ezequiel@vanguardiasur.com.ar>, <juhosg@openwrt.org>,
<shijie.huang@intel.com>, <mika.westerberg@linux.intel.com>,
<furquan@google.com>, <han.xu@freescale.com>,
<fabio.estevam@freescale.com>, <manabian@gmail.com>
Cc: <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-mtd@lists.infradead.org>, <yanhaifeng@hisilicon.com>,
<yanghongwei@hisilicon.com>, <suwenping@hisilicon.com>,
<raojun@hisilicon.com>, <ml.yang@hisilicon.com>,
<gaofei@hisilicon.com>, <zhangzhenxing@hisilicon.com>,
<xuejiancheng@hisilicon.com>,
Binquan Peng <pengbinquan@huawei.com>
Subject: Re: [PATCH v8] mtd: spi-nor: add hisilicon spi-nor flash controller driver
Date: Fri, 18 Mar 2016 14:37:44 +0800 [thread overview]
Message-ID: <56EBA238.9050902@huawei.com> (raw)
In-Reply-To: <56E27C29.2040904@openedev.com>
Hi Jagan,
Thank you for comments. I'll modify in next version.
Regards,
Jiancheng
On 2016/3/11 16:04, Jagan Teki wrote:
>
>
> On Friday 11 March 2016 01:11 PM, Jiancheng Xue wrote:
>> Add hisilicon spi-nor flash controller driver
>>
>> Signed-off-by: Binquan Peng <pengbinquan@huawei.com>
>> Signed-off-by: Jiancheng Xue <xuejiancheng@huawei.com>
>> Acked-by: Rob Herring <robh@kernel.org>
>> Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
>> ---
[...]
>> +static void hisi_spi_nor_write(struct spi_nor *nor, loff_t to,
>> + size_t len, size_t *retlen, const u_char *write_buf)
>> +{
>> + struct hifmc_priv *priv = nor->priv;
>> + struct hifmc_host *host = priv->host;
>> + const unsigned char *ptr = write_buf;
>> + size_t num;
>> +
>> + while (len > 0) {
>> + if (to & HIFMC_DMA_MASK)
>> + num = (HIFMC_DMA_MAX_LEN - (to & HIFMC_DMA_MASK))
>> + >= len ? len
>> + : (HIFMC_DMA_MAX_LEN - (to & HIFMC_DMA_MASK));
>> + else
>> + num = (len >= HIFMC_DMA_MAX_LEN)
>> + ? HIFMC_DMA_MAX_LEN : len;
>
> Since num is the actual length bytes to read Better to rename num to actual_len for proper meaning here.
>
>> + memcpy(host->buffer, ptr, num);
>> + hisi_spi_nor_dma_transfer(nor, to, host->dma_buffer, num,
>> + FMC_OP_WRITE);
>> + to += num;
>> + ptr += num;
>> + len -= num;
>> + }
>> + *retlen += (size_t)(ptr - write_buf);
>
> Please avoid this type casting and do *retlen += num inside while.
>
> --
> Jagan
>
> .
>
WARNING: multiple messages have this Message-ID (diff)
From: Jiancheng Xue <xuejiancheng-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: Jagan Teki <jteki-oRp2ZoJdM/RWk0Htik3J/w@public.gmane.org>,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
pawel.moll-5wv7dgnIgG8@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org,
ezequiel-30ULvvUtt6G51wMPkGsGjgyUoB5FGQPZ@public.gmane.org,
juhosg-p3rKhJxN3npAfugRpC6u6w@public.gmane.org,
shijie.huang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
furquan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
han.xu-KZfg59tc24xl57MIdRCFDg@public.gmane.org,
fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org,
manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
yanhaifeng-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org,
yanghongwei-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org,
suwenping-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org,
raojun-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org,
ml.yang-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org,
gaofei-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org,
zhangzhenxing-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org,
xuejiancheng-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org,
Binquan Peng
<pengbinquan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH v8] mtd: spi-nor: add hisilicon spi-nor flash controller driver
Date: Fri, 18 Mar 2016 14:37:44 +0800 [thread overview]
Message-ID: <56EBA238.9050902@huawei.com> (raw)
In-Reply-To: <56E27C29.2040904-oRp2ZoJdM/RWk0Htik3J/w@public.gmane.org>
Hi Jagan,
Thank you for comments. I'll modify in next version.
Regards,
Jiancheng
On 2016/3/11 16:04, Jagan Teki wrote:
>
>
> On Friday 11 March 2016 01:11 PM, Jiancheng Xue wrote:
>> Add hisilicon spi-nor flash controller driver
>>
>> Signed-off-by: Binquan Peng <pengbinquan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>> Signed-off-by: Jiancheng Xue <xuejiancheng-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>> Reviewed-by: Ezequiel Garcia <ezequiel-30ULvvUtt6G51wMPkGsGjgyUoB5FGQPZ@public.gmane.org>
>> ---
[...]
>> +static void hisi_spi_nor_write(struct spi_nor *nor, loff_t to,
>> + size_t len, size_t *retlen, const u_char *write_buf)
>> +{
>> + struct hifmc_priv *priv = nor->priv;
>> + struct hifmc_host *host = priv->host;
>> + const unsigned char *ptr = write_buf;
>> + size_t num;
>> +
>> + while (len > 0) {
>> + if (to & HIFMC_DMA_MASK)
>> + num = (HIFMC_DMA_MAX_LEN - (to & HIFMC_DMA_MASK))
>> + >= len ? len
>> + : (HIFMC_DMA_MAX_LEN - (to & HIFMC_DMA_MASK));
>> + else
>> + num = (len >= HIFMC_DMA_MAX_LEN)
>> + ? HIFMC_DMA_MAX_LEN : len;
>
> Since num is the actual length bytes to read Better to rename num to actual_len for proper meaning here.
>
>> + memcpy(host->buffer, ptr, num);
>> + hisi_spi_nor_dma_transfer(nor, to, host->dma_buffer, num,
>> + FMC_OP_WRITE);
>> + to += num;
>> + ptr += num;
>> + len -= num;
>> + }
>> + *retlen += (size_t)(ptr - write_buf);
>
> Please avoid this type casting and do *retlen += num inside while.
>
> --
> Jagan
>
> .
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-03-18 6:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-11 7:41 [PATCH v8] mtd: spi-nor: add hisilicon spi-nor flash controller driver Jiancheng Xue
2016-03-11 7:41 ` Jiancheng Xue
2016-03-11 8:04 ` Jagan Teki
2016-03-11 8:04 ` Jagan Teki
2016-03-18 6:37 ` Jiancheng Xue [this message]
2016-03-18 6:37 ` Jiancheng Xue
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56EBA238.9050902@huawei.com \
--to=xuejiancheng@huawei.com \
--cc=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=fabio.estevam@freescale.com \
--cc=furquan@google.com \
--cc=galak@codeaurora.org \
--cc=gaofei@hisilicon.com \
--cc=han.xu@freescale.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jteki@openedev.com \
--cc=juhosg@openwrt.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=manabian@gmail.com \
--cc=mark.rutland@arm.com \
--cc=mika.westerberg@linux.intel.com \
--cc=ml.yang@hisilicon.com \
--cc=pawel.moll@arm.com \
--cc=pengbinquan@huawei.com \
--cc=raojun@hisilicon.com \
--cc=robh+dt@kernel.org \
--cc=shijie.huang@intel.com \
--cc=suwenping@hisilicon.com \
--cc=xuejiancheng@hisilicon.com \
--cc=yanghongwei@hisilicon.com \
--cc=yanhaifeng@hisilicon.com \
--cc=zajec5@gmail.com \
--cc=zhangzhenxing@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.