staging: comedi: mite: introduce mite_ack_linkc()
Introduce a helper function to handle the ack of a LINKC interrupt. Tidy up the drivers that use the new helper. The extra check for CHSR_INT in the ni_pcidio driver is not necessary. This bit will be set if any of the interrupt sources, including CHSR_LINKC, have generated an interrupt. Remove the extra check. The mite_get_status() function is now only used by the mite driver. Make it static and remove the export. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
96f3153000
commit
4d88096df9
|
@ -622,7 +622,7 @@ int mite_sync_output_dma(struct mite_channel *mite_chan,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(mite_sync_output_dma);
|
EXPORT_SYMBOL_GPL(mite_sync_output_dma);
|
||||||
|
|
||||||
unsigned int mite_get_status(struct mite_channel *mite_chan)
|
static unsigned int mite_get_status(struct mite_channel *mite_chan)
|
||||||
{
|
{
|
||||||
struct mite_struct *mite = mite_chan->mite;
|
struct mite_struct *mite = mite_chan->mite;
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
|
@ -639,7 +639,20 @@ unsigned int mite_get_status(struct mite_channel *mite_chan)
|
||||||
spin_unlock_irqrestore(&mite->lock, flags);
|
spin_unlock_irqrestore(&mite->lock, flags);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(mite_get_status);
|
|
||||||
|
unsigned int mite_ack_linkc(struct mite_channel *mite_chan)
|
||||||
|
{
|
||||||
|
struct mite_struct *mite = mite_chan->mite;
|
||||||
|
unsigned int status;
|
||||||
|
|
||||||
|
status = mite_get_status(mite_chan);
|
||||||
|
if (status & CHSR_LINKC)
|
||||||
|
writel(CHOR_CLRLC,
|
||||||
|
mite->mite_io_addr + MITE_CHOR(mite_chan->channel));
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(mite_ack_linkc);
|
||||||
|
|
||||||
int mite_done(struct mite_channel *mite_chan)
|
int mite_done(struct mite_channel *mite_chan)
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,7 +97,7 @@ int mite_sync_input_dma(struct mite_channel *mite_chan,
|
||||||
int mite_sync_output_dma(struct mite_channel *mite_chan,
|
int mite_sync_output_dma(struct mite_channel *mite_chan,
|
||||||
struct comedi_subdevice *s);
|
struct comedi_subdevice *s);
|
||||||
u32 mite_bytes_in_transit(struct mite_channel *mite_chan);
|
u32 mite_bytes_in_transit(struct mite_channel *mite_chan);
|
||||||
unsigned int mite_get_status(struct mite_channel *mite_chan);
|
unsigned int mite_ack_linkc(struct mite_channel *mite_chan);
|
||||||
int mite_done(struct mite_channel *mite_chan);
|
int mite_done(struct mite_channel *mite_chan);
|
||||||
|
|
||||||
void mite_prep_dma(struct mite_channel *mite_chan,
|
void mite_prep_dma(struct mite_channel *mite_chan,
|
||||||
|
|
|
@ -3697,13 +3697,7 @@ static void handle_cdio_interrupt(struct comedi_device *dev)
|
||||||
|
|
||||||
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
|
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
|
||||||
if (devpriv->cdo_mite_chan) {
|
if (devpriv->cdo_mite_chan) {
|
||||||
unsigned int cdo_mite_status =
|
mite_ack_linkc(devpriv->cdo_mite_chan);
|
||||||
mite_get_status(devpriv->cdo_mite_chan);
|
|
||||||
if (cdo_mite_status & CHSR_LINKC) {
|
|
||||||
writel(CHOR_CLRLC,
|
|
||||||
devpriv->mite->mite_io_addr +
|
|
||||||
MITE_CHOR(devpriv->cdo_mite_chan->channel));
|
|
||||||
}
|
|
||||||
mite_sync_output_dma(devpriv->cdo_mite_chan, s);
|
mite_sync_output_dma(devpriv->cdo_mite_chan, s);
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
|
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
|
||||||
|
@ -5222,22 +5216,10 @@ static irqreturn_t ni_E_interrupt(int irq, void *d)
|
||||||
unsigned long flags_too;
|
unsigned long flags_too;
|
||||||
|
|
||||||
spin_lock_irqsave(&devpriv->mite_channel_lock, flags_too);
|
spin_lock_irqsave(&devpriv->mite_channel_lock, flags_too);
|
||||||
if (devpriv->ai_mite_chan) {
|
if (devpriv->ai_mite_chan)
|
||||||
ai_mite_status = mite_get_status(devpriv->ai_mite_chan);
|
ai_mite_status = mite_ack_linkc(devpriv->ai_mite_chan);
|
||||||
if (ai_mite_status & CHSR_LINKC)
|
if (devpriv->ao_mite_chan)
|
||||||
writel(CHOR_CLRLC,
|
ao_mite_status = mite_ack_linkc(devpriv->ao_mite_chan);
|
||||||
devpriv->mite->mite_io_addr +
|
|
||||||
MITE_CHOR(devpriv->
|
|
||||||
ai_mite_chan->channel));
|
|
||||||
}
|
|
||||||
if (devpriv->ao_mite_chan) {
|
|
||||||
ao_mite_status = mite_get_status(devpriv->ao_mite_chan);
|
|
||||||
if (ao_mite_status & CHSR_LINKC)
|
|
||||||
writel(CHOR_CLRLC,
|
|
||||||
devpriv->mite->mite_io_addr +
|
|
||||||
MITE_CHOR(devpriv->
|
|
||||||
ao_mite_chan->channel));
|
|
||||||
}
|
|
||||||
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags_too);
|
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags_too);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -381,12 +381,10 @@ static irqreturn_t nidio_interrupt(int irq, void *d)
|
||||||
struct nidio96_private *devpriv = dev->private;
|
struct nidio96_private *devpriv = dev->private;
|
||||||
struct comedi_subdevice *s = dev->read_subdev;
|
struct comedi_subdevice *s = dev->read_subdev;
|
||||||
struct comedi_async *async = s->async;
|
struct comedi_async *async = s->async;
|
||||||
struct mite_struct *mite = devpriv->mite;
|
|
||||||
unsigned int auxdata;
|
unsigned int auxdata;
|
||||||
int flags;
|
int flags;
|
||||||
int status;
|
int status;
|
||||||
int work = 0;
|
int work = 0;
|
||||||
unsigned int m_status = 0;
|
|
||||||
|
|
||||||
/* interrupcions parasites */
|
/* interrupcions parasites */
|
||||||
if (!dev->attached) {
|
if (!dev->attached) {
|
||||||
|
@ -401,14 +399,10 @@ static irqreturn_t nidio_interrupt(int irq, void *d)
|
||||||
flags = readb(dev->mmio + Group_1_Flags);
|
flags = readb(dev->mmio + Group_1_Flags);
|
||||||
|
|
||||||
spin_lock(&devpriv->mite_channel_lock);
|
spin_lock(&devpriv->mite_channel_lock);
|
||||||
if (devpriv->di_mite_chan)
|
if (devpriv->di_mite_chan) {
|
||||||
m_status = mite_get_status(devpriv->di_mite_chan);
|
unsigned int m_status = mite_ack_linkc(devpriv->di_mite_chan);
|
||||||
|
|
||||||
if (m_status & CHSR_INT) {
|
|
||||||
if (m_status & CHSR_LINKC) {
|
if (m_status & CHSR_LINKC) {
|
||||||
writel(CHOR_CLRLC,
|
|
||||||
mite->mite_io_addr +
|
|
||||||
MITE_CHOR(devpriv->di_mite_chan->channel));
|
|
||||||
mite_sync_input_dma(devpriv->di_mite_chan, s);
|
mite_sync_input_dma(devpriv->di_mite_chan, s);
|
||||||
/* XXX need to byteswap */
|
/* XXX need to byteswap */
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,7 +400,6 @@ void ni_tio_handle_interrupt(struct ni_gpct *counter,
|
||||||
struct comedi_subdevice *s)
|
struct comedi_subdevice *s)
|
||||||
{
|
{
|
||||||
unsigned int cidx = counter->counter_index;
|
unsigned int cidx = counter->counter_index;
|
||||||
unsigned int gpct_mite_status;
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int gate_error;
|
int gate_error;
|
||||||
int tc_error;
|
int tc_error;
|
||||||
|
@ -429,16 +428,10 @@ void ni_tio_handle_interrupt(struct ni_gpct *counter,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
spin_lock_irqsave(&counter->lock, flags);
|
spin_lock_irqsave(&counter->lock, flags);
|
||||||
if (!counter->mite_chan) {
|
if (counter->mite_chan) {
|
||||||
spin_unlock_irqrestore(&counter->lock, flags);
|
mite_ack_linkc(counter->mite_chan);
|
||||||
return;
|
mite_sync_input_dma(counter->mite_chan, s);
|
||||||
}
|
}
|
||||||
gpct_mite_status = mite_get_status(counter->mite_chan);
|
|
||||||
if (gpct_mite_status & CHSR_LINKC)
|
|
||||||
writel(CHOR_CLRLC,
|
|
||||||
counter->mite_chan->mite->mite_io_addr +
|
|
||||||
MITE_CHOR(counter->mite_chan->channel));
|
|
||||||
mite_sync_input_dma(counter->mite_chan, s);
|
|
||||||
spin_unlock_irqrestore(&counter->lock, flags);
|
spin_unlock_irqrestore(&counter->lock, flags);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(ni_tio_handle_interrupt);
|
EXPORT_SYMBOL_GPL(ni_tio_handle_interrupt);
|
||||||
|
|
Loading…
Reference in New Issue