Commit a23b85a5 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: addi_apci_1564: use comedi_handle_event() for counters

The counter subdevice can generate an interrupt. Currently send_sig() is used
to let the task know when the interrupt occurs. Use the dev->read_subdev and
comedi_handle_events() instead.

Remove the, now unused, 'tsk_current' member from the private data and the
unnecessary include of <linux/sched.h>.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ff9842b6
...@@ -6,8 +6,6 @@ static int apci1564_timer_insn_config(struct comedi_device *dev, ...@@ -6,8 +6,6 @@ static int apci1564_timer_insn_config(struct comedi_device *dev,
struct apci1564_private *devpriv = dev->private; struct apci1564_private *devpriv = dev->private;
unsigned int ctrl; unsigned int ctrl;
devpriv->tsk_current = current;
/* Stop the timer */ /* Stop the timer */
ctrl = inl(devpriv->timer + ADDI_TCW_CTRL_REG); ctrl = inl(devpriv->timer + ADDI_TCW_CTRL_REG);
ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG |
...@@ -101,8 +99,6 @@ static int apci1564_counter_insn_config(struct comedi_device *dev, ...@@ -101,8 +99,6 @@ static int apci1564_counter_insn_config(struct comedi_device *dev,
unsigned long iobase = devpriv->counters + APCI1564_COUNTER(chan); unsigned long iobase = devpriv->counters + APCI1564_COUNTER(chan);
unsigned int ctrl; unsigned int ctrl;
devpriv->tsk_current = current;
/* Stop The Timer */ /* Stop The Timer */
ctrl = inl(iobase + ADDI_TCW_CTRL_REG); ctrl = inl(iobase + ADDI_TCW_CTRL_REG);
ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG |
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/sched.h>
#include "../comedi_pci.h" #include "../comedi_pci.h"
#include "addi_tcw.h" #include "addi_tcw.h"
...@@ -118,6 +117,7 @@ ...@@ -118,6 +117,7 @@
*/ */
#define APCI1564_EVENT_COS BIT(31) #define APCI1564_EVENT_COS BIT(31)
#define APCI1564_EVENT_TIMER BIT(30) #define APCI1564_EVENT_TIMER BIT(30)
#define APCI1564_EVENT_COUNTER(x) BIT(27 + (x)) /* counter 0-2 */
#define APCI1564_EVENT_MASK 0xfff0000f /* all but [19:4] */ #define APCI1564_EVENT_MASK 0xfff0000f /* all but [19:4] */
struct apci1564_private { struct apci1564_private {
...@@ -127,7 +127,6 @@ struct apci1564_private { ...@@ -127,7 +127,6 @@ struct apci1564_private {
unsigned int mode1; /* rising-edge/high level channels */ unsigned int mode1; /* rising-edge/high level channels */
unsigned int mode2; /* falling-edge/low level channels */ unsigned int mode2; /* falling-edge/low level channels */
unsigned int ctrl; /* interrupt mode OR (edge) . AND (level) */ unsigned int ctrl; /* interrupt mode OR (edge) . AND (level) */
struct task_struct *tsk_current;
}; };
#include "addi-data/hwdrv_apci1564.c" #include "addi-data/hwdrv_apci1564.c"
...@@ -200,21 +199,18 @@ static irqreturn_t apci1564_interrupt(int irq, void *d) ...@@ -200,21 +199,18 @@ static irqreturn_t apci1564_interrupt(int irq, void *d)
} }
if (devpriv->counters) { if (devpriv->counters) {
for (chan = 0; chan < 4; chan++) { for (chan = 0; chan < 3; chan++) {
unsigned long iobase; unsigned long iobase;
iobase = devpriv->counters + APCI1564_COUNTER(chan); iobase = devpriv->counters + APCI1564_COUNTER(chan);
status = inl(iobase + ADDI_TCW_IRQ_REG); status = inl(iobase + ADDI_TCW_IRQ_REG);
if (status & 0x01) { if (status & ADDI_TCW_IRQ) {
/* Disable Counter Interrupt */ s->state |= APCI1564_EVENT_COUNTER(chan);
/* clear the interrupt */
ctrl = inl(iobase + ADDI_TCW_CTRL_REG); ctrl = inl(iobase + ADDI_TCW_CTRL_REG);
outl(0x0, iobase + ADDI_TCW_CTRL_REG); outl(0x0, iobase + ADDI_TCW_CTRL_REG);
/* Send a signal to from kernel to user space */
send_sig(SIGIO, devpriv->tsk_current, 0);
/* Enable Counter Interrupt */
outl(ctrl, iobase + ADDI_TCW_CTRL_REG); outl(ctrl, iobase + ADDI_TCW_CTRL_REG);
} }
} }
......
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