Message ID | 20211001000924.15421-3-leoyang.li@nxp.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | convert ifc binding to yaml and drop "simple-bus" | expand |
On Thu, Sep 30, 2021 at 07:09:21PM -0500, Li Yang wrote: > After we update the binding to not use simple-bus compatible for the > controller, we need the driver to populate the child devices explicitly. > > Signed-off-by: Li Yang <leoyang.li@nxp.com> > --- > drivers/memory/fsl_ifc.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c > index d062c2f8250f..251d713cd50b 100644 > --- a/drivers/memory/fsl_ifc.c > +++ b/drivers/memory/fsl_ifc.c > @@ -88,6 +88,7 @@ static int fsl_ifc_ctrl_remove(struct platform_device *dev) > { > struct fsl_ifc_ctrl *ctrl = dev_get_drvdata(&dev->dev); > > + of_platform_depopulate(&dev->dev); > free_irq(ctrl->nand_irq, ctrl); > free_irq(ctrl->irq, ctrl); > > @@ -285,6 +286,14 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev) > } > } > > + /* legacy dts may still use "simple-bus" compatible */ > + if (!of_device_is_compatible(dev->dev.of_node, "simple-bus")) { > + ret = of_platform_populate(dev->dev.of_node, NULL, NULL, > + &dev->dev); There's no need to make this conditional. of_platform_populate() is safe to call multiple times. If that doesn't work, it's a bug. Rob
On Mon, Oct 4, 2021 at 12:14 PM Rob Herring <robh@kernel.org> wrote: > > On Thu, Sep 30, 2021 at 07:09:21PM -0500, Li Yang wrote: > > After we update the binding to not use simple-bus compatible for the > > controller, we need the driver to populate the child devices explicitly. > > > > Signed-off-by: Li Yang <leoyang.li@nxp.com> > > --- > > drivers/memory/fsl_ifc.c | 9 +++++++++ > > 1 file changed, 9 insertions(+) > > > > diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c > > index d062c2f8250f..251d713cd50b 100644 > > --- a/drivers/memory/fsl_ifc.c > > +++ b/drivers/memory/fsl_ifc.c > > @@ -88,6 +88,7 @@ static int fsl_ifc_ctrl_remove(struct platform_device *dev) > > { > > struct fsl_ifc_ctrl *ctrl = dev_get_drvdata(&dev->dev); > > > > + of_platform_depopulate(&dev->dev); > > free_irq(ctrl->nand_irq, ctrl); > > free_irq(ctrl->irq, ctrl); > > > > @@ -285,6 +286,14 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev) > > } > > } > > > > + /* legacy dts may still use "simple-bus" compatible */ > > + if (!of_device_is_compatible(dev->dev.of_node, "simple-bus")) { > > + ret = of_platform_populate(dev->dev.of_node, NULL, NULL, > > + &dev->dev); > > There's no need to make this conditional. of_platform_populate() is safe > to call multiple times. If that doesn't work, it's a bug. I think that it is probably an optimization to avoid re-populate the bus for legacy device trees. But it might be cleaner to just re-populate anyway? Regards, Leo
diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c index d062c2f8250f..251d713cd50b 100644 --- a/drivers/memory/fsl_ifc.c +++ b/drivers/memory/fsl_ifc.c @@ -88,6 +88,7 @@ static int fsl_ifc_ctrl_remove(struct platform_device *dev) { struct fsl_ifc_ctrl *ctrl = dev_get_drvdata(&dev->dev); + of_platform_depopulate(&dev->dev); free_irq(ctrl->nand_irq, ctrl); free_irq(ctrl->irq, ctrl); @@ -285,6 +286,14 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev) } } + /* legacy dts may still use "simple-bus" compatible */ + if (!of_device_is_compatible(dev->dev.of_node, "simple-bus")) { + ret = of_platform_populate(dev->dev.of_node, NULL, NULL, + &dev->dev); + if (ret) + goto err_nandirq; + } + return 0; err_nandirq:
After we update the binding to not use simple-bus compatible for the controller, we need the driver to populate the child devices explicitly. Signed-off-by: Li Yang <leoyang.li@nxp.com> --- drivers/memory/fsl_ifc.c | 9 +++++++++ 1 file changed, 9 insertions(+)