aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/pdc202xx_new.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2007-10-11 17:53:58 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-11 17:53:58 -0400
commit07047935795917f21dc532c0c17811213cbc2e97 (patch)
treec2f6ce294934eb5c34b645679073a127a1c46f88 /drivers/ide/pci/pdc202xx_new.c
parent5e32132befa5d2cefadf3141fee0bbb40cd11f0e (diff)
pdc202xx_new: switch to using pci_get_slot() (take 2)
Switch to using pci_get_slot() in init_setup_pdc20270() to get to the mate chip behind DC21150 bridge as there's no need for the driver itself to walk the list of the PCI devices (and the driver didn't check the bus # of the found device). While at it, make it emit warning about IRQ # being fixed up (just like hpt366.c does) and "beautify" this whole function as well as init_setup_pdc20276()... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/pdc202xx_new.c')
-rw-r--r--drivers/ide/pci/pdc202xx_new.c60
1 files changed, 34 insertions, 26 deletions
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 7b0e479c355c..7c5544d10b9a 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -524,44 +524,52 @@ static int __devinit init_setup_pdcnew(struct pci_dev *dev, ide_pci_device_t *d)
524 return ide_setup_pci_device(dev, d); 524 return ide_setup_pci_device(dev, d);
525} 525}
526 526
527static int __devinit init_setup_pdc20270(struct pci_dev *dev, 527static int __devinit init_setup_pdc20270(struct pci_dev *dev, ide_pci_device_t *d)
528 ide_pci_device_t *d)
529{ 528{
530 struct pci_dev *findev = NULL; 529 struct pci_dev *bridge = dev->bus->self;
531 int ret; 530
531 if (bridge != NULL &&
532 bridge->vendor == PCI_VENDOR_ID_DEC &&
533 bridge->device == PCI_DEVICE_ID_DEC_21150) {
534 struct pci_dev *dev2;
532 535
533 if ((dev->bus->self &&
534 dev->bus->self->vendor == PCI_VENDOR_ID_DEC) &&
535 (dev->bus->self->device == PCI_DEVICE_ID_DEC_21150)) {
536 if (PCI_SLOT(dev->devfn) & 2) 536 if (PCI_SLOT(dev->devfn) & 2)
537 return -ENODEV; 537 return -ENODEV;
538 538
539 while ((findev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, findev)) != NULL) { 539 dev2 = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn) + 2,
540 if ((findev->vendor == dev->vendor) && 540 PCI_FUNC(dev->devfn)));
541 (findev->device == dev->device) && 541 if (dev2 != NULL &&
542 (PCI_SLOT(findev->devfn) & 2)) { 542 dev2->vendor == dev->vendor &&
543 if (findev->irq != dev->irq) { 543 dev2->device == dev->device) {
544 findev->irq = dev->irq; 544 int ret;
545 } 545
546 ret = ide_setup_pci_devices(dev, findev, d); 546 if (dev2->irq != dev->irq) {
547 if (ret < 0) 547 dev2->irq = dev->irq;
548 pci_dev_put(findev); 548
549 return ret; 549 printk(KERN_WARNING "%s: PCI config space "
550 "interrupt fixed.\n", d->name);
550 } 551 }
552
553 ret = ide_setup_pci_devices(dev, dev2, d);
554 if (ret < 0)
555 pci_dev_put(dev2);
556 return ret;
551 } 557 }
552 } 558 }
553 return ide_setup_pci_device(dev, d); 559 return ide_setup_pci_device(dev, d);
554} 560}
555 561
556static int __devinit init_setup_pdc20276(struct pci_dev *dev, 562static int __devinit init_setup_pdc20276(struct pci_dev *dev, ide_pci_device_t *d)
557 ide_pci_device_t *d)
558{ 563{
559 if ((dev->bus->self) && 564 struct pci_dev *bridge = dev->bus->self;
560 (dev->bus->self->vendor == PCI_VENDOR_ID_INTEL) && 565
561 ((dev->bus->self->device == PCI_DEVICE_ID_INTEL_I960) || 566 if (bridge != NULL &&
562 (dev->bus->self->device == PCI_DEVICE_ID_INTEL_I960RM))) { 567 bridge->vendor == PCI_VENDOR_ID_INTEL &&
563 printk(KERN_INFO "ide: Skipping Promise PDC20276 " 568 (bridge->device == PCI_DEVICE_ID_INTEL_I960 ||
564 "attached to I2O RAID controller.\n"); 569 bridge->device == PCI_DEVICE_ID_INTEL_I960RM)) {
570
571 printk(KERN_INFO "%s: attached to I2O RAID controller, "
572 "skipping.\n", d->name);
565 return -ENODEV; 573 return -ENODEV;
566 } 574 }
567 return ide_setup_pci_device(dev, d); 575 return ide_setup_pci_device(dev, d);