diff mbox

[4/4] input: tablet: pegasus_notetaker: Set device mode in reset_resume() if in use

Message ID 1468852149-2614-5-git-send-email-martink@posteo.de (mailing list archive)
State Accepted
Headers show

Commit Message

Martin Kepplinger-Novakovic July 18, 2016, 2:29 p.m. UTC
Signed-off-by: Martin Kepplinger <martink@posteo.de>
---
 drivers/input/tablet/pegasus_notetaker.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Comments

Dmitry Torokhov July 20, 2016, 9:30 p.m. UTC | #1
On Mon, Jul 18, 2016 at 04:29:09PM +0200, Martin Kepplinger wrote:
> Signed-off-by: Martin Kepplinger <martink@posteo.de>

Applied, thank you.

> ---
>  drivers/input/tablet/pegasus_notetaker.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/tablet/pegasus_notetaker.c b/drivers/input/tablet/pegasus_notetaker.c
> index 07436c6..b172247 100644
> --- a/drivers/input/tablet/pegasus_notetaker.c
> +++ b/drivers/input/tablet/pegasus_notetaker.c
> @@ -398,7 +398,19 @@ static int pegasus_resume(struct usb_interface *intf)
>  
>  static int pegasus_reset_resume(struct usb_interface *intf)
>  {
> -	return pegasus_resume(intf);
> +	struct pegasus *pegasus = usb_get_intfdata(intf);
> +	int retval = 0;
> +
> +	mutex_lock(&pegasus->dev->mutex);
> +	if (pegasus->dev->users) {
> +		retval = pegasus_set_mode(pegasus, PEN_MODE_XY,
> +					  NOTETAKER_LED_MOUSE);
> +		if (!retval && usb_submit_urb(pegasus->irq, GFP_NOIO) < 0)
> +			retval = -EIO;
> +	}
> +	mutex_unlock(&pegasus->dev->mutex);
> +
> +	return retval;
>  }
diff mbox

Patch

diff --git a/drivers/input/tablet/pegasus_notetaker.c b/drivers/input/tablet/pegasus_notetaker.c
index 07436c6..b172247 100644
--- a/drivers/input/tablet/pegasus_notetaker.c
+++ b/drivers/input/tablet/pegasus_notetaker.c
@@ -398,7 +398,19 @@  static int pegasus_resume(struct usb_interface *intf)
 
 static int pegasus_reset_resume(struct usb_interface *intf)
 {
-	return pegasus_resume(intf);
+	struct pegasus *pegasus = usb_get_intfdata(intf);
+	int retval = 0;
+
+	mutex_lock(&pegasus->dev->mutex);
+	if (pegasus->dev->users) {
+		retval = pegasus_set_mode(pegasus, PEN_MODE_XY,
+					  NOTETAKER_LED_MOUSE);
+		if (!retval && usb_submit_urb(pegasus->irq, GFP_NOIO) < 0)
+			retval = -EIO;
+	}
+	mutex_unlock(&pegasus->dev->mutex);
+
+	return retval;
 }
 
 static const struct usb_device_id pegasus_ids[] = {