[PATCH 21/22] staging: comedi: adv_pci1710: handle events and clear interrupt in common code

Ian Abbott abbotti at mev.co.uk
Thu Apr 24 20:00:38 UTC 2014


On 24/04/14 19:11, Hartley Sweeten wrote:
> On Thursday, April 24, 2014 4:50 AM, Ian Abbott wrote:
>> On 2014-04-24 00:07, H Hartley Sweeten wrote:
>>> The helper functions that handle reading the analog input samples for
>>> the interrupt function both call cfc_handle_events() and clear the
>>> interrupt request at various times.
>>>
>>> Move this to the main interrupt handler to make sure the events are
>>> posted and the interrupt request is cleared.
>>>
>>> Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
>>> Cc: Ian Abbott <abbotti at mev.co.uk>
>>> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
>>> ---
>>>    drivers/staging/comedi/drivers/adv_pci1710.c | 22 ++++------------------
>>>    1 file changed, 4 insertions(+), 18 deletions(-)
>>>
>
> [snip]
>
>>> @@ -945,6 +927,10 @@ static irqreturn_t interrupt_service_pci1710(int irq, void *d)
>>>    	else
>>>    		pci1710_handle_fifo(dev, s);
>>>
>>> +	cfc_handle_events(dev, s);
>>> +
>>> +	outb(0, dev->iobase + PCI171x_CLRINT);
>>> +
>>>    	return IRQ_HANDLED;
>>>    }
>>>
>>>
>>
>> It would be better to clear the interrupt _before_ calling
>> pci1710_handle_every_sample() or pci1710_handle_fifo() in case new data
>> arrives (and reasserts the interrupt) just after you've read the old data.
>
> I tend to agree but the original code flow has the interrupt getting cleared after
> the samples are read.

That's half true.  I.e. it's true for pci1710_handle_fifo(), but not for 
pci1710_handle_every_sample().  (Actually, both those functions read 
from the FIFO, so the function name is a bit unfortunate.)

> Maybe moving the point where the interrupt is cleared
> should be a separate patch?

Depends.  It may be easier for Greg to just take the first 11, in which 
case things can be cleaned up a bit when the remainder are reposted as a 
second series.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-


More information about the devel mailing list