Re: Query on usb/core/devio.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 16 Oct 2018, Oliver Neukum wrote:

> On Mo, 2018-10-15 at 09:50 -0400, Alan Stern wrote:
> > 
> > It seems that a better approach would be to have an ioctl which would:
> > 
> >         fail if there are any active user URBs;
> > 
> >         drop the usbfs PM reference so the device can suspend;
> > 
> >         block interruptibly until the device resumes;
> 
> Thus we would require user space to have a thread for each device
> it wants to allow suspend for.

True.  I suppose instead of waiting on the usbfs device file, we could
use select() on some sysfs file (something like power/runtime_status).  
Unlike the usbfs device file, keeping a sysfs file open won't interfere
with runtime PM.  And it might be useful for other user programs to
have a way of being notified when a device (not necessarily USB!) goes
into or out of suspend.

> [..]
> > What difference does it make if the URBs are killed by the user instead 
> > of the kernel?
> 
> We stay within the limits of the timing (as well as we can) and the
> case of a failed suspend is much easier to handle.
> Else we have an unlimited time between cessation of IO and going
> into suspend.

The time could be limited be a timeout.

In any case, we must recognize that userspace device drivers will never 
be as powerful as kernel drivers.  The difficulty of handling suspend 
and resume is one example of this.

Alan Stern




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux