Hi Mehmet,
On 2026-08-28T10:52:07, Mehmet Fide <[email protected]> wrote:
> doc: driver-model: state that of_to_plat() must not probe or claim
>
> The design document says decoding the devicetree belongs in
> of_to_plat(), but not what the method must not do. Spell out the rule
> that has always been implied by the phase separation: no probing of
> other devices and no claiming of resources, and point at the
> parse-now-request-later GPIO helpers as the pattern to follow.
>
> Signed-off-by: Mehmet Fide <[email protected]>
>
> doc/develop/driver-model/design.rst | 9 +++++++++
> 1 file changed, 9 insertions(+)
> +devicetree, read its description into the platform data here - for a GPIO,
> +gpio_parse_by_name() - and claim it in probe(), for a GPIO with
> +gpio_request_parsed().
The final sentence reads oddly - 'for a GPIO' appears twice and the
second clause parses as 'claim it in probe(), for a GPIO with
gpio_request_parsed()'. Something like 'read its description into the
platform data here with gpio_parse_by_name() and claim it in probe()
with gpio_request_parsed()' would be clearer, and you could then
generalise: the same 'parse now, request later' shape applies to
clocks, resets and phys too, even if the helpers do not exist yet.
> diff --git a/doc/develop/driver-model/design.rst
> b/doc/develop/driver-model/design.rst
> @@ -759,6 +759,15 @@ The steps are:
> +The of_to_plat() method must only read the devicetree. It must not probe
> +other devices or claim resources such as GPIOs or clocks: ofdata is read
> +before the device's pinctrl state is applied, so a pin claimed here can have
> +its configuration undone a moment later, and probing another device from this
> +method defeats the lazy-probing model. When a resource is named in the
> +devicetree, read its description into the platform data here - for a GPIO,
> +gpio_parse_by_name() - and claim it in probe(), for a GPIO with
> +gpio_request_parsed().
The new paragraph is good, but a few lines down (around line 789) the
existing text says the opposite:
It is important that the of_to_plat() method does not actually probe
the device itself. However there are cases where other devices must be
probed in the of_to_plat() method. An example is where a device
requires a GPIO for it to operate. To select a GPIO obviously requires
that the GPIO device is probed. This is OK when used by common, core
devices such as GPIO, clock, interrupts, reset and the like.
That is exactly the pattern this series is outlawing. Please delete or
rewrite that paragraph in the same patch so the document does not
contradict itself.
Regards,
Simon