lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 17 Jul 2013 18:26:40 +0100
From:	Zubair Lutfullah <zubair.lutfullah@...il.com>
To:	jic23@....ac.uk
Cc:	linux-iio@...r.kernel.org, gregkh@...uxfoundation.org,
	linux-kernel@...r.kernel.org, koen@...inion.thruhere.net,
	zubair.lutfullah@...il.com
Subject: [PATCH 11/21] iio: ti_adc: Avoid double threshold event

The threshold event handler is being called before the FIFO has

actually reached the threshold.

The current code receives a FIFO threshold event, masks the interrupt,

clears the event, and schedules a workqueue. The workqueue is run, it

empties the FIFO, and unmasks the interrupt.

In the above sequence, after the event is cleared, it immediately

retriggers since the FIFO remains beyond the threshold. When the IRQ is

unmasked, this triggered event generates another IRQ. However, as the

FIFO has just been emptied, it is likely to not contain enough samples.

The waits to clear the event until the FIFO has actually been emptied,

in the workqueue. The unmasking and masking of the interrupt remains

unchanged.

Signed-off-by: Russ Dill <Russ.Dill@...com>
Signed-off-by: Zubair Lutfullah <zubair.lutfullah@...il.com>
---
 drivers/iio/adc/ti_am335x_adc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index e510da7..fcd414d 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -193,8 +193,7 @@ static irqreturn_t tiadc_irq(int irq, void *private)
                 } else {
                         wake_up_interruptible(&adc_dev->wq_data_avail);
                 }
-                tiadc_writel(adc_dev, REG_IRQSTATUS,
-					IRQENB_FIFO1THRES);
+
                 return IRQ_HANDLED;      
 	} else {
                 return IRQ_NONE;
@@ -230,6 +229,8 @@ static void tiadc_poll_handler(struct work_struct *work_s)
         }
 
         buffer->access->store_to(buffer, (u8 *) iBuf);
+	tiadc_writel(adc_dev, REG_IRQSTATUS,
+				IRQENB_FIFO1THRES);
         tiadc_writel(adc_dev, REG_IRQENABLE, 
 				IRQENB_FIFO1THRES);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ