From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Fei Shao <fshao@chromium.org>, Matthias Brugger <matthias.bgg@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] soc: mediatek: mediatek-regulator-coupler: Fix comment
Date: Wed, 23 Oct 2024 12:40:32 +0200 [thread overview]
Message-ID: <9b12aaec-504c-4e3a-a606-240341d8e0d3@collabora.com> (raw)
In-Reply-To: <20241023102059.512352-1-fshao@chromium.org>
Il 23/10/24 12:19, Fei Shao ha scritto:
> Fix two minor issues in the comments.
>
> 1. We balance VSRAM voltage based on the target VGPU voltage, so the
> comment likely refers to VGPU.
Function `mediatek_regulator_balance_voltage()` refers, as stated in the comment
located at the top of its signature, to "GPU<->SRAM" voltages relationships.
So, we're taking into consideration only two regulators:
VGPU and VSRAM
The first comment says:
"If we're asked to set a voltage (implicit: to VGPU) less than VSRAM min_uV[...]"
...so, I think that you've misunderstood what the comment says :-)
> 2. .attach_regulator() returns 0 on success and 1 if the regulator is
> not suitable. The context suggests a successful return value (0).
The comment is on top of a "refuse" or "error" case - one that wants to return 1
and not zero.
Besides, it clearly states:
"The regulator core will keep walking through the list of couplers when any
.attach_regulator() callback returns 1"
...which is definitely true.
drivers/regulator/core.c
function `regulator_find_coupler()`:
list_for_each_entry_reverse(coupler, ®ulator_coupler_list, list) {
err = coupler->attach_regulator(coupler, rdev);
[.....]
if (err < 0)
return ERR_PTR(err);
if (err == 1)
continue;
break;
}
Is that clear now?
Cheers,
Angelo
>
> Fixes: c200774a6df4 ("soc: mediatek: Introduce mediatek-regulator-coupler driver")
> Signed-off-by: Fei Shao <fshao@chromium.org>
> ---
>
> drivers/soc/mediatek/mtk-regulator-coupler.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/mediatek/mtk-regulator-coupler.c b/drivers/soc/mediatek/mtk-regulator-coupler.c
> index 0b6a2884145e..16df12d1c2e0 100644
> --- a/drivers/soc/mediatek/mtk-regulator-coupler.c
> +++ b/drivers/soc/mediatek/mtk-regulator-coupler.c
> @@ -74,7 +74,7 @@ static int mediatek_regulator_balance_voltage(struct regulator_coupler *coupler,
> return ret;
>
> /*
> - * If we're asked to set a voltage less than VSRAM min_uV, set
> + * If we're asked to set a voltage less than VGPU min_uV, set
> * the minimum allowed voltage on VSRAM, as in this case it is
> * safe to ignore the max_spread parameter.
> */
> @@ -108,7 +108,7 @@ static int mediatek_regulator_attach(struct regulator_coupler *coupler,
> * this means that this is surely not a GPU<->SRAM couple: in that
> * case, we may want to use another coupler implementation, if any,
> * or the generic one: the regulator core will keep walking through
> - * the list of couplers when any .attach_regulator() cb returns 1.
> + * the list of couplers when any .attach_regulator() cb returns 0.
> */
> if (rdev->coupling_desc.n_coupled > 2)
> return 1;
next prev parent reply other threads:[~2024-10-23 10:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 10:19 [PATCH] soc: mediatek: mediatek-regulator-coupler: Fix comment Fei Shao
2024-10-23 10:40 ` AngeloGioacchino Del Regno [this message]
2024-10-23 12:03 ` Fei Shao
2024-10-23 13:47 ` Fei Shao
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=9b12aaec-504c-4e3a-a606-240341d8e0d3@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=fshao@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.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