From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: linux-spi@vger.kernel.org, conor@kernel.org, broonie@kernel.org,
lorenzo.bianconi83@gmail.com,
linux-arm-kernel@lists.infradead.org, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
devicetree@vger.kernel.org, nbd@nbd.name, john@phrozen.org,
dd@embedd.com, catalin.marinas@arm.com, will@kernel.org,
upstream@airoha.com, angelogioacchino.delregno@collabora.com
Subject: Re: [PATCH v4 3/3] spi: airoha: add SPI-NAND Flash controller driver
Date: Fri, 26 Apr 2024 21:40:17 +0300 [thread overview]
Message-ID: <CAHp75Vci=xupfi8zt-cB6dOFDhFntp7qvCqz8ZJ-2ucHXd4xhA@mail.gmail.com> (raw)
In-Reply-To: <ZivUAZ2SKRJsESKF@lore-desk>
On Fri, Apr 26, 2024 at 7:19 PM Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> > On Fri, Apr 26, 2024 at 11:31 AM Lorenzo Bianconi <lorenzo@kernel.org> wrote:
...
> > > + default:
> > > + break;
> > > + }
> > > +
> > > + return false;
> >
> > Why not return false directly from the default case?
>
> it is because we still need the 'return false' at the end of routine for the
> other cases due to SPI_MEM_DATA_IN and SPI_MEM_DATA_OUT.
Hmm... Can it be refactored? I think it would still be possible to
slightly reduce the amount of LoCs.
...
> > > + op->data.nbytes = min_t(size_t, op->data.nbytes, 160 - len);
> >
> > You probably wanted clamp(). It's discouraged to use min_t() for unsigned types.
>
> do you mean doing something like:
>
> op->data.nbytes = clamp(op->data.nbytes, op->data.nbytes, 160 - len);
>
> maybe an 'if' condition is more readable, what do you think?
Yes, since we have only one branch of change.
...
> > > + base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> >
> > How is 'res' being used exactly?
>
> right, we can pass NULL here to devm_platform_get_and_ioremap_resource()
No, just use another call that doesn't require this parameter at all.
...
> > > + base = devm_platform_get_and_ioremap_resource(pdev, 1, &res);
> >
> > Ditto.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-04-26 18:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-26 8:30 [PATCH v4 0/3] Add add SPI-NAND Flash controller driver for EN7581 Lorenzo Bianconi
2024-04-26 8:30 ` [PATCH v4 1/3] dt-bindings: spi: airoha: Add YAML schema for SNFI controller Lorenzo Bianconi
2024-04-26 8:30 ` [PATCH v4 2/3] arm64: dts: airoha: add EN7581 spi-nand node Lorenzo Bianconi
2024-04-26 8:30 ` [PATCH v4 3/3] spi: airoha: add SPI-NAND Flash controller driver Lorenzo Bianconi
2024-04-26 13:48 ` Andy Shevchenko
2024-04-26 16:19 ` Lorenzo Bianconi
2024-04-26 18:40 ` Andy Shevchenko [this message]
2024-04-27 21:20 ` kernel test robot
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='CAHp75Vci=xupfi8zt-cB6dOFDhFntp7qvCqz8ZJ-2ucHXd4xhA@mail.gmail.com' \
--to=andy.shevchenko@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=conor+dt@kernel.org \
--cc=conor@kernel.org \
--cc=dd@embedd.com \
--cc=devicetree@vger.kernel.org \
--cc=john@phrozen.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=lorenzo.bianconi83@gmail.com \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=robh+dt@kernel.org \
--cc=upstream@airoha.com \
--cc=will@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).