diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-07-01 09:01:50 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-07-03 13:13:22 -0700 |
commit | 0f622bf465e78c390e13c5f4a14d0b3f8fb7c7e5 (patch) | |
tree | f261ab1f1707cdcd3b84e5661a3e0c332c8fcc21 /drivers/input/touchscreen/ads7846.c | |
parent | af6e1d99ea525161f70f68ecb83d0d0f54f1bf62 (diff) | |
download | talos-obmc-linux-0f622bf465e78c390e13c5f4a14d0b3f8fb7c7e5.tar.gz talos-obmc-linux-0f622bf465e78c390e13c5f4a14d0b3f8fb7c7e5.zip |
Input: ads7846 - do not allow altering platform data
Tested-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen/ads7846.c')
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 69210cb56c54..a3771607ead5 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, 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); |