Re: [PATCH v2] drivers: soc: xilinx: Call InitFinalize from late_initcall_sync instead of probe

From: Arnd Bergmann
Date: Thu Sep 10 2020 - 04:35:44 EST


On Thu, Sep 10, 2020 at 8:50 AM Michal Simek <michal.simek@xxxxxxxxxx> wrote:
> > @@ -246,6 +245,23 @@ static int zynqmp_pm_remove(struct platform_device *pdev)
> > return 0;
> > }
> >
> > +static int __init do_init_finalize(void)
> > +{
> > + struct device_node *np;
> > +
> > + np = of_find_compatible_node(NULL, NULL, "xlnx,zynqmp");
> > + if (!np) {
> > + np = of_find_compatible_node(NULL, NULL, "xlnx,versal");
> > + if (!np)
> > + return 0;
> > + }
> > + of_node_put(np);
> > +
> > + return zynqmp_pm_init_finalize();
> > +}
> > +
> > +late_initcall_sync(do_init_finalize);
> > +
> > static const struct of_device_id pm_of_match[] = {
> > { .compatible = "xlnx,zynqmp-power", },
> > { /* end of table */ },
> >
>
> Arnd: are you fine with this way how to check that it runs on zynqmp or
> versal?

I might be missing something, but this sounds like the wrong way to do it.
There is already a platform driver probed in the presence of the
"xlnx,zynqmp-power" node in the same file. Wouldn't it be better to
either check for the same node instead of an arbitrarily different set
of SoC names, or to make the platform driver itself get registered
form the late initcall?

Arnd