mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] zr36120: switch to pci_get_device refcounting API
@ 2006-09-15 14:31 Alan Cox
  0 siblings, 0 replies; only message in thread
From: Alan Cox @ 2006-09-15 14:31 UTC (permalink / raw)
  To: mchehab, linux-kernel

Signed-off-by: Alan Cox <alan@redhat.com>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.18-rc6-mm1/drivers/media/video/zr36120.c linux-2.6.18-rc6-mm1/drivers/media/video/zr36120.c
--- linux.vanilla-2.6.18-rc6-mm1/drivers/media/video/zr36120.c	2006-09-11 11:02:17.000000000 +0100
+++ linux-2.6.18-rc6-mm1/drivers/media/video/zr36120.c	2006-09-14 17:27:39.000000000 +0100
@@ -1836,16 +1840,16 @@
 	struct zoran *ztv;
 	struct pci_dev *dev = NULL;
 	unsigned char revision;
-	int zoran_num=0;
+	int zoran_num = 0;
 
-	while ((dev = pci_find_device(PCI_VENDOR_ID_ZORAN,PCI_DEVICE_ID_ZORAN_36120, dev)))
+	while ((dev = pci_get_device(PCI_VENDOR_ID_ZORAN,PCI_DEVICE_ID_ZORAN_36120, dev)))
 	{
 		/* Ok, a ZR36120/ZR36125 found! */
 		ztv = &zorans[zoran_num];
 		ztv->dev = dev;
 
 		if (pci_enable_device(dev))
-			return -EIO;
+			continue;
 
 		pci_read_config_byte(dev, PCI_CLASS_REVISION, &revision);
 		printk(KERN_INFO "zoran: Zoran %x (rev %d) ",
@@ -1863,17 +1867,18 @@
 		{
 			iounmap(ztv->zoran_mem);
 			printk(KERN_ERR "zoran: Bad irq number or handler\n");
-			return -EINVAL;
+			continue;
 		}
 		if (result==-EBUSY)
 			printk(KERN_ERR "zoran: IRQ %d busy, change your PnP config in BIOS\n",dev->irq);
 		if (result < 0) {
 			iounmap(ztv->zoran_mem);
-			return result;
+			continue;
 		}
 		/* Enable bus-mastering */
 		pci_set_master(dev);
-
+		/* Keep a reference */
+		pci_dev_get(dev);
 		zoran_num++;
 	}
 	if(zoran_num)
@@ -2037,6 +2043,9 @@
 		if (ztv->zoran_mem)
 			iounmap(ztv->zoran_mem);
 
+		/* Drop PCI device */
+		pci_dev_put(ztv->dev);
+		
 		video_unregister_device(&ztv->video_dev);
 		video_unregister_device(&ztv->vbi_dev);
 	}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-09-15 14:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-15 14:31 [PATCH] zr36120: switch to pci_get_device refcounting API Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome