linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oliver@neukum.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>,
	Soeren Sonnenburg <kernel@nn7.de>, Thomas Rohwer <tr@tng.de>,
	Richard Guenther <rguenther@suse.de>,
	linux-usb-devel@lists.sourceforge.net,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-input@atrey.karlin.mff.cuni.cz
Subject: Re: Fwd:  autosuspend for appletouch driver
Date: Thu, 27 Sep 2007 20:05:54 +0200	[thread overview]
Message-ID: <200709272005.55358.oliver@neukum.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0709271158410.7735-100000@iolanthe.rowland.org>

Am Donnerstag 27 September 2007 schrieb Alan Stern:
> On Thu, 27 Sep 2007, Oliver Neukum wrote:
> 
> > @@ -528,12 +537,20 @@ exit:
> >  static int atp_open(struct input_dev *input)
> >  {
> >  	struct atp *dev = input_get_drvdata(input);
> > +	int rv = 0;
> >  
> > -	if (usb_submit_urb(dev->urb, GFP_ATOMIC))
> > +	if (usb_autopm_get_interface(dev->intf) < 0)
> >  		return -EIO;
> > +	dev->intf->needs_remote_wakeup = 1;
> > +	if (usb_submit_urb(dev->urb, GFP_KERNEL)) {
> > +		rv = -EIO;
> > +		dev->intf->needs_remote_wakeup = 0;
> > +		goto err;
> >  
> >  	dev->open = 1;
> > -	return 0;
> > +err:
> > +	usb_autopm_put_interface(dev->intf);
> > +	return rv;
> >  }
> >  
> >  static void atp_close(struct input_dev *input)
> > @@ -543,6 +560,7 @@ static void atp_close(struct input_dev *
> >  	usb_kill_urb(dev->urb);
> >  	cancel_work_sync(&dev->work);
> >  	dev->open = 0;
> > +	dev->intf->needs_remote_wakeup = 0;
> >  }
> 
> Doesn't atp_close() need to call usb_autopm_put_interface(), to balance 
> the usb_autopm_get_interface() call in atp_open()?

No, the get is balanced in atp_open() itself. The patch uses the last_busy
mechanism the same way the version for generic hid does. In fact, it is
only necessary because there's no nice API call for setting
needs_remote_wakeup.

	Regards
		Oliver

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

  reply	other threads:[~2007-09-27 18:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-21  8:47 autosuspend for appletouch driver Oliver Neukum
     [not found] ` <d120d5000709261317u13dfce0dn5538f54425d5e225@mail.gmail.com>
2007-09-27  6:29   ` Fwd: [linux-usb-devel] " Oliver Neukum
2007-09-27 15:59     ` [linux-usb-devel] Fwd: " Alan Stern
2007-09-27 18:05       ` Oliver Neukum [this message]
2007-09-27 18:39         ` Alan Stern
2007-09-27 18:43           ` Oliver Neukum
2007-09-27 18:54             ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200709272005.55358.oliver@neukum.org \
    --to=oliver@neukum.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=kernel@nn7.de \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=mjg59@srcf.ucam.org \
    --cc=rguenther@suse.de \
    --cc=stern@rowland.harvard.edu \
    --cc=tr@tng.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).