From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Ye Zhang <ye.zhang@rock-chips.com>
Cc: linus.walleij@linaro.org, brgl@bgdev.pl, heiko@sntech.de,
linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
mika.westerberg@linux.intel.com, tao.huang@rock-chips.com,
finley.xiao@rock-chips.com, tim.chen@rock-chips.com,
elaine.zhang@rock-chips.com
Subject: Re: [PATCH v4 2/4] gpio: rockchip: change the GPIO version judgment logic
Date: Mon, 11 Nov 2024 11:48:18 +0200 [thread overview]
Message-ID: <ZzHS4uMpP8qF9F3e@smile.fi.intel.com> (raw)
In-Reply-To: <20241111023412.3466161-3-ye.zhang@rock-chips.com>
On Mon, Nov 11, 2024 at 10:34:10AM +0800, Ye Zhang wrote:
> Have a list of valid IDs and default to -ENODEV.
...
> - /* If not gpio v2, that is default to v1. */
> - if (id == GPIO_TYPE_V2 || id == GPIO_TYPE_V2_1) {
> + switch (id) {
> + case GPIO_TYPE_V1:
If you leave the V2 case first...
> + bank->gpio_regs = &gpio_regs_v1;
> + bank->gpio_type = GPIO_TYPE_V1;
> + break;
> + case GPIO_TYPE_V2:
> + case GPIO_TYPE_V2_1:
...and the v1 case last, the whole diff will be much more understandable and
reviewable.
> bank->gpio_regs = &gpio_regs_v2;
> bank->gpio_type = GPIO_TYPE_V2;
> bank->db_clk = of_clk_get(bank->of_node, 1);
> @@ -677,9 +682,10 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank)
> clk_disable_unprepare(bank->clk);
> return -EINVAL;
> }
> - } else {
> - bank->gpio_regs = &gpio_regs_v1;
> - bank->gpio_type = GPIO_TYPE_V1;
> + break;
> + default:
> + dev_err(bank->dev, "cannot get the version ID\n");
> + return -ENODEV;
> }
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-11-11 9:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-11 2:34 [PATCH v4 0/4] gpio: rockchip: Update the GPIO driver Ye Zhang
2024-11-11 2:34 ` [PATCH v4 1/4] gpio: rockchip: explan the format of the GPIO version ID Ye Zhang
2024-11-11 9:46 ` Andy Shevchenko
2024-11-11 22:24 ` Sebastian Reichel
2024-11-13 13:23 ` Linus Walleij
2024-11-11 2:34 ` [PATCH v4 2/4] gpio: rockchip: change the GPIO version judgment logic Ye Zhang
2024-11-11 9:48 ` Andy Shevchenko [this message]
2024-11-11 23:01 ` Sebastian Reichel
2024-11-11 2:34 ` [PATCH v4 3/4] gpio: rockchip: support new version GPIO Ye Zhang
2024-11-11 9:48 ` Andy Shevchenko
2024-11-11 22:27 ` Sebastian Reichel
2024-11-13 13:24 ` Linus Walleij
2024-11-11 2:34 ` [PATCH v4 4/4] gpio: rockchip: Set input direction when request irq Ye Zhang
2024-11-11 23:02 ` Sebastian Reichel
2024-11-13 13:25 ` Linus Walleij
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=ZzHS4uMpP8qF9F3e@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=brgl@bgdev.pl \
--cc=elaine.zhang@rock-chips.com \
--cc=finley.xiao@rock-chips.com \
--cc=heiko@sntech.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mika.westerberg@linux.intel.com \
--cc=tao.huang@rock-chips.com \
--cc=tim.chen@rock-chips.com \
--cc=ye.zhang@rock-chips.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®