lkml.org 
[lkml]   [2020]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2020-09-22 03:26    [W:0.298 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site