From patchwork Fri Jun 25 08:22:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 108008 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o5P8MJ3C031730 for ; Fri, 25 Jun 2010 08:22:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752471Ab0FYIWZ (ORCPT ); Fri, 25 Jun 2010 04:22:25 -0400 Received: from mail-px0-f174.google.com ([209.85.212.174]:44354 "EHLO mail-px0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751750Ab0FYIWY (ORCPT ); Fri, 25 Jun 2010 04:22:24 -0400 Received: by pxi8 with SMTP id 8so593923pxi.19 for ; Fri, 25 Jun 2010 01:22:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:subject:to:cc:date :message-id:in-reply-to:references:user-agent:mime-version :content-type:content-transfer-encoding; bh=0GhRtgZCGlJPc882an7UpXzOzYFPydTTtD9A6utNDI8=; b=AnHTEFJNJoxdvTOe8qD+YqqnnQUAFWb6UGShTIvqGezFY2p2Ev+wooPNc1hFG3Upok k6Q3NyCVndLci8Bk0a5iJX8EYra0NPiCJXVuzJKYAB20uQbwa4EmipvAPseBUF15CUJk +OL2YEWfkkz74A7oqaQNBZ/KRnfOlmwVZSXo0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:subject:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; b=yH476F0Pxnfvrs85YjHCGsAxyGXsvvX4QrNpsTHxQU7LBVu3YUdrjPYJBHTPcBGnlA gIcsqPs8nZSJ/QyAx5tooABFzMHrGAwbqqdhsHBf/lg6jLLyp/+g6COWhBCvBa1XIST6 e9H321r9TOFM+bd0q+LJK0Bf22NPlO0mCFOxc= Received: by 10.143.26.1 with SMTP id d1mr342089wfj.311.1277454143141; Fri, 25 Jun 2010 01:22:23 -0700 (PDT) Received: from mailhub.coreip.homeip.net (c-24-6-153-206.hsd1.ca.comcast.net [24.6.153.206]) by mx.google.com with ESMTPS id h11sm304518rvm.20.2010.06.25.01.22.21 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 25 Jun 2010 01:22:22 -0700 (PDT) From: Dmitry Torokhov Subject: [PATCH 1/4] Input: ad7879 - use threaded IRQ To: Mike Frysinger , Michael Hennerich Cc: linux-input@vger.kernel.org Date: Fri, 25 Jun 2010 01:22:18 -0700 Message-ID: <20100625082218.8617.36197.stgit@localhost.localdomain> In-Reply-To: <20100625081847.8617.31150.stgit@localhost.localdomain> References: <20100625081847.8617.31150.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 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 (demeter.kernel.org [140.211.167.41]); Fri, 25 Jun 2010 08:22:25 +0000 (UTC) diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index 4b32fb4..f947457 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -131,13 +130,12 @@ typedef struct i2c_client bus_device; struct ad7879 { bus_device *bus; struct input_dev *input; - struct work_struct work; struct timer_list timer; #ifdef CONFIG_GPIOLIB struct gpio_chip gc; #endif struct mutex mutex; - unsigned disabled:1; /* P: mutex */ + bool disabled; /* P: mutex */ #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE) struct spi_message msg; @@ -196,16 +194,6 @@ static void ad7879_report(struct ad7879 *ts) } } -static void ad7879_work(struct work_struct *work) -{ - struct ad7879 *ts = container_of(work, struct ad7879, work); - - /* use keventd context to read the result registers */ - ad7879_collect(ts); - ad7879_report(ts); - mod_timer(&ts->timer, jiffies + TS_PEN_UP_TIMEOUT); -} - static void ad7879_ts_event_release(struct ad7879 *ts) { struct input_dev *input_dev = ts->input; @@ -225,13 +213,10 @@ static irqreturn_t ad7879_irq(int irq, void *handle) { struct ad7879 *ts = handle; - /* The repeated conversion sequencer controlled by TMR kicked off too fast. - * We ignore the last and process the sample sequence currently in the queue. - * It can't be older than 9.4ms - */ + ad7879_collect(ts); + ad7879_report(ts); - if (!work_pending(&ts->work)) - schedule_work(&ts->work); + mod_timer(&ts->timer, jiffies + TS_PEN_UP_TIMEOUT); return IRQ_HANDLED; } @@ -249,11 +234,9 @@ static void ad7879_disable(struct ad7879 *ts) if (!ts->disabled) { - ts->disabled = 1; + ts->disabled = true; disable_irq(ts->bus->irq); - cancel_work_sync(&ts->work); - if (del_timer_sync(&ts->timer)) ad7879_ts_event_release(ts); @@ -270,7 +253,7 @@ static void ad7879_enable(struct ad7879 *ts) if (ts->disabled) { ad7879_setup(ts); - ts->disabled = 0; + ts->disabled = false; enable_irq(ts->bus->irq); } @@ -458,7 +441,6 @@ static int __devinit ad7879_construct(bus_device *bus, struct ad7879 *ts) ts->input = input_dev; setup_timer(&ts->timer, ad7879_timer, (unsigned long) ts); - INIT_WORK(&ts->work, ad7879_work); mutex_init(&ts->mutex); ts->x_plate_ohms = pdata->x_plate_ohms ? : 400; @@ -526,9 +508,9 @@ static int __devinit ad7879_construct(bus_device *bus, struct ad7879 *ts) ad7879_setup(ts); - err = request_irq(bus->irq, ad7879_irq, - IRQF_TRIGGER_FALLING, bus->dev.driver->name, ts); - + err = request_threaded_irq(bus->irq, NULL, ad7879_irq, + IRQF_TRIGGER_FALLING, + bus->dev.driver->name, ts); if (err) { dev_err(&bus->dev, "irq %d busy?\n", bus->irq); goto err_free_mem;