Commit 62ecae09 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: wacom - properly enable runtime PM

We need to always call usb_autopm_put_interface() in wacom_open(),
not only when initialization fails, otherwise the device will be
marked as PM-busy and will never be put in suspended state.

Based on patch by Oliver Neukum.
Acked-by: default avatarOliver Neukum <oneukum@suse.de>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 3136baf8
...@@ -120,7 +120,6 @@ static int wacom_open(struct input_dev *dev) ...@@ -120,7 +120,6 @@ static int wacom_open(struct input_dev *dev)
out: out:
mutex_unlock(&wacom->lock); mutex_unlock(&wacom->lock);
if (retval)
usb_autopm_put_interface(wacom->intf); usb_autopm_put_interface(wacom->intf);
return retval; return retval;
} }
...@@ -128,6 +127,9 @@ static int wacom_open(struct input_dev *dev) ...@@ -128,6 +127,9 @@ static int wacom_open(struct input_dev *dev)
static void wacom_close(struct input_dev *dev) static void wacom_close(struct input_dev *dev)
{ {
struct wacom *wacom = input_get_drvdata(dev); struct wacom *wacom = input_get_drvdata(dev);
int autopm_error;
autopm_error = usb_autopm_get_interface(wacom->intf);
mutex_lock(&wacom->lock); mutex_lock(&wacom->lock);
usb_kill_urb(wacom->irq); usb_kill_urb(wacom->irq);
...@@ -135,6 +137,7 @@ static void wacom_close(struct input_dev *dev) ...@@ -135,6 +137,7 @@ static void wacom_close(struct input_dev *dev)
wacom->intf->needs_remote_wakeup = 0; wacom->intf->needs_remote_wakeup = 0;
mutex_unlock(&wacom->lock); mutex_unlock(&wacom->lock);
if (!autopm_error)
usb_autopm_put_interface(wacom->intf); usb_autopm_put_interface(wacom->intf);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment