aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/pdc202xx_new.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-18 18:30:09 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-18 18:30:09 -0400
commit099b1f42ab631f88a0321ae5468809fe907eb4d5 (patch)
tree014fbea866ecae73770afcd9ed8272547f973477 /drivers/ide/pci/pdc202xx_new.c
parentfbf47840fe679bf370d07267df6f851b4f53e78d (diff)
pdc202xx_new: remove ->init_setup
* Split off pdc20270_get_dev2() helper from init_setup_pdc20270(). * Merge init_setup_{pdcnew,pdc20270,pdc20276}() into pdc202new_init_one(). While at it: * Change KERN_ level of interrupt fixup message from KERN_WARNING to KERN_INFO. 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.c108
1 files changed, 49 insertions, 59 deletions
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index d684e713fae9..8bce030550d7 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -482,66 +482,31 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
482 hwif->cbl = pdcnew_cable_detect(hwif); 482 hwif->cbl = pdcnew_cable_detect(hwif);
483} 483}
484 484
485static int __devinit init_setup_pdcnew(struct pci_dev *dev, ide_pci_device_t *d) 485static struct pci_dev * __devinit pdc20270_get_dev2(struct pci_dev *dev)
486{ 486{
487 return ide_setup_pci_device(dev, d); 487 struct pci_dev *dev2;
488} 488
489 489 dev2 = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn) + 2,
490static int __devinit init_setup_pdc20270(struct pci_dev *dev, ide_pci_device_t *d) 490 PCI_FUNC(dev->devfn)));
491{ 491 if (dev2 &&
492 struct pci_dev *bridge = dev->bus->self; 492 dev2->vendor == dev->vendor &&
493 493 dev2->device == dev->device) {
494 if (bridge != NULL && 494
495 bridge->vendor == PCI_VENDOR_ID_DEC && 495 if (dev2->irq != dev->irq) {
496 bridge->device == PCI_DEVICE_ID_DEC_21150) { 496 dev2->irq = dev->irq;
497 struct pci_dev *dev2; 497 printk(KERN_INFO "PDC20270: PCI config space "
498 498 "interrupt fixed\n");
499 if (PCI_SLOT(dev->devfn) & 2)
500 return -ENODEV;
501
502 dev2 = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn) + 2,
503 PCI_FUNC(dev->devfn)));
504 if (dev2 != NULL &&
505 dev2->vendor == dev->vendor &&
506 dev2->device == dev->device) {
507 int ret;
508
509 if (dev2->irq != dev->irq) {
510 dev2->irq = dev->irq;
511
512 printk(KERN_WARNING "%s: PCI config space "
513 "interrupt fixed.\n", d->name);
514 }
515
516 ret = ide_setup_pci_devices(dev, dev2, d);
517 if (ret < 0)
518 pci_dev_put(dev2);
519 return ret;
520 } 499 }
521 }
522 return ide_setup_pci_device(dev, d);
523}
524
525static int __devinit init_setup_pdc20276(struct pci_dev *dev, ide_pci_device_t *d)
526{
527 struct pci_dev *bridge = dev->bus->self;
528 500
529 if (bridge != NULL && 501 return dev2;
530 bridge->vendor == PCI_VENDOR_ID_INTEL &&
531 (bridge->device == PCI_DEVICE_ID_INTEL_I960 ||
532 bridge->device == PCI_DEVICE_ID_INTEL_I960RM)) {
533
534 printk(KERN_INFO "%s: attached to I2O RAID controller, "
535 "skipping.\n", d->name);
536 return -ENODEV;
537 } 502 }
538 return ide_setup_pci_device(dev, d); 503
504 return NULL;
539} 505}
540 506
541static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { 507static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
542 { /* 0 */ 508 { /* 0 */
543 .name = "PDC20268", 509 .name = "PDC20268",
544 .init_setup = init_setup_pdcnew,
545 .init_chipset = init_chipset_pdcnew, 510 .init_chipset = init_chipset_pdcnew,
546 .init_hwif = init_hwif_pdc202new, 511 .init_hwif = init_hwif_pdc202new,
547 .host_flags = IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_OFF_BOARD, 512 .host_flags = IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_OFF_BOARD,
@@ -550,7 +515,6 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
550 .udma_mask = ATA_UDMA5, 515 .udma_mask = ATA_UDMA5,
551 },{ /* 1 */ 516 },{ /* 1 */
552 .name = "PDC20269", 517 .name = "PDC20269",
553 .init_setup = init_setup_pdcnew,
554 .init_chipset = init_chipset_pdcnew, 518 .init_chipset = init_chipset_pdcnew,
555 .init_hwif = init_hwif_pdc202new, 519 .init_hwif = init_hwif_pdc202new,
556 .host_flags = IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_OFF_BOARD, 520 .host_flags = IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_OFF_BOARD,
@@ -559,7 +523,6 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
559 .udma_mask = ATA_UDMA6, 523 .udma_mask = ATA_UDMA6,
560 },{ /* 2 */ 524 },{ /* 2 */
561 .name = "PDC20270", 525 .name = "PDC20270",
562 .init_setup = init_setup_pdc20270,
563 .init_chipset = init_chipset_pdcnew, 526 .init_chipset = init_chipset_pdcnew,
564 .init_hwif = init_hwif_pdc202new, 527 .init_hwif = init_hwif_pdc202new,
565 .host_flags = IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_OFF_BOARD, 528 .host_flags = IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_OFF_BOARD,
@@ -568,7 +531,6 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
568 .udma_mask = ATA_UDMA5, 531 .udma_mask = ATA_UDMA5,
569 },{ /* 3 */ 532 },{ /* 3 */
570 .name = "PDC20271", 533 .name = "PDC20271",
571 .init_setup = init_setup_pdcnew,
572 .init_chipset = init_chipset_pdcnew, 534 .init_chipset = init_chipset_pdcnew,
573 .init_hwif = init_hwif_pdc202new, 535 .init_hwif = init_hwif_pdc202new,
574 .host_flags = IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_OFF_BOARD, 536 .host_flags = IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_OFF_BOARD,
@@ -577,7 +539,6 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
577 .udma_mask = ATA_UDMA6, 539 .udma_mask = ATA_UDMA6,
578 },{ /* 4 */ 540 },{ /* 4 */
579 .name = "PDC20275", 541 .name = "PDC20275",
580 .init_setup = init_setup_pdcnew,
581 .init_chipset = init_chipset_pdcnew, 542 .init_chipset = init_chipset_pdcnew,
582 .init_hwif = init_hwif_pdc202new, 543 .init_hwif = init_hwif_pdc202new,
583 .host_flags = IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_OFF_BOARD, 544 .host_flags = IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_OFF_BOARD,
@@ -586,7 +547,6 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
586 .udma_mask = ATA_UDMA6, 547 .udma_mask = ATA_UDMA6,
587 },{ /* 5 */ 548 },{ /* 5 */
588 .name = "PDC20276", 549 .name = "PDC20276",
589 .init_setup = init_setup_pdc20276,
590 .init_chipset = init_chipset_pdcnew, 550 .init_chipset = init_chipset_pdcnew,
591 .init_hwif = init_hwif_pdc202new, 551 .init_hwif = init_hwif_pdc202new,
592 .host_flags = IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_OFF_BOARD, 552 .host_flags = IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_OFF_BOARD,
@@ -595,7 +555,6 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
595 .udma_mask = ATA_UDMA6, 555 .udma_mask = ATA_UDMA6,
596 },{ /* 6 */ 556 },{ /* 6 */
597 .name = "PDC20277", 557 .name = "PDC20277",
598 .init_setup = init_setup_pdcnew,
599 .init_chipset = init_chipset_pdcnew, 558 .init_chipset = init_chipset_pdcnew,
600 .init_hwif = init_hwif_pdc202new, 559 .init_hwif = init_hwif_pdc202new,
601 .host_flags = IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_OFF_BOARD, 560 .host_flags = IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_OFF_BOARD,
@@ -616,9 +575,40 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
616 575
617static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id) 576static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id)
618{ 577{
619 ide_pci_device_t *d = &pdcnew_chipsets[id->driver_data]; 578 ide_pci_device_t *d;
579 struct pci_dev *bridge = dev->bus->self;
580 u8 idx = id->driver_data;
581
582 d = &pdcnew_chipsets[idx];
583
584 if (idx == 2 && bridge &&
585 bridge->vendor == PCI_VENDOR_ID_DEC &&
586 bridge->device == PCI_DEVICE_ID_DEC_21150) {
587 struct pci_dev *dev2;
588
589 if (PCI_SLOT(dev->devfn) & 2)
590 return -ENODEV;
620 591
621 return d->init_setup(dev, d); 592 dev2 = pdc20270_get_dev2(dev);
593
594 if (dev2) {
595 int ret = ide_setup_pci_devices(dev, dev2, d);
596 if (ret < 0)
597 pci_dev_put(dev2);
598 return ret;
599 }
600 }
601
602 if (idx == 5 && bridge &&
603 bridge->vendor == PCI_VENDOR_ID_INTEL &&
604 (bridge->device == PCI_DEVICE_ID_INTEL_I960 ||
605 bridge->device == PCI_DEVICE_ID_INTEL_I960RM)) {
606 printk(KERN_INFO "PDC20276: attached to I2O RAID controller, "
607 "skipping\n");
608 return -ENODEV;
609 }
610
611 return ide_setup_pci_device(dev, d);
622} 612}
623 613
624static const struct pci_device_id pdc202new_pci_tbl[] = { 614static const struct pci_device_id pdc202new_pci_tbl[] = {