From patchwork Sat Feb 6 15:30:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrique de Moraes Holschuh X-Patchwork-Id: 77522 X-Patchwork-Delegate: lenb@kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o16FUeRV013352 for ; Sat, 6 Feb 2010 15:30:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753003Ab0BFPak (ORCPT ); Sat, 6 Feb 2010 10:30:40 -0500 Received: from out2.smtp.messagingengine.com ([66.111.4.26]:51815 "EHLO out2.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753071Ab0BFPaj (ORCPT ); Sat, 6 Feb 2010 10:30:39 -0500 Received: from compute2.internal (compute2.internal [10.202.2.42]) by gateway1.messagingengine.com (Postfix) with ESMTP id F38CDDFAF1; Sat, 6 Feb 2010 10:30:38 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute2.internal (MEProxy); Sat, 06 Feb 2010 10:30:39 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=from:to:cc:subject:date:message-id:in-reply-to:references; s=smtpout; bh=tELGD2m0RjRQjl6cY3XQRwDmI1A=; b=IbI+N9k6FxiQltkVPnJ/HGroNP526OHSujc2Ujvf90P2X2qFHa4kIVf/L1VbLBLQTJDnf+1eH7G3UW3abVif38JMlMLfEza9EXU++iCP1sQMHUnKTM4z+a5FrU46vdCtwJQ9WPc4oCIgZcVEaogXDzWmAEi2g1WNYnw7pVzF8wU= X-Sasl-enc: NqV/V7wQ8rGathDwgwLnQ1ysos50+pJpphNT0Lh5N01T 1265470238 Received: from khazad-dum.debian.net (unknown [201.82.165.62]) by mail.messagingengine.com (Postfix) with ESMTPSA id 98C6C4BF935; Sat, 6 Feb 2010 10:30:38 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by localhost.khazad-dum.debian.net (Postfix) with ESMTP id CD81428242; Sat, 6 Feb 2010 13:30:36 -0200 (BRST) X-Virus-Scanned: Debian amavisd-new at khazad-dum.debian.net Received: from khazad-dum.debian.net ([127.0.0.1]) by localhost (khazad-dum.debian.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id irhbXAwa3gHp; Sat, 6 Feb 2010 13:30:35 -0200 (BRST) Received: by khazad-dum.debian.net (Postfix, from userid 1000) id 0E1652806B; Sat, 6 Feb 2010 13:30:34 -0200 (BRST) From: Henrique de Moraes Holschuh To: Len Brown Cc: linux-acpi@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, Henrique de Moraes Holschuh Subject: [PATCH 3/4] thinkpad-acpi: fix poll thread auto-start Date: Sat, 6 Feb 2010 13:30:29 -0200 Message-Id: <1265470230-30797-4-git-send-email-hmh@hmh.eng.br> X-Mailer: git-send-email 1.6.5.2 In-Reply-To: <1265470230-30797-1-git-send-email-hmh@hmh.eng.br> References: <1265470230-30797-1-git-send-email-hmh@hmh.eng.br> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 06 Feb 2010 15:30:43 +0000 (UTC) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index a3f440c..f2dee94 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -2607,16 +2607,11 @@ static int hotkey_inputdev_open(struct input_dev *dev) { switch (tpacpi_lifecycle) { case TPACPI_LIFE_INIT: - /* - * hotkey_init will call hotkey_poll_setup_safe - * at the appropriate moment - */ - return 0; - case TPACPI_LIFE_EXITING: - return -EBUSY; case TPACPI_LIFE_RUNNING: hotkey_poll_setup_safe(false); return 0; + case TPACPI_LIFE_EXITING: + return -EBUSY; } /* Should only happen if tpacpi_lifecycle is corrupt */ @@ -2627,7 +2622,7 @@ static int hotkey_inputdev_open(struct input_dev *dev) static void hotkey_inputdev_close(struct input_dev *dev) { /* disable hotkey polling when possible */ - if (tpacpi_lifecycle == TPACPI_LIFE_RUNNING && + if (tpacpi_lifecycle != TPACPI_LIFE_EXITING && !(hotkey_source_mask & hotkey_driver_mask)) hotkey_poll_setup_safe(false); } @@ -9038,6 +9033,9 @@ static int __init thinkpad_acpi_module_init(void) return ret; } } + + tpacpi_lifecycle = TPACPI_LIFE_RUNNING; + ret = input_register_device(tpacpi_inputdev); if (ret < 0) { printk(TPACPI_ERR "unable to register input device\n"); @@ -9047,7 +9045,6 @@ static int __init thinkpad_acpi_module_init(void) tp_features.input_device_registered = 1; } - tpacpi_lifecycle = TPACPI_LIFE_RUNNING; return 0; }