Re: [rft]power management for usbtouch

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

 



On Fri, Jun 27, 2008 at 09:07:13PM +0200, Oliver Neukum wrote:
> Am Freitag 27 Juni 2008 18:10:36 schrieb Ville Syrjälä:
> > On Fri, Jun 27, 2008 at 10:50:00AM +0200, Oliver Neukum wrote:
> > > @@ -820,20 +824,34 @@ exit:
> > >  static int usbtouch_open(struct input_dev *input)
> > >  {
> > >  	struct usbtouch_usb *usbtouch = input_get_drvdata(input);
> > > +	int rv;
> > >  
> > > +	rv = usb_autopm_get_interface(usbtouch->intf);
> > > +	if (rv < 0)
> > > +		goto bail;
> > > +	mutex_lock(&usbtouch->lock);
> > >  	usbtouch->irq->dev = usbtouch->udev;
> > >  
> > > -	if (usb_submit_urb(usbtouch->irq, GFP_KERNEL))
> > > -		return -EIO;
> > > -
> > > -	return 0;
> > > +	if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) {
> > > +		rv = -EIO;
> > > +		usb_autopm_put_interface(usbtouch->intf);
> > > +	} else {
> > > +		usbtouch->open = 1;
> > > +	}
> > > +	mutex_unlock(&usbtouch->lock);
> > > +bail:
> > > +	return rv;
> > >  }
> > 
> > What if the device is already suspended when open() is called?
> > 
> 
> It cannot be. usb_autopm_get_interface() is called, which will resume
> the device.

Ah, so it resumes the device even if it was not autosuspended but
suspended for another reason?

If I understood correctly usb_autpm_get_interface() will only prevent
further autosuspend requests. But is there anything protecting this
against another (non-auto) suspend request coming in between
usb_autopm_get_interface() and mutex_lock()?

-- 
Ville Syrjälä
syrjala@xxxxxx
http://www.sci.fi/~syrjala/
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux