[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220117095559.GN18506@ediswmail.ad.cirrus.com>
Date: Mon, 17 Jan 2022 09:55:59 +0000
From: Charles Keepax <ckeepax@...nsource.cirrus.com>
To: Rob Herring <robh@...nel.org>
CC: Peter Chen <peter.chen@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linux USB List <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Arnd Bergmann <arnd@...db.de>, Tony Lindgren <tony@...mide.com>
Subject: Re: ChipIdea USB regression
On Mon, Jan 17, 2022 at 09:26:56AM +0000, Charles Keepax wrote:
> On Sat, Jan 15, 2022 at 09:55:23AM -0600, Rob Herring wrote:
> > On Fri, Jan 14, 2022 at 5:18 AM Charles Keepax
> > <ckeepax@...nsource.cirrus.com> wrote:
> > > On Fri, Jan 14, 2022 at 10:56:20AM +0000, Charles Keepax wrote:
> > > So when that patch copies the DT node to the new platform device
> > > in ci_hdrc_add_device it copies the compatible stuff as well as
> > > the IRQ stuff it was targeting, this presumably causes the kernel
> > > to bind a new copy of the driver to that new device, which probes
> > > and calls ci_hdrc_add_device again repeating the process until
> > > it dies.
> > >
> > > Kinda looks to me like the best solution might just be to revert
> > > the patch, I am not sure I see how that copy of the DT is supposed
> > > to work?
> >
> > It's not copying the DT, but yes AFAICT it does match and bind the
> > child device on the parent driver using the compatible match instead
> > of matching on driver name. I think we can use the of_reuse_node flag
> > to avoid this in the match, but that needs some more investigation.
>
> Assuming you mean the of_node_reused flag, looks like it already
> being set, your code does this:
>
> @@ -864,6 +864,7 @@ struct platform_device *ci_hdrc_add_device(struct device *dev,
> pdev->dev.parent = dev;
> + device_set_of_node_from_dev(&pdev->dev, dev);
>
> And that function does this:
>
> void device_set_of_node_from_dev(struct device *dev, const struct device *dev2)
> {
> of_node_put(dev->of_node);
> dev->of_node = of_node_get(dev2->of_node);
> dev->of_node_reused = true;
> }
> EXPORT_SYMBOL_GPL(device_set_of_node_from_dev);
>
> I guess maybe that flag doesn't do what it is supposed to for
> some reason?
>
Ah ok it seems that flag is only currently used by the pinctrl
subsystem, didn't realise that was quite so new and not used
anywhere. I guess we probably need to add something to the
platform device code to use that flag too, if that is the way we
want to run with this.
Thanks,
Charles
Powered by blists - more mailing lists