aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/ads7846.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-07-01 12:01:50 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-07-03 16:13:22 -0400
commit0f622bf465e78c390e13c5f4a14d0b3f8fb7c7e5 (patch)
treef261ab1f1707cdcd3b84e5661a3e0c332c8fcc21 /drivers/input/touchscreen/ads7846.c
parentaf6e1d99ea525161f70f68ecb83d0d0f54f1bf62 (diff)
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.c35
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)
878 878
879static int __devinit ads7846_probe(struct spi_device *spi) 879static int __devinit ads7846_probe(struct spi_device *spi)
880{ 880{
881 struct ads7846 *ts; 881 struct ads7846 *ts;
882 struct ads7846_packet *packet; 882 struct ads7846_packet *packet;
883 struct input_dev *input_dev; 883 struct input_dev *input_dev;
884 struct ads7846_platform_data *pdata = spi->dev.platform_data; 884 const struct ads7846_platform_data *pdata = spi->dev.platform_data;
885 struct spi_message *m; 885 struct spi_message *m;
886 struct spi_transfer *x; 886 struct spi_transfer *x;
887 int vref; 887 unsigned long irq_flags;
888 int err; 888 int vref;
889 int err;
889 890
890 if (!spi->irq) { 891 if (!spi->irq) {
891 dev_dbg(&spi->dev, "no IRQ?\n"); 892 dev_dbg(&spi->dev, "no IRQ?\n");
@@ -1174,20 +1175,22 @@ static int __devinit ads7846_probe(struct spi_device *spi)
1174 goto err_put_regulator; 1175 goto err_put_regulator;
1175 } 1176 }
1176 1177
1177 if (!pdata->irq_flags) 1178 irq_flags = pdata->irq_flags ? : IRQF_TRIGGER_FALLING;
1178 pdata->irq_flags = IRQF_TRIGGER_FALLING;
1179 1179
1180 if (request_irq(spi->irq, ads7846_irq, pdata->irq_flags, 1180 err = request_irq(spi->irq, ads7846_irq, irq_flags,
1181 spi->dev.driver->name, ts)) { 1181 spi->dev.driver->name, ts);
1182
1183 if (err && !pdata->irq_flags) {
1182 dev_info(&spi->dev, 1184 dev_info(&spi->dev,
1183 "trying pin change workaround on irq %d\n", spi->irq); 1185 "trying pin change workaround on irq %d\n", spi->irq);
1184 err = request_irq(spi->irq, ads7846_irq, 1186 err = request_irq(spi->irq, ads7846_irq,
1185 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, 1187 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
1186 spi->dev.driver->name, ts); 1188 spi->dev.driver->name, ts);
1187 if (err) { 1189 }
1188 dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); 1190
1189 goto err_disable_regulator; 1191 if (err) {
1190 } 1192 dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
1193 goto err_disable_regulator;
1191 } 1194 }
1192 1195
1193 err = ads784x_hwmon_register(spi, ts); 1196 err = ads784x_hwmon_register(spi, ts);