All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] changed from pci_find_device to pci_get_device
@ 2005-11-27 19:41 Daniel Marjamäki
  2005-11-28 20:53 ` Greg KH
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Daniel Marjamäki @ 2005-11-27 19:41 UTC (permalink / raw)
  To: kernel-janitors



Hello friends!

I've made some changes and are interested in feedback (drivers/ide/pci/via82cxxx.c).

Some notes:
* The main change was to switch from pci_find_device to pci_get_device.
* I unlock "isa" when it won't be used anymore
* Changed a return value because init_chipset_via82cxxx returns an unsigned value.

This is the patch in a readable format:

static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const char *name)
{
	struct pci_dev *isa = NULL;

	for (via_config = via_isa_bridges; via_config->id; via_config++)
-		if ((isa = pci_find_device(PCI_VENDOR_ID_VIA +
+		if ((isa = pci_get_device(PCI_VENDOR_ID_VIA +
			!!(via_config->flags & VIA_BAD_ID),
			via_config->id, NULL))) {

			pci_read_config_byte(isa, PCI_REVISION_ID, &t);
			if (t >= via_config->rev_min &&
			    t <= via_config->rev_max)
				break;
+
+			pci_dev_put(isa);
		}

	if (!via_config->id) {
		printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n");
-		return -ENODEV;
+		return ENODEV;
	}

	/* DO STUFF (I don't include it here for your convenience) */

#if defined(DISPLAY_VIA_TIMINGS) && defined(CONFIG_PROC_FS)
-	if (!via_proc) {
+	if (via_proc) {
+		isa_dev = NULL;
+		pci_dev_put(isa);
+	} else {
		via_base = pci_resource_start(dev, 4);
		bmide_dev = dev;
		isa_dev = isa;
		ide_pci_create_host_proc("via", via_get_info);
		via_proc = 1;
	}
+#else
+	pci_dev_put(isa);	
#endif /* DISPLAY_VIA_TIMINGS && CONFIG_PROC_FS */

	return 0;
}


+#if defined(DISPLAY_VIA_TIMINGS) && defined(CONFIG_PROC_FS)
+static void via_ide_exit(void)
+{
+	if (isa_dev)
+		pci_dev_put(isa_dev);
+}
+module_exit(via_ide_exit);
+#endif /* DISPLAY_VIA_TIMINGS && CONFIG_PROC_FS */


Best regards,
Daniel Marjamäki




_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-11-29 17:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-27 19:41 [KJ] changed from pci_find_device to pci_get_device Daniel Marjamäki
2005-11-28 20:53 ` Greg KH
2005-11-28 21:43 ` Daniel Marjamäki
2005-11-29 11:44 ` Alexey Dobriyan
2005-11-29 11:51 ` Daniel Marjamäki
2005-11-29 12:58 ` Alexey Dobriyan
2005-11-29 13:20 ` Daniel Marjamäki
2005-11-29 13:56 ` Daniel Marjamäki
2005-11-29 17:34 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.