提交 de1e27a6 编写于 作者: H H Hartley Sweeten 提交者: Greg Kroah-Hartman

staging: comedi: ni_pcidio: factor board reset out of attach

Factor the code that resets the board and disables the interrupts out
of the attach.

Move the reset so it happens before the subdevices are initialized.
Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: NIan Abbott <abbotti@mev.co.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 9eba3a27
......@@ -949,6 +949,19 @@ static int pci_6534_upload_firmware(struct comedi_device *dev)
return ret;
}
static void nidio_reset_board(struct comedi_device *dev)
{
struct nidio96_private *devpriv = dev->private;
void __iomem *daq_mmio = devpriv->mite->daq_io_addr;
writel(0, daq_mmio + Port_IO(0));
writel(0, daq_mmio + Port_Pin_Directions(0));
writel(0, daq_mmio + Port_Pin_Mask(0));
/* disable interrupts on board */
writeb(0, daq_mmio + Master_DMA_And_Interrupt_Control);
}
static int nidio_auto_attach(struct comedi_device *dev,
unsigned long context)
{
......@@ -996,6 +1009,8 @@ static int nidio_auto_attach(struct comedi_device *dev,
return ret;
}
nidio_reset_board(dev);
ret = comedi_alloc_subdevices(dev, 1);
if (ret)
return ret;
......@@ -1023,15 +1038,6 @@ static int nidio_auto_attach(struct comedi_device *dev,
s->async_dma_dir = DMA_BIDIRECTIONAL;
s->poll = &ni_pcidio_poll;
writel(0, devpriv->mite->daq_io_addr + Port_IO(0));
writel(0, devpriv->mite->daq_io_addr + Port_Pin_Directions(0));
writel(0, devpriv->mite->daq_io_addr + Port_Pin_Mask(0));
/* disable interrupts on board */
writeb(0x00,
devpriv->mite->daq_io_addr +
Master_DMA_And_Interrupt_Control);
irq = mite_irq(devpriv->mite);
if (irq) {
ret = request_irq(irq, nidio_interrupt, IRQF_SHARED,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册