From: Mark Brown <broonie@kernel.org>
To: Maciej Purski <m.purski@samsung.com>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Liam Girdwood <lgirdwood@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH v3 3/4] regulator: core: Parse coupled regulators properties
Date: Tue, 12 Dec 2017 11:35:11 +0000 [thread overview]
Message-ID: <20171212113511.GF16323@sirena.org.uk> (raw)
In-Reply-To: <1512639975-22241-4-git-send-email-m.purski@samsung.com>
[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]
On Thu, Dec 07, 2017 at 10:46:14AM +0100, Maciej Purski wrote:
> +static int check_coupled_regulators_array(struct coupling_desc *c_desc,
> + int index)
> +{
> + /* Different number of regulators coupled */
> + if (of_count_phandle_with_args(node, "regulator-coupled-with", 0) !=
> + (n_coupled - 1))
> + return -EINVAL;
This is still DT only code in the core file, we really need the core to
not know anything about DT so that we know that we can support this
feature with other firmwares if we need to. Just move all the parsing
code into the of_regulator.c then have a second step that goes through
and validates extra stuff like the presence of set voltage operations in
the generic code.
> + if (c_desc->coupled_rdevs[i]->constraints->max_spread !=
> + rdev->constraints->max_spread) {
> + rdev_err(rdev, "coupled regulators max_spread mismatch\n");
> + goto err;
> + }
It's better to print out failing values when things go wrong - it really
helps people debug their DTs if the error messages are specific about
what went wrong. This applies to a bunch of the errors here.
> + mutex_lock(®ulator_list_mutex);
> + regulator_resolve_coupling(rdev);
> + mutex_unlock(®ulator_list_mutex);
> +
I'd really expect us to be failing to probe if we run into an error.
Otherwise we could end up doing bad things to the hardware at runtime
later on, or confusing ourselves and crashing with partially set up
datastructures. It's also not 100% clear to me how we handle the case
where only some of the coupled regulators have probed.
> diff --git a/drivers/regulator/internal.h b/drivers/regulator/internal.h
> index 2f3218b..6290384 100644
> --- a/drivers/regulator/internal.h
> +++ b/drivers/regulator/internal.h
> @@ -16,6 +16,8 @@
> #ifndef __REGULATOR_INTERNAL_H
> #define __REGULATOR_INTERNAL_H
>
> +#include <linux/regulator/driver.h>
> +
Why do we need this?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2017-12-12 11:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20171207094720eucas1p1eb1c8c2d0e222082ce6918807c4ad492@eucas1p1.samsung.com>
2017-12-07 9:46 ` [PATCH v3 0/4] Add coupled regulators mechanism Maciej Purski
[not found] ` <CGME20171207094751eucas1p1c10de599329e2c7ece77c8a5ed939401@eucas1p1.samsung.com>
2017-12-07 9:46 ` [PATCH v3 1/4] regulator: core: Move of_find_regulator_by_node() to of_regulator.c Maciej Purski
2018-01-26 17:35 ` Applied "regulator: core: Move of_find_regulator_by_node() to of_regulator.c" to the regulator tree Mark Brown
[not found] ` <CGME20171207094752eucas1p2ca38d1197d8057cb92b33a81a9942915@eucas1p2.samsung.com>
2017-12-07 9:46 ` [PATCH v3 2/4] regulator: bindings: Add properties for coupled regulators Maciej Purski
2017-12-07 23:30 ` Rob Herring
2018-03-02 12:55 ` Applied "regulator: bindings: Add properties for coupled regulators" to the regulator tree Mark Brown
[not found] ` <CGME20171207094753eucas1p27b835787f92a1da8c46b9a2692376288@eucas1p2.samsung.com>
2017-12-07 9:46 ` [PATCH v3 3/4] regulator: core: Parse coupled regulators properties Maciej Purski
2017-12-12 11:35 ` Mark Brown [this message]
2017-12-21 10:08 ` Maciej Purski
2017-12-21 12:02 ` Mark Brown
[not found] ` <CGME20171207094754eucas1p1528c6c30135124430a5c703eb81de8d2@eucas1p1.samsung.com>
2017-12-07 9:46 ` [PATCH v3 4/4] regulator: core: Balance coupled regulators voltages Maciej Purski
2017-12-12 11:54 ` Mark Brown
2017-12-13 9:25 ` Maciej Purski
2017-12-15 15:19 ` Mark Brown
2017-12-21 13:29 ` Maciej Purski
2017-12-21 13:34 ` Mark Brown
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=20171212113511.GF16323@sirena.org.uk \
--to=broonie@kernel.org \
--cc=b.zolnierkie@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.purski@samsung.com \
--cc=m.szyprowski@samsung.com \
--cc=mark.rutland@arm.com \
--cc=robh+dt@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
all inboxes | Powered by JetHome®