From patchwork Wed Jun 30 08:18:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 108770 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 o5U8IDWt027520 for ; Wed, 30 Jun 2010 08:18:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753168Ab0F3ISM (ORCPT ); Wed, 30 Jun 2010 04:18:12 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:35764 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752313Ab0F3ISL (ORCPT ); Wed, 30 Jun 2010 04:18:11 -0400 Received: by pvc7 with SMTP id 7so250210pvc.19 for ; Wed, 30 Jun 2010 01:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=VvyW0jp7XbW2tSJQ7Uqz9SegJg7hN2/uUjc7+VDbuHk=; b=xY7xK5MrM8D9EBP8NqwWDobsiyBoI1wXbqYb85+x6rmwfPuaku0e0dKFFES+DL9G60 xsRJETBBTR1n2Efmz2tluat4ycyXmBg4Kw1f1iddEHNGJvypup7DXGzrhqOvnp8b1Lf3 L5FBVgylnZ32wPE5uXbwOLs8AEiMZV8eq1G3o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=vpe83jzDT1kOfoDFu8Lr31sLMpd7sQmI/3jFKIRiFEZV+ZE9G7DRgSX2vL7RmYwzOG VDZJwjHgXCXOUcNwG0vpe5nNAQggLrWF1OlcUYsHIhkDvvRn/zbqdiPw3zPmLbZGIOAg c/K0XkD6A6B7GvrkXz4Xb3TPzBdVi7n7v5Wmg= Received: by 10.114.186.40 with SMTP id j40mr9172162waf.93.1277885890248; Wed, 30 Jun 2010 01:18:10 -0700 (PDT) Received: from mailhub.coreip.homeip.net ([24.6.153.206]) by mx.google.com with ESMTPS id k23sm70473345waf.17.2010.06.30.01.18.08 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 30 Jun 2010 01:18:08 -0700 (PDT) Date: Wed, 30 Jun 2010 01:18:05 -0700 From: Dmitry Torokhov To: Anatolij Gustschin Cc: linux-input@vger.kernel.org, Detlev Zundel Subject: Re: [PATCH v2 2/2] Input: ads7846 - extend the driver for ads7845 controller support Message-ID: <20100630081805.GD4154@core.coreip.homeip.net> References: <1272630181-5364-2-git-send-email-agust@denx.de> <1277803793-15077-1-git-send-email-agust@denx.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1277803793-15077-1-git-send-email-agust@denx.de> User-Agent: Mutt/1.5.20 (2009-12-10) 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]); Wed, 30 Jun 2010 08:18:13 +0000 (UTC) diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 69210cb..8c9b316 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -878,14 +878,15 @@ static int __devinit setup_pendown(struct spi_device *spi, struct ads7846 *ts) static int __devinit ads7846_probe(struct spi_device *spi) { - struct ads7846 *ts; - struct ads7846_packet *packet; - struct input_dev *input_dev; - struct ads7846_platform_data *pdata = spi->dev.platform_data; - struct spi_message *m; - struct spi_transfer *x; - int vref; - int err; + struct ads7846 *ts; + struct ads7846_packet *packet; + struct input_dev *input_dev; + const struct ads7846_platform_data *pdata = spi->dev.platform_data; + struct spi_message *m; + struct spi_transfer *x; + unsigned long irq_flags; + int vref; + int err; if (!spi->irq) { dev_dbg(&spi->dev, "no IRQ?\n"); @@ -1174,20 +1175,22 @@ static int __devinit ads7846_probe(struct spi_device *spi) goto err_put_regulator; } - if (!pdata->irq_flags) - pdata->irq_flags = IRQF_TRIGGER_FALLING; + irq_flags = pdata->irq_flags ? : IRQF_TRIGGER_FALLING; - if (request_irq(spi->irq, ads7846_irq, pdata->irq_flags, - spi->dev.driver->name, ts)) { + err = request_irq(spi->irq, ads7846_irq, pdata->irq_flags, + spi->dev.driver->name, ts); + + if (err && !pdata->irq_flags) { dev_info(&spi->dev, "trying pin change workaround on irq %d\n", spi->irq); err = request_irq(spi->irq, ads7846_irq, IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, spi->dev.driver->name, ts); - if (err) { - dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); - goto err_disable_regulator; - } + } + + if (err) { + dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); + goto err_disable_regulator; } err = ads784x_hwmon_register(spi, ts); diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h index 95d36bf..92bd083 100644 --- a/include/linux/spi/ads7846.h +++ b/include/linux/spi/ads7846.h @@ -48,7 +48,7 @@ struct ads7846_platform_data { * state if get_pendown_state == NULL */ int (*get_pendown_state)(void); - int (*filter_init) (struct ads7846_platform_data *pdata, + int (*filter_init) (const struct ads7846_platform_data *pdata, void **filter_data); int (*filter) (void *filter_data, int data_idx, int *val); void (*filter_cleanup)(void *filter_data);