lkml.org 
[lkml]   [2021]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/4] USB: serial: add support for multi-interface functions
On Wed, Mar 31, 2021 at 01:21:15PM +0200, Oliver Neukum wrote:
> Am Mittwoch, den 31.03.2021, 09:08 +0200 schrieb Oliver Neukum:
> > Am Dienstag, den 30.03.2021, 17:22 +0200 schrieb Johan Hovold:
> > > On Tue, Mar 30, 2021 at 04:44:32PM +0200, Oliver Neukum wrote:
> > > > Am Dienstag, den 30.03.2021, 16:38 +0200 schrieb Johan Hovold:
> > > > > @@ -1115,6 +1161,8 @@ static void usb_serial_disconnect(struct usb_interface *interface)
> > > > > if (serial->type->disconnect)
> > > > > serial->type->disconnect(serial);
> > > > >
> > > > > + release_sibling(serial, interface);
> > > > > +
> > > > > /* let the last holder of this object cause it to be cleaned up */
> > > > > usb_serial_put(serial);
> > > > > dev_info(dev, "device disconnected\n");
> > > >
> > > > Hi,
> > > >
> > > > does this assume you are called for the original interface first?
> > >
> > > No, I handle either interface being unbound first (e.g. see
> > > release_sibling()).
> > >
> > > > I am afraid that is an assumption you cannot make. In fact, if somebody
> > > > is doing odd things with sysfs you cannot even assume both will see a
> > > > disconnect()
> > >
> > > Right, but disconnect() will still be called also for the sibling
> > > interface as part of release_sibling() above.
> >
> > OK, sorry I overlooked that.
>
> Hi,
>
> on the third hand, the more I look at this, would you mind putting
> sibling_release() with a modified name into usbcore? This functionality
> is not limited to serial drivers. btusb needs it; cdc-acm needs it;
> usbaudio neds it. We have code duplication.

Tell me about it. ;) Unfortunately, drivers all tend to handle this
slightly different, for example, using a disconnected flag, some claim
more than one other interface, others look like they may be using their
interface data as a flag for other purposes, etc.

At some point we could unify all this but until then I don't think
putting only half of an interface into core makes much sense.

Johan

\
 
 \ /
  Last update: 2021-04-01 09:47    [W:0.076 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site