Re: [linux-usb-devel] Fwd: autosuspend for appletouch driver

Alan Stern <[email protected]>
Newsgroups gmane.linux.kernel.input,gmane.linux.usb.devel
Message-ID <[email protected]>
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()?

Alan Stern
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.