From: Mark Brown <broonie@kernel.org>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Heiko Stuebner <heiko@sntech.de>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Lee Jones <lee@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Alessandro Zummo <a.zummo@towertech.it>,
linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel@collabora.com,
shengfei Xu <xsf@rock-chips.com>
Subject: Re: [PATCH 12/13] regulator: rk808: add rk806 support
Date: Thu, 1 Sep 2022 12:36:48 +0100 [thread overview]
Message-ID: <YxCZUGPVQwrefLJi@sirena.org.uk> (raw)
In-Reply-To: <20220831215437.117880-13-sebastian.reichel@collabora.com>
[-- Attachment #1: Type: text/plain, Size: 805 bytes --]
On Wed, Aug 31, 2022 at 11:54:36PM +0200, Sebastian Reichel wrote:
> +static int rk806_get_reg_offset(int id)
> +{
> + int reg_offset = 0;
> +
> + if (id >= RK806_ID_DCDC1 && id <= RK806_ID_DCDC10)
> + reg_offset = RK806_DCDC_SLP_REG_OFFSET;
> + else if ((id >= RK806_ID_NLDO1 && id <= RK806_ID_NLDO4) ||
> + (id == RK806_ID_NLDO5))
> + reg_offset = RK806_NLDO_SLP_REG_OFFSET;
> + else if (id >= RK806_ID_PLDO1 && id <= RK806_ID_PLDO6)
> + reg_offset = RK806_PLDO_SLP_REG_OFFSET;
> +
> + return reg_offset;
> +}
Use separate operations and/or separate data and decide at probe time
which data to use for which regulator, don't have a switch statement at
runtime like this. This reduces the amount of open coding in the driver
and opens up more opportinuties for improving things in the framework.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-09-01 11:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-31 21:54 [PATCH 00/13] Introduce RK806 Support Sebastian Reichel
2022-08-31 21:54 ` [PATCH 01/13] mfd: rk808: convert to device managed resources Sebastian Reichel
2022-08-31 21:54 ` [PATCH 02/13] mfd: rk808: use dev_err_probe Sebastian Reichel
2022-08-31 21:54 ` [PATCH 03/13] clk: RK808: reduce 'struct rk808' usage Sebastian Reichel
2022-08-31 21:54 ` [PATCH 04/13] regulator: rk808: " Sebastian Reichel
2022-09-01 11:32 ` Mark Brown
2022-08-31 21:54 ` [PATCH 05/13] rtc: " Sebastian Reichel
2022-09-05 19:48 ` Alexandre Belloni
2022-08-31 21:54 ` [PATCH 06/13] mfd: rk808: replace 'struct i2c_client' with 'struct device' Sebastian Reichel
2022-08-31 21:54 ` [PATCH 07/13] mfd: rk808: split into core and i2c Sebastian Reichel
2022-08-31 21:54 ` [PATCH 08/13] dt-bindings: mfd: add rk806 binding Sebastian Reichel
2022-09-01 8:09 ` Krzysztof Kozlowski
2022-08-31 21:54 ` [PATCH 09/13] mfd: rk8xx: add rk806 support Sebastian Reichel
2022-08-31 21:54 ` [PATCH 10/13] pinctrl: rk805: add rk806 pinctrl support Sebastian Reichel
2022-08-31 21:58 ` Linus Walleij
2022-08-31 21:54 ` [PATCH 11/13] regulator: rk808: Use dev_err_probe Sebastian Reichel
2022-08-31 21:54 ` [PATCH 12/13] regulator: rk808: add rk806 support Sebastian Reichel
2022-09-01 11:36 ` Mark Brown [this message]
2022-08-31 21:54 ` [PATCH 13/13] ASoC: rk817: Remove 'select REGMAP_I2C' Sebastian Reichel
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=YxCZUGPVQwrefLJi@sirena.org.uk \
--to=broonie@kernel.org \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=kernel@collabora.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lee@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=sebastian.reichel@collabora.com \
--cc=xsf@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