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

staging: comedi: ni_mio_common: fix interrupt handler for dev->write_subdev

There may not be a dev->write_subdev, i.e. an analog output subdevice, that
supports async commands. If it doesn't exist the interrupt/dma will never
be enabled.  Fix ni_E_interrupt() so that the analog output subdevice is
only handled if it exists.
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 72639a16
......@@ -1386,11 +1386,10 @@ static void ack_b_interrupt(struct comedi_device *dev, unsigned short b_status)
}
static void handle_b_interrupt(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned short b_status,
unsigned int ao_mite_status)
{
struct comedi_subdevice *s = dev->write_subdev;
if (b_status == 0xffff)
return;
if (b_status & NISTC_AO_STATUS1_OVERRUN) {
......@@ -5152,6 +5151,7 @@ static int ni_gpct_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
static irqreturn_t ni_E_interrupt(int irq, void *d)
{
struct comedi_device *dev = d;
struct comedi_subdevice *s_ao = dev->write_subdev;
unsigned short a_status;
unsigned short b_status;
unsigned int ai_mite_status = 0;
......@@ -5178,12 +5178,11 @@ static irqreturn_t ni_E_interrupt(int irq, void *d)
ai_mite_status = mite_ack_linkc(devpriv->ai_mite_chan,
dev->read_subdev);
if (devpriv->ao_mite_chan) {
if (s_ao && devpriv->ao_mite_chan) {
ao_mite_status = mite_ack_linkc(devpriv->ao_mite_chan,
dev->write_subdev);
s_ao);
if (ao_mite_status & CHSR_LINKC)
mite_sync_dma(devpriv->ao_mite_chan,
dev->write_subdev);
mite_sync_dma(devpriv->ao_mite_chan, s_ao);
}
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags_too);
......@@ -5193,8 +5192,9 @@ static irqreturn_t ni_E_interrupt(int irq, void *d)
ack_b_interrupt(dev, b_status);
if ((a_status & NISTC_AI_STATUS1_INTA) || (ai_mite_status & CHSR_INT))
handle_a_interrupt(dev, a_status, ai_mite_status);
if ((b_status & NISTC_AO_STATUS1_INTB) || (ao_mite_status & CHSR_INT))
handle_b_interrupt(dev, b_status, ao_mite_status);
if (s_ao &&
((b_status & NISTC_AO_STATUS1_INTB) || (ao_mite_status & CHSR_INT)))
handle_b_interrupt(dev, s_ao, b_status, ao_mite_status);
handle_gpct_interrupt(dev, 0);
handle_gpct_interrupt(dev, 1);
#ifdef PCIDMA
......
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