aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/input/touchscreen/ads7846.c35
-rw-r--r--include/linux/spi/ads7846.h2
2 files changed, 20 insertions, 17 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);
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index 95d36bfb34bc..92bd0839d5b4 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -48,7 +48,7 @@ struct ads7846_platform_data {
48 * state if get_pendown_state == NULL 48 * state if get_pendown_state == NULL
49 */ 49 */
50 int (*get_pendown_state)(void); 50 int (*get_pendown_state)(void);
51 int (*filter_init) (struct ads7846_platform_data *pdata, 51 int (*filter_init) (const struct ads7846_platform_data *pdata,
52 void **filter_data); 52 void **filter_data);
53 int (*filter) (void *filter_data, int data_idx, int *val); 53 int (*filter) (void *filter_data, int data_idx, int *val);
54 void (*filter_cleanup)(void *filter_data); 54 void (*filter_cleanup)(void *filter_data);