]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/ata/libata-sff.c
[libata] checkpatch-inspired cleanups
[mirror_ubuntu-bionic-kernel.git] / drivers / ata / libata-sff.c
index 1cce2198baaf1203deb7e1e7e6df305e215501df..48acc09dab9687e93a247a96614cbc93002727f8 100644 (file)
@@ -64,46 +64,6 @@ u8 ata_irq_on(struct ata_port *ap)
        return tmp;
 }
 
-u8 ata_dummy_irq_on (struct ata_port *ap)      { return 0; }
-
-/**
- *     ata_irq_ack - Acknowledge a device interrupt.
- *     @ap: Port on which interrupts are enabled.
- *
- *     Wait up to 10 ms for legacy IDE device to become idle (BUSY
- *     or BUSY+DRQ clear).  Obtain dma status and port status from
- *     device.  Clear the interrupt.  Return port status.
- *
- *     LOCKING:
- */
-
-u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
-{
-       unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;
-       u8 host_stat = 0, post_stat = 0, status;
-
-       status = ata_busy_wait(ap, bits, 1000);
-       if (status & bits)
-               if (ata_msg_err(ap))
-                       printk(KERN_ERR "abnormal status 0x%X\n", status);
-
-       if (ap->ioaddr.bmdma_addr) {
-               /* get controller status; clear intr, err bits */
-               host_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
-               iowrite8(host_stat | ATA_DMA_INTR | ATA_DMA_ERR,
-                        ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
-
-               post_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
-       }
-       if (ata_msg_intr(ap))
-               printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
-                       __FUNCTION__,
-                       host_stat, post_stat, status);
-       return status;
-}
-
-u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq) { return 0; }
-
 /**
  *     ata_tf_load - send taskfile registers to host controller
  *     @ap: Port to which output is sent
@@ -196,7 +156,7 @@ void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
 {
        struct ata_ioports *ioaddr = &ap->ioaddr;
 
-       tf->command = ata_check_status(ap);
+       tf->command = ata_chk_status(ap);
        tf->feature = ioread8(ioaddr->error_addr);
        tf->nsect = ioread8(ioaddr->nsect_addr);
        tf->lbal = ioread8(ioaddr->lbal_addr);
@@ -288,7 +248,7 @@ void ata_bmdma_setup(struct ata_queued_cmd *qc)
  *     LOCKING:
  *     spin_lock_irqsave(host lock)
  */
-void ata_bmdma_start (struct ata_queued_cmd *qc)
+void ata_bmdma_start(struct ata_queued_cmd *qc)
 {
        struct ata_port *ap = qc->ap;
        u8 dmactl;
@@ -297,7 +257,7 @@ void ata_bmdma_start (struct ata_queued_cmd *qc)
        dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
        iowrite8(dmactl | ATA_DMA_START, ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
 
-       /* Strictly, one may wish to issue a readb() here, to
+       /* Strictly, one may wish to issue an ioread8() here, to
         * flush the mmio write.  However, control also passes
         * to the hardware at this point, and it will interrupt
         * us when we are to resume control.  So, in effect,
@@ -307,6 +267,9 @@ void ata_bmdma_start (struct ata_queued_cmd *qc)
         * is expected, so I think it is best to not add a readb()
         * without first all the MMIO ATA cards/mobos.
         * Or maybe I'm just being paranoid.
+        *
+        * FIXME: The posting of this write means I/O starts are
+        * unneccessarily delayed for MMIO
         */
 }
 
@@ -442,7 +405,7 @@ void ata_bmdma_drive_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
        unsigned long flags;
        int thaw = 0;
 
-       qc = __ata_qc_from_tag(ap, ap->active_tag);
+       qc = __ata_qc_from_tag(ap, ap->link.active_tag);
        if (qc && !(qc->flags & ATA_QCFLAG_FAILED))
                qc = NULL;
 
@@ -497,7 +460,7 @@ void ata_bmdma_error_handler(struct ata_port *ap)
        ata_reset_fn_t hardreset;
 
        hardreset = NULL;
-       if (sata_scr_valid(ap))
+       if (sata_scr_valid(&ap->link))
                hardreset = sata_std_hardreset;
 
        ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, hardreset,
@@ -604,6 +567,9 @@ int ata_pci_init_bmdma(struct ata_host *host)
                if ((!(ap->flags & ATA_FLAG_IGN_SIMPLEX)) &&
                    (ioread8(bmdma + 2) & 0x80))
                        host->flags |= ATA_HOST_SIMPLEX;
+
+               ata_port_desc(ap, "bmdma 0x%llx",
+                       (unsigned long long)pci_resource_start(pdev, 4) + 8 * i);
        }
 
        return 0;
@@ -671,6 +637,10 @@ int ata_pci_init_sff_host(struct ata_host *host)
                        ((unsigned long)iomap[base + 1] | ATA_PCI_CTL_OFS);
                ata_std_ports(&ap->ioaddr);
 
+               ata_port_desc(ap, "cmd 0x%llx ctl 0x%llx",
+                       (unsigned long long)pci_resource_start(pdev, base),
+                       (unsigned long long)pci_resource_start(pdev, base + 1));
+
                mask |= 1 << i;
        }
 
@@ -841,24 +811,30 @@ int ata_pci_init_one(struct pci_dev *pdev,
                                      IRQF_SHARED, DRV_NAME, host);
                if (rc)
                        goto err_out;
-               host->irq = pdev->irq;
+
+               ata_port_desc(host->ports[0], "irq %d", pdev->irq);
+               ata_port_desc(host->ports[1], "irq %d", pdev->irq);
        } else {
                if (!ata_port_is_dummy(host->ports[0])) {
-                       host->irq = ATA_PRIMARY_IRQ(pdev);
-                       rc = devm_request_irq(dev, host->irq,
+                       rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev),
                                              pi->port_ops->irq_handler,
                                              IRQF_SHARED, DRV_NAME, host);
                        if (rc)
                                goto err_out;
+
+                       ata_port_desc(host->ports[0], "irq %d",
+                                     ATA_PRIMARY_IRQ(pdev));
                }
 
                if (!ata_port_is_dummy(host->ports[1])) {
-                       host->irq2 = ATA_SECONDARY_IRQ(pdev);
-                       rc = devm_request_irq(dev, host->irq2,
+                       rc = devm_request_irq(dev, ATA_SECONDARY_IRQ(pdev),
                                              pi->port_ops->irq_handler,
                                              IRQF_SHARED, DRV_NAME, host);
                        if (rc)
                                goto err_out;
+
+                       ata_port_desc(host->ports[1], "irq %d",
+                                     ATA_SECONDARY_IRQ(pdev));
                }
        }
 
@@ -880,7 +856,7 @@ err_out:
  *     @pdev: PCI device
  *
  *     Some PCI ATA devices report simplex mode but in fact can be told to
- *     enter non simplex mode. This implements the neccessary logic to
+ *     enter non simplex mode. This implements the necessary logic to
  *     perform the task on such devices. Calling it on other devices will
  *     have -undefined- behaviour.
  */
@@ -906,7 +882,7 @@ unsigned long ata_pci_default_filter(struct ata_device *adev, unsigned long xfer
        /* Filter out DMA modes if the device has been configured by
           the BIOS as PIO only */
 
-       if (adev->ap->ioaddr.bmdma_addr == 0)
+       if (adev->link->ap->ioaddr.bmdma_addr == NULL)
                xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
        return xfer_mask;
 }