fixed freeing of mite resources in detach for pci-1200, re-added allocation
authorFrank Mori Hess <fmhess@speakeasy.net>
Wed, 7 Aug 2002 17:32:51 +0000 (17:32 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Wed, 7 Aug 2002 17:32:51 +0000 (17:32 +0000)
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
comedi/drivers/ni_labpc.c

index 0d48eaf920552eccc5e515bcbc41d5eb7257909a..103a7d90400875c1ba083b1fe6c1d8b813fe2eba 100644 (file)
@@ -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;
 }
index e2c5ceaedb41bdc37a85918d07c5ac6a98a2960a..5c210b73db573970d82622df2b5141e5ced1ec0f 100644 (file)
@@ -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;
 };