From patchwork Fri Feb 26 04:11:21 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: 82252 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 o1Q4KsiX013612 for ; Fri, 26 Feb 2010 04:20:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759482Ab0BZEU4 (ORCPT ); Thu, 25 Feb 2010 23:20:56 -0500 Received: from out1.smtp.messagingengine.com ([66.111.4.25]:57386 "EHLO out1.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759463Ab0BZEUx (ORCPT ); Thu, 25 Feb 2010 23:20:53 -0500 Received: from compute2.internal (compute2.internal [10.202.2.42]) by gateway1.messagingengine.com (Postfix) with ESMTP id 87322E24D1; Thu, 25 Feb 2010 23:11:30 -0500 (EST) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute2.internal (MEProxy); Thu, 25 Feb 2010 23:11:30 -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=8KuDg030L8gZhRQILmM1msuz6Wk=; b=EjSWgrwKx97D1K2v7Z4Hdzo/Pb87HamlAc88yD9X9XR7H4npUQo7l/pCWSlr4vapSjIYnQCiO3ZtXI6T6k8lJLVlRd05BpOrQIl8adWbRq3e71I8Zodo81xj7CbCMtAng03AEUuL7gxwD004D7jN2/STGGlU8IxtDwoq4DCxbGc= X-Sasl-enc: El04m011xl8qHYemnUeiO+GS1dI2t065Nys78ajyc0Pb 1267157490 Received: from khazad-dum.debian.net (unknown [201.82.165.62]) by mail.messagingengine.com (Postfix) with ESMTPSA id 342C912B94; Thu, 25 Feb 2010 23:11:30 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by localhost.khazad-dum.debian.net (Postfix) with ESMTP id B5C2028058; Fri, 26 Feb 2010 01:11:28 -0300 (BRT) 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 Vq4FqYR632PC; Fri, 26 Feb 2010 01:11:27 -0300 (BRT) Received: by khazad-dum.debian.net (Postfix, from userid 1000) id 196312824C; Fri, 26 Feb 2010 01:11:27 -0300 (BRT) From: Henrique de Moraes Holschuh To: Len Brown Cc: linux-acpi@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, Henrique de Moraes Holschuh , stable@kernel.org Subject: [PATCH 3/6] thinkpad-acpi: fix poll thread auto-start Date: Fri, 26 Feb 2010 01:11:21 -0300 Message-Id: <1267157484-23925-4-git-send-email-hmh@hmh.eng.br> X-Mailer: git-send-email 1.6.5.2 In-Reply-To: <1267157484-23925-1-git-send-email-hmh@hmh.eng.br> References: <1267157484-23925-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]); Fri, 26 Feb 2010 04:20:57 +0000 (UTC) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 06657b7..933bcc4 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; }