Thread (47 messages) 47 messages, 7 authors, 2024-09-11

Re: [PATCH v6 11/12] platform/chrome: Introduce device tree hardware prober

From: Tzung-Bi Shih <tzungbi@kernel.org>
Date: 2024-09-05 04:34:45
Also in: chrome-platform, linux-devicetree, linux-i2c, linux-mediatek, lkml

On Thu, Sep 05, 2024 at 11:52:32AM +0800, Chen-Yu Tsai wrote:
On Wed, Sep 4, 2024 at 6:08 PM Tzung-Bi Shih [off-list ref] wrote:
quoted
On Wed, Sep 04, 2024 at 05:00:13PM +0800, Chen-Yu Tsai wrote:
quoted
diff --git a/drivers/platform/chrome/chromeos_of_hw_prober.c b/drivers/platform/chrome/chromeos_of_hw_prober.c
[...]
quoted
+static int chromeos_of_hw_prober_probe(struct platform_device *pdev)
+{
+     for (size_t i = 0; i < ARRAY_SIZE(hw_prober_platforms); i++) {
+             int ret;
+
+             if (!of_machine_is_compatible(hw_prober_platforms[i].compatible))
+                     continue;
+
+             ret = hw_prober_platforms[i].prober(&pdev->dev, hw_prober_platforms[i].data);
+             /* Ignore unrecoverable errors and keep going through other probers */
+             if (ret == -EPROBE_DEFER)
+                     return ret;
Is it harmless if some of the components get probed multiple times?  E.g.:
comp1 probed -> comp2 probed -> comp3 returned -EPROBE_DEFER -> some time
later, chromeos_of_hw_prober_probe() gets called again.
Yes it is harmless. Components already enabled will not get disabled
in the error path. And the prober that enabled that component will see
that a component was enabled, and skip doing the whole process again.

So something like:

    comp1 probed -> comp2 probed -> comp3 -EPROBE_DEFER ->
        comp1 skip -> comp2 skip -> comp3 probed
I assume this patch will be applied through the i2c tree:
Acked-by: Tzung-Bi Shih <tzungbi@kernel.org>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help