@@ -121,6 +121,7 @@ static int wacom_open(struct input_dev *dev)
wacom->open = true;
wacom->intf->needs_remote_wakeup = 1;
+ usb_autopm_put_interface(wacom->intf);
mutex_unlock(&wacom->lock);
return 0;
@@ -129,11 +130,15 @@ static int wacom_open(struct input_dev *dev)
static void wacom_close(struct input_dev *dev)
{
struct wacom *wacom = input_get_drvdata(dev);
+ int r;
mutex_lock(&wacom->lock);
- usb_kill_urb(wacom->irq);
+ r = usb_autopm_get_interface(wacom->intf);
wacom->open = false;
wacom->intf->needs_remote_wakeup = 0;
+ usb_kill_urb(wacom->irq);
+ if (!r)
+ usb_autopm_put_interface(wacom->intf);
mutex_unlock(&wacom->lock);
}
@@ -573,7 +578,10 @@ static int wacom_resume(struct usb_interface *intf)
struct wacom_features *features = &wacom->wacom_wac.features;
int rv;
- mutex_lock(&wacom->lock);
+ /*
+ * no locking against open needed
+ * as open holds a power reference
+ */
/* switch to wacom mode first */
wacom_query_tablet_data(intf, features);
@@ -583,8 +591,6 @@ static int wacom_resume(struct usb_interface *intf)
else
rv = 0;
- mutex_unlock(&wacom->lock);
-
return rv;
}