[PATCH v3 3/4] soc: imx: imx8m-blk-ctrl: Scan subnodes and bind drivers to them

Lucas Stach l.stach at pengutronix.de
Wed Feb 22 01:20:40 PST 2023


Am Dienstag, dem 21.02.2023 um 19:57 +0100 schrieb Marek Vasut:
> On 2/21/23 18:09, Lucas Stach wrote:
> 
> [...]
> 
> > > @@ -310,6 +312,13 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
> > >   
> > >   	dev_set_drvdata(dev, bc);
> > >   
> > > +	for_each_child_of_node(dev->of_node, np) {
> > > +		child = of_platform_device_create(np, NULL, dev);
> > > +		if (child)
> > > +			continue;
> > > +		dev_warn(dev, "failed to create device for %pOF\n", np);
> > > +	}
> > 
> > Any reason for not using devm_of_platform_populate() instead?
> 
> Yes, lack of awareness of that option.
> 
> Do I read it right that this gets rid of the whole loop implementation 
> here and replaces it with single function call ?

That's right. And it will also do the necessary
of_platform_device_destroy() to clean things up when the parent device
is removed.

Regards,
Lucas



More information about the linux-arm-kernel mailing list