From patchwork Tue Jun 14 11:20:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 9175483 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 2F29060868 for ; Tue, 14 Jun 2016 11:20:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2188E1FFC9 for ; Tue, 14 Jun 2016 11:20:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08E062824A; Tue, 14 Jun 2016 11:20:42 +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 55EDD252D5 for ; Tue, 14 Jun 2016 11:20:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751923AbcFNLU2 (ORCPT ); Tue, 14 Jun 2016 07:20:28 -0400 Received: from mout01.posteo.de ([185.67.36.65]:49551 "EHLO mout01.posteo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751886AbcFNLU0 (ORCPT ); Tue, 14 Jun 2016 07:20:26 -0400 Received: from dovecot03.posteo.de (dovecot03.posteo.de [172.16.0.13]) by mout01.posteo.de (Postfix) with ESMTPS id B9D8720B4A for ; Tue, 14 Jun 2016 13:20:22 +0200 (CEST) Received: from mail.posteo.de (localhost [127.0.0.1]) by dovecot03.posteo.de (Postfix) with ESMTPSA id 3rTRyY6vqbz5vN9; Tue, 14 Jun 2016 13:20:21 +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 v2] input: tablet: pegasus_notetaker: USB PM fixes Date: Tue, 14 Jun 2016 13:20:15 +0200 Message-Id: <1465903215-2351-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 * Fix usb_autopm calls to be balanced * In reset_resume() we need to set the device mode * In suspend() we must cancel the workqueue's work Signed-off-by: Martin Kepplinger --- Thanks Oliver, I think I got it now. Dmitry, again, do you want to have a new version of the whole driver instead of this? drivers/input/tablet/pegasus_notetaker.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/input/tablet/pegasus_notetaker.c b/drivers/input/tablet/pegasus_notetaker.c index 83aa583..0c000d8 100644 --- a/drivers/input/tablet/pegasus_notetaker.c +++ b/drivers/input/tablet/pegasus_notetaker.c @@ -211,14 +211,9 @@ 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); } static int pegasus_probe(struct usb_interface *intf, @@ -364,6 +359,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 +380,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); }