Commit 6527107c authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[PATCH] PCI: remove pci_find_class() usage from all drivers/ files

Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 8184ebfd
...@@ -200,7 +200,7 @@ int __init applicom_init(void) ...@@ -200,7 +200,7 @@ int __init applicom_init(void)
/* No mem and irq given - check for a PCI card */ /* No mem and irq given - check for a PCI card */
while ( (dev = pci_find_class(PCI_CLASS_OTHERS << 16, dev))) { while ( (dev = pci_get_class(PCI_CLASS_OTHERS << 16, dev))) {
if (dev->vendor != PCI_VENDOR_ID_APPLICOM) if (dev->vendor != PCI_VENDOR_ID_APPLICOM)
continue; continue;
......
...@@ -99,8 +99,11 @@ int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev) ...@@ -99,8 +99,11 @@ int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev)
*/ */
if (!dev->hose) { if (!dev->hose) {
struct pci_dev *pci_dev; struct pci_dev *pci_dev;
pci_dev = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8, NULL); pci_dev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, NULL);
if (pci_dev) dev->hose = pci_dev->sysdata; if (pci_dev) {
dev->hose = pci_dev->sysdata;
pci_dev_put(pci_dev);
}
if (!dev->hose) { if (!dev->hose) {
struct pci_bus *b = pci_bus_b(pci_root_buses.next); struct pci_bus *b = pci_bus_b(pci_root_buses.next);
if (b) dev->hose = b->sysdata; if (b) dev->hose = b->sysdata;
......
...@@ -1777,10 +1777,10 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) ...@@ -1777,10 +1777,10 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info)
pci_smic_checked = 1; pci_smic_checked = 1;
if ((pci_dev = pci_find_device(PCI_HP_VENDOR_ID, PCI_MMC_DEVICE_ID, if ((pci_dev = pci_get_device(PCI_HP_VENDOR_ID, PCI_MMC_DEVICE_ID,
NULL))) NULL)))
; ;
else if ((pci_dev = pci_find_class(PCI_ERMC_CLASSCODE, NULL)) && else if ((pci_dev = pci_get_class(PCI_ERMC_CLASSCODE, NULL)) &&
pci_dev->subsystem_vendor == PCI_HP_VENDOR_ID) pci_dev->subsystem_vendor == PCI_HP_VENDOR_ID)
fe_rmc = 1; fe_rmc = 1;
else else
...@@ -1789,6 +1789,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) ...@@ -1789,6 +1789,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info)
error = pci_read_config_word(pci_dev, PCI_MMC_ADDR_CW, &base_addr); error = pci_read_config_word(pci_dev, PCI_MMC_ADDR_CW, &base_addr);
if (error) if (error)
{ {
pci_dev_put(pci_dev);
printk(KERN_ERR printk(KERN_ERR
"ipmi_si: pci_read_config_word() failed (%d).\n", "ipmi_si: pci_read_config_word() failed (%d).\n",
error); error);
...@@ -1798,6 +1799,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) ...@@ -1798,6 +1799,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info)
/* Bit 0: 1 specifies programmed I/O, 0 specifies memory mapped I/O */ /* Bit 0: 1 specifies programmed I/O, 0 specifies memory mapped I/O */
if (!(base_addr & 0x0001)) if (!(base_addr & 0x0001))
{ {
pci_dev_put(pci_dev);
printk(KERN_ERR printk(KERN_ERR
"ipmi_si: memory mapped I/O not supported for PCI" "ipmi_si: memory mapped I/O not supported for PCI"
" smic.\n"); " smic.\n");
...@@ -1809,11 +1811,14 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) ...@@ -1809,11 +1811,14 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info)
/* Data register starts at base address + 1 in eRMC */ /* Data register starts at base address + 1 in eRMC */
++base_addr; ++base_addr;
if (!is_new_interface(-1, IPMI_IO_ADDR_SPACE, base_addr)) if (!is_new_interface(-1, IPMI_IO_ADDR_SPACE, base_addr)) {
return -ENODEV; pci_dev_put(pci_dev);
return -ENODEV;
}
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kmalloc(sizeof(*info), GFP_KERNEL);
if (!info) { if (!info) {
pci_dev_put(pci_dev);
printk(KERN_ERR "ipmi_si: Could not allocate SI data (5)\n"); printk(KERN_ERR "ipmi_si: Could not allocate SI data (5)\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -1836,6 +1841,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) ...@@ -1836,6 +1841,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info)
printk("ipmi_si: Found PCI SMIC at I/O address 0x%lx\n", printk("ipmi_si: Found PCI SMIC at I/O address 0x%lx\n",
(long unsigned int) base_addr); (long unsigned int) base_addr);
pci_dev_put(pci_dev);
return 0; return 0;
} }
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
......
...@@ -4045,7 +4045,7 @@ void __devinit bttv_check_chipset(void) ...@@ -4045,7 +4045,7 @@ void __devinit bttv_check_chipset(void)
#if 0 #if 0
/* print which chipset we have */ /* print which chipset we have */
while ((dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8,dev))) while ((dev = pci_get_class(PCI_CLASS_BRIDGE_HOST << 8,dev)))
printk(KERN_INFO "bttv: Host bridge is %s\n",pci_name(dev)); printk(KERN_INFO "bttv: Host bridge is %s\n",pci_name(dev));
#endif #endif
...@@ -4064,8 +4064,8 @@ void __devinit bttv_check_chipset(void) ...@@ -4064,8 +4064,8 @@ void __devinit bttv_check_chipset(void)
if (UNSET != latency) if (UNSET != latency)
printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency); printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency);
while ((dev = pci_find_device(PCI_VENDOR_ID_INTEL, while ((dev = pci_get_device(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_82441, dev))) { PCI_DEVICE_ID_INTEL_82441, dev))) {
unsigned char b; unsigned char b;
pci_read_config_byte(dev, 0x53, &b); pci_read_config_byte(dev, 0x53, &b);
if (bttv_debug) if (bttv_debug)
......
...@@ -294,7 +294,7 @@ sbni_pci_probe( struct net_device *dev ) ...@@ -294,7 +294,7 @@ sbni_pci_probe( struct net_device *dev )
{ {
struct pci_dev *pdev = NULL; struct pci_dev *pdev = NULL;
while( (pdev = pci_find_class( PCI_CLASS_NETWORK_OTHER << 8, pdev )) while( (pdev = pci_get_class( PCI_CLASS_NETWORK_OTHER << 8, pdev ))
!= NULL ) { != NULL ) {
int pci_irq_line; int pci_irq_line;
unsigned long pci_ioaddr; unsigned long pci_ioaddr;
...@@ -331,10 +331,14 @@ sbni_pci_probe( struct net_device *dev ) ...@@ -331,10 +331,14 @@ sbni_pci_probe( struct net_device *dev )
/* avoiding re-enable dual adapters */ /* avoiding re-enable dual adapters */
if( (pci_ioaddr & 7) == 0 && pci_enable_device( pdev ) ) { if( (pci_ioaddr & 7) == 0 && pci_enable_device( pdev ) ) {
release_region( pci_ioaddr, SBNI_IO_EXTENT ); release_region( pci_ioaddr, SBNI_IO_EXTENT );
pci_dev_put( pdev );
return -EIO; return -EIO;
} }
if( sbni_probe1( dev, pci_ioaddr, pci_irq_line ) ) { if( sbni_probe1( dev, pci_ioaddr, pci_irq_line ) ) {
SET_NETDEV_DEV(dev, &pdev->dev); SET_NETDEV_DEV(dev, &pdev->dev);
/* not the best thing to do, but this is all messed up
for hotplug systems anyway... */
pci_dev_put( pdev );
return 0; return 0;
} }
} }
......
...@@ -1005,7 +1005,7 @@ static struct pci_dev *get_pci_dev(unsigned long port_base) { ...@@ -1005,7 +1005,7 @@ static struct pci_dev *get_pci_dev(unsigned long port_base) {
unsigned int addr; unsigned int addr;
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
while((dev = pci_find_class(PCI_CLASS_STORAGE_SCSI << 8, dev))) { while((dev = pci_get_class(PCI_CLASS_STORAGE_SCSI << 8, dev))) {
addr = pci_resource_start (dev, 0); addr = pci_resource_start (dev, 0);
#if defined(DEBUG_PCI_DETECT) #if defined(DEBUG_PCI_DETECT)
...@@ -1013,6 +1013,11 @@ static struct pci_dev *get_pci_dev(unsigned long port_base) { ...@@ -1013,6 +1013,11 @@ static struct pci_dev *get_pci_dev(unsigned long port_base) {
driver_name, dev->bus->number, dev->devfn, addr); driver_name, dev->bus->number, dev->devfn, addr);
#endif #endif
/* we are in so much trouble for a pci hotplug system with this driver
* anyway, so doing this at least lets people unload the driver and not
* cause memory problems, but in general this is a bad thing to do (this
* driver needs to be converted to the proper PCI api someday... */
pci_dev_put(dev);
if (addr + PCI_BASE_ADDRESS_0 == port_base) return dev; if (addr + PCI_BASE_ADDRESS_0 == port_base) return dev;
} }
...@@ -1027,7 +1032,7 @@ static void enable_pci_ports(void) { ...@@ -1027,7 +1032,7 @@ static void enable_pci_ports(void) {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
while((dev = pci_find_class(PCI_CLASS_STORAGE_SCSI << 8, dev))) { while((dev = pci_get_class(PCI_CLASS_STORAGE_SCSI << 8, dev))) {
#if defined(DEBUG_PCI_DETECT) #if defined(DEBUG_PCI_DETECT)
printk("%s: enable_pci_ports, bus %d, devfn 0x%x.\n", printk("%s: enable_pci_ports, bus %d, devfn 0x%x.\n",
...@@ -1454,7 +1459,7 @@ static void add_pci_ports(void) { ...@@ -1454,7 +1459,7 @@ static void add_pci_ports(void) {
for (k = 0; k < MAX_PCI; k++) { for (k = 0; k < MAX_PCI; k++) {
if (!(dev = pci_find_class(PCI_CLASS_STORAGE_SCSI << 8, dev))) break; if (!(dev = pci_get_class(PCI_CLASS_STORAGE_SCSI << 8, dev))) break;
if (pci_enable_device (dev)) { if (pci_enable_device (dev)) {
...@@ -1478,6 +1483,7 @@ static void add_pci_ports(void) { ...@@ -1478,6 +1483,7 @@ static void add_pci_ports(void) {
addr + PCI_BASE_ADDRESS_0; addr + PCI_BASE_ADDRESS_0;
} }
pci_dev_put(dev);
#endif /* end CONFIG_PCI */ #endif /* end CONFIG_PCI */
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment