From: Liang Yang <liang.yang@amlogic.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Boris Brezillon <bbrezillon@kernel.org>,
Richard Weinberger <richard@nod.at>,
kernel-janitors@vger.kernel.org,
Marek Vasut <marek.vasut@gmail.com>,
linux-mtd@lists.infradead.org,
Kevin Hilman <khilman@baylibre.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
linux-amlogic@lists.infradead.org,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 3/3] mtd: rawnand: meson: remove unnecessary condition in meson_nfc_select_chip()
Date: Sat, 2 Feb 2019 11:01:33 +0800 [thread overview]
Message-ID: <40c4ae49-22fa-38ab-cbfc-9562bc6be65a@amlogic.com> (raw)
In-Reply-To: <20190201083053.GE8459@kadam>
On 2019/2/1 16:30, Dan Carpenter wrote:
> If chip is negative then we return at the very start of the function.
> Removing the check lets us pull everything in one indent level.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/mtd/nand/raw/meson_nand.c | 28 ++++++++++++----------------
> 1 file changed, 12 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
> index 0d93d0b9c1af..105d12103ca6 100644
> --- a/drivers/mtd/nand/raw/meson_nand.c
> +++ b/drivers/mtd/nand/raw/meson_nand.c
> @@ -234,23 +234,19 @@ static void meson_nfc_select_chip(struct nand_chip *nand, int chip)
> nfc->timing.tadl = meson_chip->tadl;
> nfc->timing.tbers_max = meson_chip->tbers_max;
>
> - if (chip >= 0) {
> - if (nfc->clk_rate != meson_chip->clk_rate) {
> - ret = clk_set_rate(nfc->device_clk,
> - meson_chip->clk_rate);
> - if (ret) {
> - dev_err(nfc->dev, "failed to set clock rate\n");
> - return;
> - }
> - nfc->clk_rate = meson_chip->clk_rate;
> - }
> - if (nfc->bus_timing != meson_chip->bus_timing) {
> - value = (NFC_CLK_CYCLE - 1)
> - | (meson_chip->bus_timing << 5);
> - writel(value, nfc->reg_base + NFC_REG_CFG);
> - writel((1 << 31), nfc->reg_base + NFC_REG_CMD);
> - nfc->bus_timing = meson_chip->bus_timing;
> + if (nfc->clk_rate != meson_chip->clk_rate) {
> + ret = clk_set_rate(nfc->device_clk, meson_chip->clk_rate);
> + if (ret) {
> + dev_err(nfc->dev, "failed to set clock rate\n");
> + return;
> }
> + nfc->clk_rate = meson_chip->clk_rate;
> + }
> + if (nfc->bus_timing != meson_chip->bus_timing) {
> + value = (NFC_CLK_CYCLE - 1) | (meson_chip->bus_timing << 5);
> + writel(value, nfc->reg_base + NFC_REG_CFG);
> + writel((1 << 31), nfc->reg_base + NFC_REG_CMD);
> + nfc->bus_timing = meson_chip->bus_timing;
> }
Indeed, we need not check chip >= 0 again. Thank you.
Acked-by: Liang Yang <liang.yang@amlogic.com>
> }
>
>
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
prev parent reply other threads:[~2019-02-02 3:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-01 8:30 [PATCH 3/3] mtd: rawnand: meson: remove unnecessary condition in meson_nfc_select_chip() Dan Carpenter
2019-02-02 3:01 ` Liang Yang [this message]
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=40c4ae49-22fa-38ab-cbfc-9562bc6be65a@amlogic.com \
--to=liang.yang@amlogic.com \
--cc=bbrezillon@kernel.org \
--cc=computersforpeace@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=dwmw2@infradead.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
/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).