Skip to contentSkip to conversation

Patch9:replace pci_find_device in isdn/gazel.c

KJ Surya 1 participant 2 messages Mar 12, 2007 Kernel janitors

lore
Share & tools
lore

Surya

author
#0 lore raw

Hi,
Replacing pci_find_device in gazel.c (isdn/hisax)
Applies and compiles clean on latest tree.

thanks.

---

drivers/isdn/hisax/gazel.c +9 -4
index 3efa719..a8a36cb 100644
@@ -546,10 +546,10 @@ setup_gazelpci(struct IsdnCardState *cs)
 	found = 0;
 	seekcard = PCI_DEVICE_ID_PLX_R685;
 	for (nbseek = 0; nbseek < 4; nbseek++) {
-		if ((dev_tel = pci_find_device(PCI_VENDOR_ID_PLX,
+		if ((dev_tel = pci_get_device(PCI_VENDOR_ID_PLX,
 					seekcard, dev_tel))) {
-			if (pci_enable_device(dev_tel))
-				return 1;
+				if (pci_enable_device(dev_tel))
+					goto dev_tel_cleanup;
 			pci_irq = dev_tel->irq;
 			pci_ioaddr0 = pci_resource_start(dev_tel, 1);
 			pci_ioaddr1 = pci_resource_start(dev_tel, 2);
@@ -577,7 +577,7 @@ setup_gazelpci(struct IsdnCardState *cs)
 	}
 	if (!pci_irq) {
 		printk(KERN_WARNING "Gazel: No IRQ for PCI card found\n");
-		return 1;
+		goto dev_tel_cleanup;
 	}
 	cs->hw.gazel.pciaddr[0] = pci_ioaddr0;
 	cs->hw.gazel.pciaddr[1] = pci_ioaddr1;
@@ -618,7 +618,12 @@ setup_gazelpci(struct IsdnCardState *cs)
 			break;
 	}
 
+	pci_dev_put(dev_tel);
 	return (0);
+
+dev_tel_cleanup:
+	pci_dev_put(dev_tel);
+	return 1;
 }
 
 int __devinit
Signature · 6 lines
surya.
12/03/2007
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
author
#1 lore raw

Re: [KJ] Patch9:replace pci_find_device in isdn/hisax/hfc_pci.c

Hi,
Replacing pci_find_device in hfc_pci.c (isdn/hisax)
Applies and compiles clean on latest tree.

thanks.

---

drivers/isdn/hisax/hfc_pci.c +10 -4
index 8a48a3c..b346419 100644
@@ -1665,7 +1665,7 @@ setup_hfcpci(struct IsdnCard *card)
 	if (cs->typ = ISDN_CTYPE_HFC_PCI) {
 		i = 0;
 		while (id_list[i].vendor_id) {
-			tmp_hfcpci = pci_find_device(id_list[i].vendor_id,
+			tmp_hfcpci = pci_get_device(id_list[i].vendor_id,
 						     id_list[i].device_id,
 						     dev_hfcpci);
 			i++;
@@ -1687,7 +1687,7 @@ setup_hfcpci(struct IsdnCard *card)
 			cs->irq = dev_hfcpci->irq;
 			if (!cs->irq) {
 				printk(KERN_WARNING "HFC-PCI: No IRQ for PCI card found\n");
-				return (0);
+				goto tmp_hfcpci_cleanup;
 			}
 			cs->hw.hfcpci.pci_io = (char *)(unsigned long)dev_hfcpci->resource[1].start;
 			printk(KERN_INFO "HiSax: HFC-PCI card manufacturer: %s card name: %s\n", id_list[i].vendor_name, id_list[i].card_name);
@@ -1697,14 +1697,14 @@ setup_hfcpci(struct IsdnCard *card)
 		}
 		if (!cs->hw.hfcpci.pci_io) {
 			printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n");
-			return (0);
+			goto tmp_hfcpci_cleanup;
 		}
 		/* Allocate memory for FIFOS */
 		/* Because the HFC-PCI needs a 32K physical alignment, we */
 		/* need to allocate the double mem and align the address */
 		if (!(cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) {
 			printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n");
-			return 0;
+			goto tmp_hfcpci_cleanup;
 		}
 		cs->hw.hfcpci.fifos = (void *)
 		    (((ulong) cs->hw.hfcpci.share_start) & ~0x7FFF) + 0x8000;
@@ -1741,9 +1741,15 @@ setup_hfcpci(struct IsdnCard *card)
 		cs->cardmsg = &hfcpci_card_msg;
 		cs->auxcmd = &hfcpci_auxcmd;
 		spin_unlock_irqrestore(&cs->lock, flags);
+
+		pci_dev_put(tmp_hfcpci);
 		return (1);
 	} else
 		return (0);	/* no valid card type */
+
+tmp_hfcpci_cleanup:
+		pci_dev_put(tmp_hfcpci);
+		return 0;
 #else
 	printk(KERN_WARNING "HFC-PCI: NO_PCI_BIOS\n");
 	return (0);
Signature · 6 lines
surya.
12/03/2007
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors