[PATCH] plan-b: Switch to refcounting PCI API

From: Alan Cox
Date: Mon Apr 23 2007 - 10:00:07 EST


Signed-off-by: Alan Cox <alan@xxxxxxxxxx>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.21-rc6-mm1/drivers/media/video/planb.c linux-2.6.21-rc6-mm1/drivers/media/video/planb.c
--- linux.vanilla-2.6.21-rc6-mm1/drivers/media/video/planb.c 2007-04-12 13:40:33.000000000 +0100
+++ linux-2.6.21-rc6-mm1/drivers/media/video/planb.c 2007-04-23 12:00:54.286385088 +0100
@@ -2207,7 +2207,7 @@
"membase 0x%x (base reg. 0x%x)\n",
bus, PCI_SLOT(dev_fn), PCI_FUNC(dev_fn), old_base, confreg);

- pdev = pci_find_slot (bus, dev_fn);
+ pdev = pci_get_bus_and_slot(bus, dev_fn);
if (!pdev) {
printk(KERN_ERR "planb: cannot find slot\n");
goto err_out;
@@ -2237,6 +2237,7 @@
pb->planb_base = planb_regs;
pb->planb_base_phys = (struct planb_registers *)new_base;
pb->irq = irq;
+ pb->dev = pdev;

return planb_num;

@@ -2244,6 +2245,7 @@
pci_disable_device(pdev);
err_out:
/* FIXME handle error */ /* comment moved from pci_find_slot, above */
+ pci_dev_put(pdev);
return 0;
}

@@ -2270,6 +2272,8 @@

printk(KERN_INFO "PlanB: unregistering with v4l\n");
video_unregister_device(&pb->video_dev);
+
+ pci_dev_put(pb->dev);

/* note that iounmap() does nothing on the PPC right now */
iounmap ((void *)pb->planb_base);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/