+ video4linux-complete-conversion-to-hotplug-safe-pci-api.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     Subject: [PATCH] video4linux: complete conversion to hotplug safe PCI API

has been added to the -mm tree.  Its filename is

     video4linux-complete-conversion-to-hotplug-safe-pci-api.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: Subject: [PATCH] video4linux: complete conversion to hotplug safe PCI API
From: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>

Signed-off-by: Alan Cox <alan@xxxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/media/video/zoran_card.c |   10 ++++++----
 drivers/media/video/zr36120.c    |   21 ++++++++++++---------
 2 files changed, 18 insertions(+), 13 deletions(-)

diff -puN drivers/media/video/zoran_card.c~video4linux-complete-conversion-to-hotplug-safe-pci-api drivers/media/video/zoran_card.c
--- a/drivers/media/video/zoran_card.c~video4linux-complete-conversion-to-hotplug-safe-pci-api
+++ a/drivers/media/video/zoran_card.c
@@ -1278,9 +1278,7 @@ find_zr36057 (void)
 
 	zoran_num = 0;
 	while (zoran_num < BUZ_MAX &&
-	       (dev =
-		pci_find_device(PCI_VENDOR_ID_ZORAN,
-				PCI_DEVICE_ID_ZORAN_36057, dev)) != NULL) {
+	       (dev = pci_get_device(PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36057, dev)) != NULL) {
 		card_num = card[zoran_num];
 		zr = &zoran[zoran_num];
 		memset(zr, 0, sizeof(struct zoran));	// Just in case if previous cycle failed
@@ -1541,7 +1539,8 @@ find_zr36057 (void)
 				goto zr_detach_vfe;
 			}
 		}
-
+		/* Success so keep the pci_dev referenced */
+		pci_dev_get(zr->pci_dev);
 		zoran_num++;
 		continue;
 
@@ -1563,6 +1562,9 @@ find_zr36057 (void)
 		iounmap(zr->zr36057_mem);
 		continue;
 	}
+	if (dev)	/* Clean up ref count on early exit */
+		pci_dev_put(dev);
+		
 	if (zoran_num == 0) {
 		dprintk(1, KERN_INFO "No known MJPEG cards found.\n");
 	}
diff -puN drivers/media/video/zr36120.c~video4linux-complete-conversion-to-hotplug-safe-pci-api drivers/media/video/zr36120.c
--- a/drivers/media/video/zr36120.c~video4linux-complete-conversion-to-hotplug-safe-pci-api
+++ a/drivers/media/video/zr36120.c
@@ -1840,16 +1840,16 @@ int __init find_zoran(void)
 	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) ",
@@ -1867,17 +1867,18 @@ int __init find_zoran(void)
 		{
 			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)
@@ -2041,6 +2042,9 @@ void release_zoran(int max)
 		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);
 	}
@@ -2057,13 +2061,12 @@ int __init zr36120_init(void)
 
 	handle_chipset();
 	zoran_cards = find_zoran();
-	if (zoran_cards<0)
-		/* no cards found, no need for a driver */
+	if (zoran_cards <= 0)
 		return -EIO;
 
 	/* initialize Zorans */
 	for (card=0; card<zoran_cards; card++) {
-		if (init_zoran(card)<0) {
+		if (init_zoran(card) < 0) {
 			/* only release the zorans we have registered */
 			release_zoran(card);
 			return -EIO;
_

Patches currently in -mm which might be from alan@xxxxxxxxxxxxxxxxxxx are

origin.patch
isdn-warning-fixes.patch
non-libata-driver-for-jmicron-devices.patch
ide-claim-extra-dma-ports-regardless-of-channel.patch
ide-always-release-dma-engine.patch
ide-error-handling-fixes.patch
make-number-of-ide-interfaces-configurable.patch
ide_dma_speed-fixes.patch
enable-cdrom-dma-access-with-pdc20265_old.patch
ide-fix-revision-comparison-in-ide_in_drive_list.patch
ide-backport-piix-fixes-from-libata-into-the-legacy-driver.patch
drivers-ide-cleanups.patch
ide-remove-dma_base2-field-from-ide_hwif_t.patch
ide-reprogram-disk-pio-timings-on-resume.patch
config_pm=n-slim-drivers-ide-pci-sc1200c.patch
ide-fix-crash-on-repeated-reset.patch
ide-more-pci_find-cleanup.patch
sstfb-clean-ups.patch
fix-gregkh-driver-nozomi.patch
video4linux-complete-conversion-to-hotplug-safe-pci-api.patch
libata-add-40pin-short-cable-support-honour-drive.patch
via-pata-controller-xfer-fixes.patch
ahci-ati-sb600-sata-support-for-various-modes.patch
git-scsi-misc.patch
ioremap-balanced-with-iounmap-drivers-scsi-ncr53c8xxc.patch
edac-new-opteron-athlon64-memory-controller-driver.patch
edac-new-opteron-athlon64-memory-controller-driver-tidy.patch
char-kill-unneeded-memsets.patch
char-serial167-remove-useless-tty-check.patch
pci-mxser-pci-refcounts.patch
mxser-make-an-experimental-clone.patch
char-mxser_new-correct-include-file.patch
char-mxser_new-upgrade-to-191.patch
char-mxser_new-rework-to-allow-dynamic-structs.patch
ide-hpt3xxn-clocking-fixes.patch
ide-fix-hpt37x-timing-tables.patch
ide-optimize-hpt37x-timing-tables.patch
ide-fix-hpt3xx-hotswap-support.patch
ide-fix-the-case-of-multiple-hpt3xx-chips-present.patch
ide-hpt3xx-fix-pci-clock-detection.patch
ide-hpt3xx-fix-pci-clock-detection-fix-2.patch
piix-fix-82371mx-enablebits.patch
piix-remove-check-for-broken-mw-dma-mode-0.patch
piix-slc90e66-pio-mode-fallback-fix.patch
hpt3xx-rework-rate-filtering.patch
hpt3xx-rework-rate-filtering-tidy.patch
hpt3xx-print-the-real-chip-name-at-startup.patch
hpt3xx-switch-to-using-pci_get_slot.patch
hpt3xx-cache-channels-mcr-address.patch
hpt3x7-merge-speedproc-handlers.patch
hpt370-clean-up-dma-timeout-handling.patch
hpt3xx-init-code-rewrite.patch
ide-more-conversion-to-pci_get-apis.patch
pci_module_init-convertion-in-ata_genericc.patch
pci_module_init-convertion-in-ata_genericc-fix.patch
quirks-fix-the-festering-mess-that-claims-to-handle-ide.patch
quirks-switch-quirks-code-offender-to-use-pci_get-api.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux