aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/sgiioc4.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/sgiioc4.c')
-rw-r--r--drivers/ide/sgiioc4.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c
index 8af9b23499fd..7defa0ae2014 100644
--- a/drivers/ide/sgiioc4.c
+++ b/drivers/ide/sgiioc4.c
@@ -567,14 +567,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
567 unsigned long cmd_base, irqport; 567 unsigned long cmd_base, irqport;
568 unsigned long bar0, cmd_phys_base, ctl; 568 unsigned long bar0, cmd_phys_base, ctl;
569 void __iomem *virt_base; 569 void __iomem *virt_base;
570 struct ide_host *host;
571 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 570 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
572 struct ide_port_info d = sgiioc4_port_info;
573 int rc; 571 int rc;
574 572
575 /* Get the CmdBlk and CtrlBlk Base Registers */ 573 /* Get the CmdBlk and CtrlBlk Base Registers */
576 bar0 = pci_resource_start(dev, 0); 574 bar0 = pci_resource_start(dev, 0);
577 virt_base = ioremap(bar0, pci_resource_len(dev, 0)); 575 virt_base = pci_ioremap_bar(dev, 0);
578 if (virt_base == NULL) { 576 if (virt_base == NULL) {
579 printk(KERN_ERR "%s: Unable to remap BAR 0 address: 0x%lx\n", 577 printk(KERN_ERR "%s: Unable to remap BAR 0 address: 0x%lx\n",
580 DRV_NAME, bar0); 578 DRV_NAME, bar0);
@@ -590,7 +588,8 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
590 printk(KERN_ERR "%s %s -- ERROR: addresses 0x%08lx to 0x%08lx " 588 printk(KERN_ERR "%s %s -- ERROR: addresses 0x%08lx to 0x%08lx "
591 "already in use\n", DRV_NAME, pci_name(dev), 589 "already in use\n", DRV_NAME, pci_name(dev),
592 cmd_phys_base, cmd_phys_base + IOC4_CMD_CTL_BLK_SIZE); 590 cmd_phys_base, cmd_phys_base + IOC4_CMD_CTL_BLK_SIZE);
593 return -EBUSY; 591 rc = -EBUSY;
592 goto req_mem_rgn_err;
594 } 593 }
595 594
596 /* Initialize the IO registers */ 595 /* Initialize the IO registers */
@@ -603,21 +602,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
603 /* Initializing chipset IRQ Registers */ 602 /* Initializing chipset IRQ Registers */
604 writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); 603 writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4));
605 604
606 host = ide_host_alloc(&d, hws); 605 rc = ide_host_add(&sgiioc4_port_info, hws, NULL);
607 if (host == NULL) { 606 if (!rc)
608 rc = -ENOMEM; 607 return 0;
609 goto err;
610 }
611
612 rc = ide_host_register(host, &d, hws);
613 if (rc)
614 goto err_free;
615 608
616 return 0;
617err_free:
618 ide_host_free(host);
619err:
620 release_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE); 609 release_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE);
610req_mem_rgn_err:
621 iounmap(virt_base); 611 iounmap(virt_base);
622 return rc; 612 return rc;
623} 613}