[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200922012538.GF21107@google.com>
Date: Mon, 21 Sep 2020 18:25:38 -0700
From: Matthias Kaehlcke <mka@...omium.org>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
linux-kernel@...r.kernel.org,
Douglas Anderson <dianders@...omium.org>,
linux-usb@...r.kernel.org, Bastien Nocera <hadess@...ess.net>,
Krzysztof Kozlowski <krzk@...nel.org>,
devicetree@...r.kernel.org,
Ravi Chandra Sadineni <ravisadineni@...omium.org>,
Peter Chen <peter.chen@....com>,
Stephen Boyd <swboyd@...omium.org>,
"Alexander A. Klimov" <grandmaster@...klimov.de>,
Masahiro Yamada <masahiroy@...nel.org>
Subject: Re: [PATCH v2 2/2] USB: misc: Add onboard_usb_hub driver
On Mon, Sep 21, 2020 at 09:08:12PM -0400, Alan Stern wrote:
> On Mon, Sep 21, 2020 at 05:41:58PM -0700, Matthias Kaehlcke wrote:
> > > > + put_device(hub->dev);
> > >
> > > Is there a matching get_device somewhere (like in _find_onboard_hub)?
> > > If so, I didn't see it. And I don't see any reason for it.
> >
> > Yes, implicitly, of_find_device_by_node() "takes a reference to the
> > embedded struct device which needs to be dropped after use."
>
> Okay. In that case it probably would be better to do the put_device()
> right away, at the end of _find_onboard_hub().
ok
> There would be no danger of the platform device getting freed too soon
> if you make onboard_hub_remove unbind the associated USB hub devices.
Yes, I'll add the unbinding as you suggested earlier
> But there would still be a danger of those devices somehow getting
> rebound again at the wrong time; this suggests that you should add a
> flag to the onboard_hub structure saying that the platform device is
> about to go away.
Indeed, we want to avoid that. I'll add a flag to the struct as you
suggested.
Powered by blists - more mailing lists