[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfskABz+KrnLzDTYH=1cESimi++3HwQ2a1tiWkPTqf=HQ@mail.gmail.com>
Date: Tue, 26 Jun 2018 16:18:44 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Frieder Schrempf <frieder.schrempf@...eet.de>
Cc: "linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
Yogesh Narayan Gaur <yogeshnarayan.gaur@....com>,
"boris.brezillon@...tlin.com" <boris.brezillon@...tlin.com>,
"linux-spi@...r.kernel.org" <linux-spi@...r.kernel.org>,
"dwmw2@...radead.org" <dwmw2@...radead.org>,
"computersforpeace@...il.com" <computersforpeace@...il.com>,
"marek.vasut@...il.com" <marek.vasut@...il.com>,
"richard@....at" <richard@....at>,
"miquel.raynal@...tlin.com" <miquel.raynal@...tlin.com>,
"broonie@...nel.org" <broonie@...nel.org>,
David Wolfe <david.wolfe@....com>,
Fabio Estevam <fabio.estevam@....com>,
Prabhakar Kushwaha <prabhakar.kushwaha@....com>,
Han Xu <han.xu@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 03/11] spi: Add a driver for the Freescale/NXP QuadSPI controller
On Tue, Jun 26, 2018 at 3:26 PM, Frieder Schrempf
<frieder.schrempf@...eet.de> wrote:
> On 08.06.2018 22:27, Andy Shevchenko wrote:
>> On Fri, Jun 8, 2018 at 2:54 PM, Yogesh Narayan Gaur
>> <yogeshnarayan.gaur@....com> wrote:
>>> +static int fsl_qspi_check_buswidth(struct fsl_qspi *q, u8 width) {
>>> + switch (width) {
>>> + case 1:
>>> + case 2:
>>> + case 4:
>>> + return 0;
>>> + }
>> if (!is_power_of_2(width) || width >= 8)
>> return -E...;
>>
>> return 0;
>>
>> ?
> Your proposition is a bit shorter, but I think it's slightly harder to read.
OK.
>>> +
>>> + return -ENOTSUPP;
>>> +}
>>> + for (i = 0; i < op->data.nbytes; i += 4) {
>>> + u32 val = 0;
>>> +
>>> + memcpy(&val, op->data.buf.out + i,
>>> + min_t(unsigned int, op->data.nbytes - i, 4));
>> You may easily avoid this conditional on each iteration.
> Do you mean something like this, or are there better ways?
>
> u32 val = 0;
>
> for (i = 0; i < ALIGN_DOWN(op->data.nbytes, 4); i += 4)
> {
> memcpy(&val, op->data.buf.out + i, 4);
> val = fsl_qspi_endian_xchg(q, val);
> qspi_writel(q, val, base + QUADSPI_TBDR);
> }
>
> memcpy(&val, op->data.buf.out + i, op->data.nbytes);
> val = fsl_qspi_endian_xchg(q, val);
> qspi_writel(q, val, base + QUADSPI_TBDR);
Something like this, though last part should go under
if (IS_ALIGNED(...))
(My comment was about moving out an invariant conditional)
>>> + val = fsl_qspi_endian_xchg(q, val);
>>> + qspi_writel(q, val, base + QUADSPI_TBDR);
>>> + }
>>> +MODULE_AUTHOR("Freescale Semiconductor Inc."); MODULE_AUTHOR("Boris
>>> +Brezillion <boris.brezillon@...tlin.com>"); MODULE_AUTHOR("Frieder
>>> +Schrempf <frieder.schrempf@...eet.de>"); MODULE_LICENSE("GPL v2");
>> Wrong indentation.
> What is wrong? Some newlines are missing here between the MODULE_ macros,
> but in my original patch it seems correct.
It should be like
MODULE_FOO(...);
MODULE_BAR(...);
MODULE_BAZ(...);
One macro — one line.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists