From 2abfa258a959cb615e7be68e351811c6ae7e312a Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Wed, 7 Aug 2002 17:32:51 +0000 Subject: [PATCH] fixed freeing of mite resources in detach for pci-1200, re-added allocation of io mem regions in mite.c (was removed earlier due to my wrong assumption about the nature of the return value from request_mem_region). --- comedi/drivers/mite.c | 5 +++++ comedi/drivers/ni_labpc.c | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/comedi/drivers/mite.c b/comedi/drivers/mite.c index 0d48eaf9..103a7d90 100644 --- a/comedi/drivers/mite.c +++ b/comedi/drivers/mite.c @@ -103,6 +103,10 @@ int mite_setup(struct mite_struct *mite) unsigned long offset, start, length; u32 addr; + if( pci_request_regions( mite->pcidev, "mite" ) ) { + printk("failed to request mite io regions\n"); + return -EIO; + }; if(pci_enable_device(mite->pcidev)){ printk("error enabling mite\n"); return -EIO; @@ -166,6 +170,7 @@ void mite_unsetup(struct mite_struct *mite) iounmap(mite->daq_io_addr); mite->daq_io_addr=NULL; } + pci_release_regions( mite->pcidev ); mite->used = 0; } diff --git a/comedi/drivers/ni_labpc.c b/comedi/drivers/ni_labpc.c index e2c5ceae..5c210b73 100644 --- a/comedi/drivers/ni_labpc.c +++ b/comedi/drivers/ni_labpc.c @@ -804,11 +804,13 @@ static int labpc_detach(comedi_device *dev) kfree(devpriv->dma_buffer); if(devpriv->dma_chan) free_dma(devpriv->dma_chan); - if(thisboard->bustype != pcmcia_bustype && - dev->iobase) - release_region(dev->iobase, LABPC_SIZE); if(dev->irq) comedi_free_irq(dev->irq, dev); + if(thisboard->bustype == isa_bustype && + dev->iobase) + release_region(dev->iobase, LABPC_SIZE); + if( devpriv->mite ) + mite_unsetup( devpriv->mite ); return 0; }; -- 2.26.2