From: Mark Brown <broonie@kernel.org>
To: Saravana Kannan <saravanak@google.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Bjorn Andersson <andersson@kernel.org>,
Sudeep Holla <sudeep.holla@arm.com>,
Tony Lindgren <tony@atomide.com>,
Doug Anderson <dianders@chromium.org>,
Guenter Roeck <linux@roeck-us.net>,
Luca Weiss <luca.weiss@fairphone.com>,
kernel-team@android.com, linux-kernel@vger.kernel.org
Subject: Re: [RFC v1 4/4] regulator: core: Move regulator supply resolving to the probe function
Date: Wed, 22 Feb 2023 22:51:17 +0000 [thread overview]
Message-ID: <Y/acZQdDPSIuW2Ya@sirena.org.uk> (raw)
In-Reply-To: <20230218083252.2044423-5-saravanak@google.com>
[-- Attachment #1: Type: text/plain, Size: 2536 bytes --]
On Sat, Feb 18, 2023 at 12:32:51AM -0800, Saravana Kannan wrote:
> We can simplify the regulator's supply resolving code if we resolve the
> supply in the regulator's probe function. This allows us to:
>
> - Consolidate the supply resolution code to one place.
> - Avoid the need for recursion by allow driver core to take care of
> handling dependencies.
> - Avoid races and simplify locking by reusing the guarantees provided by
> driver core.
> - Avoid last minute/lazy resolving during regulator_get().
> - Simplify error handling because we can assume the supply has been
> resolved once a regulator is probed.
> - Allow driver core to use device links/fw_devlink, where available, to
> resolve the regulator supplies in the optimal order.
It would be good if you had noted the issues with moving the
constraint initialistion that you mentioned elsewhere in the
thread here - from the review I've done thus far that is the
biggest issue this creates - it means that we will not do any
needed hardware configuration until all the parents have sorted
themselves out (which may never even happen), increasing the
amount of time that the system is running out of spec.
> + if (r && r->dev.links.status == DL_DEV_DRIVER_BOUND)
> return r;
>
> r = regulator_lookup_by_name(supply);
> - if (r)
> + if (r && r->dev.links.status == DL_DEV_DRIVER_BOUND)
> return r;
>
> return ERR_PTR(-ENODEV);
This will return -ENODEV in the case where we have found a device
but it didn't probe yet. It's probably more appropriate to
return -EPROBE_DEFER like we do when we know about a DT link.
This is also adding a leak of the get_device() from the looks of
it.
Shouldn't this be using device_is_bound() rather than peering at
the links? Or alternatively if device_is_bound() does something
different to peering at the links isn't that really confusing?
> @@ -2050,13 +2050,6 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
> }
> }
>
> - /* Recursively resolve the supply of the supply */
> - ret = regulator_resolve_supply(r);
> - if (ret < 0) {
> - put_device(&r->dev);
> - goto out;
> - }
> -
> /*
> * Recheck rdev->supply with rdev->mutex lock held to avoid a race
> * between rdev->supply null check and setting rdev->supply in
Your commit message says this should avoid the need to worry
about locking so much so do we still need to recheck things? We
still seem to be doing all the same things we were doing before.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2023-02-22 22:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230218083300eucas1p28c7c584877b8914a3b88904690be82f6@eucas1p2.samsung.com>
2023-02-18 8:32 ` [RFC v1 0/4] Simplify regulator supply resolution code by offloading to driver core Saravana Kannan
2023-02-18 8:32 ` [RFC v1 1/4] regulator: core: Add regulator devices to bus instead of class Saravana Kannan
2023-02-18 8:32 ` [RFC v1 2/4] regulator: core: Add sysfs class backward compatibility Saravana Kannan
2023-02-22 17:47 ` Mark Brown
2023-02-18 8:32 ` [RFC v1 3/4] regulator: core: Probe regulator devices Saravana Kannan
2023-02-22 17:50 ` Mark Brown
2023-02-18 8:32 ` [RFC v1 4/4] regulator: core: Move regulator supply resolving to the probe function Saravana Kannan
2023-02-22 22:51 ` Mark Brown [this message]
2023-02-18 8:36 ` [RFC v1 0/4] Simplify regulator supply resolution code by offloading to driver core Saravana Kannan
2023-02-18 8:54 ` Greg Kroah-Hartman
2023-02-20 9:01 ` Marek Szyprowski
2023-02-21 22:36 ` Saravana Kannan
2023-02-21 22:52 ` Mark Brown
2023-02-22 3:13 ` Saravana Kannan
2023-02-22 14:54 ` Mark Brown
2023-02-22 7:15 ` Marek Szyprowski
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=Y/acZQdDPSIuW2Ya@sirena.org.uk \
--to=broonie@kernel.org \
--cc=andersson@kernel.org \
--cc=dianders@chromium.org \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-team@android.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=luca.weiss@fairphone.com \
--cc=m.szyprowski@samsung.com \
--cc=saravanak@google.com \
--cc=sudeep.holla@arm.com \
--cc=tony@atomide.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®