vserver 1.9.3
[linux-2.6.git] / drivers / media / dvb / bt8xx / bt878.c
index 1619f4c..7f7ec33 100644 (file)
@@ -417,6 +417,8 @@ static int __devinit bt878_probe(struct pci_dev *dev,
 
        printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n",
               bt878_num);
+       if (pci_enable_device(dev))
+               return -EIO;
 
        bt = &bt878[bt878_num];
        bt->dev = dev;
@@ -426,11 +428,10 @@ static int __devinit bt878_probe(struct pci_dev *dev,
        bt->id = dev->device;
        bt->irq = dev->irq;
        bt->bt878_adr = pci_resource_start(dev, 0);
-       if (pci_enable_device(dev))
-               return -EIO;
        if (!request_mem_region(pci_resource_start(dev, 0),
                                pci_resource_len(dev, 0), "bt878")) {
-               return -EBUSY;
+               result = -EBUSY;
+               goto fail0;
        }
 
        pci_read_config_byte(dev, PCI_CLASS_REVISION, &bt->revision);
@@ -501,6 +502,8 @@ static int __devinit bt878_probe(struct pci_dev *dev,
       fail1:
        release_mem_region(pci_resource_start(bt->dev, 0),
                           pci_resource_len(bt->dev, 0));
+      fail0:
+       pci_disable_device(dev);
        return result;
 }
 
@@ -517,7 +520,7 @@ static void __devexit bt878_remove(struct pci_dev *pci_dev)
 
        /* first disable interrupts before unmapping the memory! */
        btwrite(0, BT878_AINT_MASK);
-       btwrite(~0x0UL, BT878_AINT_STAT);
+       btwrite(~0U, BT878_AINT_STAT);
 
        /* disable PCI bus-mastering */
        pci_read_config_byte(bt->dev, PCI_COMMAND, &command);
@@ -540,6 +543,7 @@ static void __devexit bt878_remove(struct pci_dev *pci_dev)
        bt878_mem_free(bt);
 
        pci_set_drvdata(pci_dev, NULL);
+       pci_disable_device(pci_dev);
        return;
 }