From patchwork Mon Mar 21 16:24:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Koskinen, Aaro (Nokia - FI/Espoo)" X-Patchwork-Id: 648301 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 p2LGR9vP004333 for ; Mon, 21 Mar 2011 16:27:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753671Ab1CUQ1G (ORCPT ); Mon, 21 Mar 2011 12:27:06 -0400 Received: from smtp.nokia.com ([147.243.128.26]:39292 "EHLO mgw-da02.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753654Ab1CUQ1G (ORCPT ); Mon, 21 Mar 2011 12:27:06 -0400 Received: from nokia.com (localhost [127.0.0.1]) by mgw-da02.nokia.com (Switch-3.4.3/Switch-3.4.3) with ESMTP id p2LGR1CN019476; Mon, 21 Mar 2011 18:27:01 +0200 Received: from localhost.localdomain ([helruo-dhcp02150.ntc.nokia.com [172.21.21.50]]) by mgw-da02.nokia.com with RELAY id p2LGQX3k018854 ; Mon, 21 Mar 2011 18:26:36 +0200 From: Aaro Koskinen To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Aaro Koskinen Subject: [PATCH] input: tsc2005: fix locking issue Date: Mon, 21 Mar 2011 18:24:10 +0200 Message-Id: <1300724650-6641-1-git-send-email-aaro.koskinen@nokia.com> X-Mailer: git-send-email 1.5.6.5 X-Nokia-AV: Clean 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.6 (demeter1.kernel.org [140.211.167.41]); Mon, 21 Mar 2011 16:27:10 +0000 (UTC) diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c index 8742061..3a15587 100644 --- a/drivers/input/touchscreen/tsc2005.c +++ b/drivers/input/touchscreen/tsc2005.c @@ -345,7 +345,7 @@ static void __tsc2005_disable(struct tsc2005 *ts) disable_irq(ts->spi->irq); del_timer_sync(&ts->penup_timer); - cancel_delayed_work_sync(&ts->esd_work); + cancel_delayed_work(&ts->esd_work); enable_irq(ts->spi->irq); } @@ -479,6 +479,12 @@ static void tsc2005_esd_work(struct work_struct *work) mutex_lock(&ts->mutex); + /* The device has been just closed or suspended. */ + if (!ts->opened || ts->suspended) { + mutex_unlock(&ts->mutex); + return; + } + if (time_is_after_jiffies(ts->last_valid_interrupt + msecs_to_jiffies(ts->esd_timeout))) goto out; @@ -685,6 +691,7 @@ static int __devexit tsc2005_remove(struct spi_device *spi) free_irq(ts->spi->irq, ts); input_unregister_device(ts->idev); + cancel_delayed_work_sync(&ts->esd_work); kfree(ts); spi_set_drvdata(spi, NULL);