Commit 0f622bf4 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: ads7846 - do not allow altering platform data

Tested-by: default avatarAnatolij Gustschin <agust@denx.de>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent af6e1d99
...@@ -878,14 +878,15 @@ static int __devinit setup_pendown(struct spi_device *spi, struct ads7846 *ts) ...@@ -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) static int __devinit ads7846_probe(struct spi_device *spi)
{ {
struct ads7846 *ts; struct ads7846 *ts;
struct ads7846_packet *packet; struct ads7846_packet *packet;
struct input_dev *input_dev; struct input_dev *input_dev;
struct ads7846_platform_data *pdata = spi->dev.platform_data; const struct ads7846_platform_data *pdata = spi->dev.platform_data;
struct spi_message *m; struct spi_message *m;
struct spi_transfer *x; struct spi_transfer *x;
int vref; unsigned long irq_flags;
int err; int vref;
int err;
if (!spi->irq) { if (!spi->irq) {
dev_dbg(&spi->dev, "no IRQ?\n"); dev_dbg(&spi->dev, "no IRQ?\n");
...@@ -1174,20 +1175,22 @@ static int __devinit ads7846_probe(struct spi_device *spi) ...@@ -1174,20 +1175,22 @@ static int __devinit ads7846_probe(struct spi_device *spi)
goto err_put_regulator; goto err_put_regulator;
} }
if (!pdata->irq_flags) irq_flags = pdata->irq_flags ? : IRQF_TRIGGER_FALLING;
pdata->irq_flags = IRQF_TRIGGER_FALLING;
if (request_irq(spi->irq, ads7846_irq, pdata->irq_flags, err = request_irq(spi->irq, ads7846_irq, irq_flags,
spi->dev.driver->name, ts)) { spi->dev.driver->name, ts);
if (err && !pdata->irq_flags) {
dev_info(&spi->dev, dev_info(&spi->dev,
"trying pin change workaround on irq %d\n", spi->irq); "trying pin change workaround on irq %d\n", spi->irq);
err = request_irq(spi->irq, ads7846_irq, err = request_irq(spi->irq, ads7846_irq,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
spi->dev.driver->name, ts); 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); err = ads784x_hwmon_register(spi, ts);
......
...@@ -48,7 +48,7 @@ struct ads7846_platform_data { ...@@ -48,7 +48,7 @@ struct ads7846_platform_data {
* state if get_pendown_state == NULL * state if get_pendown_state == NULL
*/ */
int (*get_pendown_state)(void); 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); void **filter_data);
int (*filter) (void *filter_data, int data_idx, int *val); int (*filter) (void *filter_data, int data_idx, int *val);
void (*filter_cleanup)(void *filter_data); void (*filter_cleanup)(void *filter_data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment