summaryrefslogtreecommitdiff
path: root/drivers/media/video/zr36120.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-10-03 20:44:12 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-10-04 08:06:50 -0300
commite491cbc8b2eabc8856bf890006604edd91b1cce2 (patch)
treeded403fd4d2a7e159ba001c66a4373695629df42 /drivers/media/video/zr36120.c
parenta868b45dad04854e07bb1c7c81a73930098bc370 (diff)
V4L/DVB (4707): 4linux: complete conversion to hotplug safe PCI API
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/zr36120.c')
-rw-r--r--drivers/media/video/zr36120.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c
index 9240638a0134..b5ffe53c40d8 100644
--- a/drivers/media/video/zr36120.c
+++ b/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;