Re: [PATCH v11 4/7] media: qcom: camss: Add support to populate sub-devices

Dmitry Baryshkov
2026-03-27T21:33:43Z

On Fri, Mar 27, 2026 at 10:22:04PM +0100, Loic Poulain wrote:
> On Thu, Mar 26, 2026 at 2:28 AM Bryan O'Donoghue
> <bryan.odonoghue@linaro.org> wrote:
> >
> > Use devm_of_platform_populate() to populate subs in the tree.
> >
> > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
>
> Other drivers typically call the populate function at the end of the
> probe function. In this case, however, it is invoked before the main
> resources are enabled. I assume this is because the CSIPHY device
> needs to be available early. Aside from that, it looks good to me.

This becomes fragile. The CSI PHY might be built as a module, which
might be loaded later.

>
> Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
>
> > @@ -4964,6 +4965,8 @@ static int camss_probe(struct platform_device *pdev)
> > if (!camss)
> > return -ENOMEM;
> >
> > + devm_of_platform_populate(dev);
> > +
> > camss->res = of_device_get_match_data(dev);
> >
> > atomic_set(&camss->ref_count, 0);

And this looks suspicious. What if drivers for submodules are already
there and start probing once populated? Do they have a chance to access
this ref_count?

--
With best wishes
Dmitry