From patchwork Mon Jun 13 13:31:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger-Novakovic X-Patchwork-Id: 9172993 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4EFC66075D for ; Mon, 13 Jun 2016 13:39:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 268A020410 for ; Mon, 13 Jun 2016 13:39:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B2C0262AE; Mon, 13 Jun 2016 13:39:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A107920410 for ; Mon, 13 Jun 2016 13:39:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423655AbcFMNjU (ORCPT ); Mon, 13 Jun 2016 09:39:20 -0400 Received: from mout02.posteo.de ([185.67.36.66]:39830 "EHLO mout02.posteo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423647AbcFMNjT (ORCPT ); Mon, 13 Jun 2016 09:39:19 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 2A25B20A6A for ; Mon, 13 Jun 2016 15:32:05 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3rStwx5wjJzyZZ; Mon, 13 Jun 2016 15:32:01 +0200 (CEST) From: Martin Kepplinger To: dmitry.torokhov@gmail.com Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, kernel-testers@vger.kernel.org, linux-usb@vger.kernel.org, Martin Kepplinger Subject: [PATCH] input: tablet: pegasus_notetaker: USB PM fixes Date: Mon, 13 Jun 2016 15:31:53 +0200 Message-Id: <1465824713-3156-1-git-send-email-martink@posteo.de> X-Mailer: git-send-email 2.1.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In close() we only need usb_autopm_put_interface(), in reset_resume() we need to set the device mode, and in suspend(), we must cancel the workqueue's work. Signed-off-by: Martin Kepplinger --- Thanks Oliver for these changes. For me, everything works as before. Dmitry, do you want a new version of the whole thing instead of this fix? thanks martin drivers/input/tablet/pegasus_notetaker.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/input/tablet/pegasus_notetaker.c b/drivers/input/tablet/pegasus_notetaker.c index 83aa583..0c339e7 100644 --- a/drivers/input/tablet/pegasus_notetaker.c +++ b/drivers/input/tablet/pegasus_notetaker.c @@ -211,14 +211,11 @@ static int pegasus_open(struct input_dev *dev) static void pegasus_close(struct input_dev *dev) { struct pegasus *pegasus = input_get_drvdata(dev); - int autopm_error; - autopm_error = usb_autopm_get_interface(pegasus->intf); usb_kill_urb(pegasus->irq); cancel_work_sync(&pegasus->init); - if (!autopm_error) - usb_autopm_put_interface(pegasus->intf); + usb_autopm_put_interface(pegasus->intf); } static int pegasus_probe(struct usb_interface *intf, @@ -364,6 +361,7 @@ static int pegasus_suspend(struct usb_interface *intf, pm_message_t message) mutex_lock(&pegasus->dev->mutex); usb_kill_urb(pegasus->irq); + cancel_work_sync(&pegasus->init); mutex_unlock(&pegasus->dev->mutex); return 0; @@ -384,6 +382,11 @@ static int pegasus_resume(struct usb_interface *intf) static int pegasus_reset_resume(struct usb_interface *intf) { + struct pegasus *pegasus = usb_get_intfdata(intf); + + if (pegasus->dev->users) + pegasus_set_mode(pegasus, PEN_MODE_XY, NOTETAKER_LED_MOUSE); + return pegasus_resume(intf); }