Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1457762 > unrolled thread
| Started by | Anders Darander <anders@chargestorm.se> |
|---|---|
| First post | 2016-08-08 14:50 +0200 |
| Last post | 2016-08-08 16:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] iio: adc: at91: unbreak channel adc channel 3 Anders Darander <anders@chargestorm.se> - 2016-08-08 14:50 +0200
Re: [PATCH] iio: adc: at91: unbreak channel adc channel 3 Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-08-08 16:00 +0200
| From | Anders Darander <anders@chargestorm.se> |
|---|---|
| Date | 2016-08-08 14:50 +0200 |
| Subject | [PATCH] iio: adc: at91: unbreak channel adc channel 3 |
| Message-ID | <s3Sad-1rV-13@gated-at.bofh.it> |
The driver always assumes that an input device has been created when
reading channel 3. This causes a kernel panic when dereferencing
st->ts_input.
The change was introduced in
commit 84882b060301 ("iio: adc: at91_adc: Add support for touchscreens
without TSMR"). Earlier versions only entered that part of the if-else
statement if only the following flags are set:
AT91_ADC_IER_XRDY | AT91_ADC_IER_YRDY | AT91_ADC_IER_PRDY
Signed-off-by: Anders Darander <anders@chargestorm.se>
---
drivers/iio/adc/at91_adc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 52430ba..0438c68 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -381,8 +381,8 @@ static irqreturn_t at91_adc_rl_interrupt(int irq, void *private)
st->ts_bufferedmeasure = false;
input_report_key(st->ts_input, BTN_TOUCH, 0);
input_sync(st->ts_input);
- } else if (status & AT91_ADC_EOC(3)) {
- /* Conversion finished */
+ } else if (status & AT91_ADC_EOC(3) && st->ts_input) {
+ /* Conversion finished and we've a touchscreen */
if (st->ts_bufferedmeasure) {
/*
* Last measurement is always discarded, since it can
--
2.8.1
[toc] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-08-08 16:00 +0200 |
| Message-ID | <s3TfY-26k-27@gated-at.bofh.it> |
| In reply to | #1457762 |
On 08/08/2016 at 14:42:16 +0200, Anders Darander wrote :
> The driver always assumes that an input device has been created when
> reading channel 3. This causes a kernel panic when dereferencing
> st->ts_input.
>
> The change was introduced in
> commit 84882b060301 ("iio: adc: at91_adc: Add support for touchscreens
> without TSMR"). Earlier versions only entered that part of the if-else
> statement if only the following flags are set:
>
> AT91_ADC_IER_XRDY | AT91_ADC_IER_YRDY | AT91_ADC_IER_PRDY
>
> Signed-off-by: Anders Darander <anders@chargestorm.se>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> drivers/iio/adc/at91_adc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index 52430ba..0438c68 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -381,8 +381,8 @@ static irqreturn_t at91_adc_rl_interrupt(int irq, void *private)
> st->ts_bufferedmeasure = false;
> input_report_key(st->ts_input, BTN_TOUCH, 0);
> input_sync(st->ts_input);
> - } else if (status & AT91_ADC_EOC(3)) {
> - /* Conversion finished */
> + } else if (status & AT91_ADC_EOC(3) && st->ts_input) {
> + /* Conversion finished and we've a touchscreen */
> if (st->ts_bufferedmeasure) {
> /*
> * Last measurement is always discarded, since it can
> --
> 2.8.1
>
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web