]> Pileus Git - ~andy/linux/blobdiff - drivers/ata/sata_inic162x.c
devres: release resources on device_del()
[~andy/linux] / drivers / ata / sata_inic162x.c
index 170a10ad478ffa923d27c143d049099dff4ef361..3193a603d1a159cb99b59e9f7bb705f765d28bda 100644 (file)
@@ -135,8 +135,10 @@ static struct scsi_host_template inic_sht = {
        .slave_configure        = inic_slave_config,
        .slave_destroy          = ata_scsi_slave_destroy,
        .bios_param             = ata_std_bios_param,
+#ifdef CONFIG_PM
        .suspend                = ata_scsi_device_suspend,
        .resume                 = ata_scsi_device_resume,
+#endif
 };
 
 static const int scr_map[] = {
@@ -429,11 +431,6 @@ static int inic_hardreset(struct ata_port *ap, unsigned int *class)
        /* hammer it into sane state */
        inic_reset_port(port_base);
 
-       if (ata_port_offline(ap)) {
-               *class = ATA_DEV_NONE;
-               return 0;
-       }
-
        val = readw(idma_ctl);
        writew(val | IDMA_CTL_RST_ATA, idma_ctl);
        readw(idma_ctl);        /* flush */
@@ -443,16 +440,17 @@ static int inic_hardreset(struct ata_port *ap, unsigned int *class)
        rc = sata_phy_resume(ap, timing);
        if (rc) {
                ata_port_printk(ap, KERN_WARNING, "failed to resume "
-                               "link for reset (errno=%d)\n", rc);
+                               "link after reset (errno=%d)\n", rc);
                return rc;
        }
 
-       msleep(150);
-
        *class = ATA_DEV_NONE;
        if (ata_port_online(ap)) {
                struct ata_taskfile tf;
 
+               /* wait a while before checking status */
+               msleep(150);
+
                if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) {
                        ata_port_printk(ap, KERN_WARNING,
                                        "device busy after hardreset\n");
@@ -636,6 +634,7 @@ static int init_controller(void __iomem *mmio_base, u16 hctl)
        return 0;
 }
 
+#ifdef CONFIG_PM
 static int inic_pci_device_resume(struct pci_dev *pdev)
 {
        struct ata_host *host = dev_get_drvdata(&pdev->dev);
@@ -646,7 +645,6 @@ static int inic_pci_device_resume(struct pci_dev *pdev)
        ata_pci_device_do_resume(pdev);
 
        if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
-               printk("XXX\n");
                rc = init_controller(mmio_base, hpriv->cached_hctl);
                if (rc)
                        return rc;
@@ -656,6 +654,7 @@ static int inic_pci_device_resume(struct pci_dev *pdev)
 
        return 0;
 }
+#endif
 
 static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
@@ -714,7 +713,7 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        probe_ent->n_ports              = NR_PORTS;
 
        probe_ent->irq = pdev->irq;
-       probe_ent->irq_flags = SA_SHIRQ;
+       probe_ent->irq_flags = IRQF_SHARED;
 
        probe_ent->iomap = iomap;
 
@@ -759,8 +758,10 @@ static const struct pci_device_id inic_pci_tbl[] = {
 static struct pci_driver inic_pci_driver = {
        .name           = DRV_NAME,
        .id_table       = inic_pci_tbl,
+#ifdef CONFIG_PM
        .suspend        = ata_pci_device_suspend,
        .resume         = inic_pci_device_resume,
+#endif
        .probe          = inic_init_one,
        .remove         = ata_pci_remove_one,
 };