From patchwork Mon Sep 13 14:56:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 174632 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8DEuinr000692 for ; Mon, 13 Sep 2010 14:56:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752594Ab0IMOzx (ORCPT ); Mon, 13 Sep 2010 10:55:53 -0400 Received: from cantor2.suse.de ([195.135.220.15]:51768 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752678Ab0IMOzt (ORCPT ); Mon, 13 Sep 2010 10:55:49 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id 4612C867E2; Mon, 13 Sep 2010 16:55:48 +0200 (CEST) From: Oliver Neukum Organization: SUSE To: Jiri Slaby Subject: Re: wacom + runtime PM = AA deadlock Date: Mon, 13 Sep 2010 16:56:17 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.34-12-desktop; KDE/4.4.4; x86_64; ; ) Cc: pingc@wacom.com, Dmitry Torokhov , linux-input@vger.kernel.org, Linux kernel mailing list , "linux-pm" References: <4C8E180D.4020309@suse.cz> In-Reply-To: <4C8E180D.4020309@suse.cz> MIME-Version: 1.0 Message-Id: <201009131656.18199.oneukum@suse.de> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 13 Sep 2010 14:56:44 +0000 (UTC) diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 42ba369..e399a8a 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -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; }