libata: implement and use SHT initializers
[deliverable/linux.git] / drivers / ata / pata_scc.c
index ea2ef9fc15be6e2aa131497cc387b613c9466066..1833e9ef522ea94e038c1c440b613f1b4d066f68 100644 (file)
@@ -768,45 +768,47 @@ static u8 scc_bmdma_status (struct ata_port *ap)
 
 /**
  *     scc_data_xfer - Transfer data by PIO
- *     @adev: device for this I/O
+ *     @dev: device for this I/O
  *     @buf: data buffer
  *     @buflen: buffer length
- *     @write_data: read/write
+ *     @rw: read/write
  *
  *     Note: Original code is ata_data_xfer().
  */
 
-static void scc_data_xfer (struct ata_device *adev, unsigned char *buf,
-                          unsigned int buflen, int write_data)
+static unsigned int scc_data_xfer (struct ata_device *dev, unsigned char *buf,
+                                  unsigned int buflen, int rw)
 {
-       struct ata_port *ap = adev->link->ap;
+       struct ata_port *ap = dev->link->ap;
        unsigned int words = buflen >> 1;
        unsigned int i;
        u16 *buf16 = (u16 *) buf;
        void __iomem *mmio = ap->ioaddr.data_addr;
 
        /* Transfer multiple of 2 bytes */
-       if (write_data) {
-               for (i = 0; i < words; i++)
-                       out_be32(mmio, cpu_to_le16(buf16[i]));
-       } else {
+       if (rw == READ)
                for (i = 0; i < words; i++)
                        buf16[i] = le16_to_cpu(in_be32(mmio));
-       }
+       else
+               for (i = 0; i < words; i++)
+                       out_be32(mmio, cpu_to_le16(buf16[i]));
 
        /* Transfer trailing 1 byte, if any. */
        if (unlikely(buflen & 0x01)) {
                u16 align_buf[1] = { 0 };
                unsigned char *trailing_buf = buf + buflen - 1;
 
-               if (write_data) {
-                       memcpy(align_buf, trailing_buf, 1);
-                       out_be32(mmio, cpu_to_le16(align_buf[0]));
-               } else {
+               if (rw == READ) {
                        align_buf[0] = le16_to_cpu(in_be32(mmio));
                        memcpy(trailing_buf, align_buf, 1);
+               } else {
+                       memcpy(align_buf, trailing_buf, 1);
+                       out_be32(mmio, cpu_to_le16(align_buf[0]));
                }
+               words++;
        }
+
+       return words << 1;
 }
 
 /**
@@ -966,21 +968,7 @@ static void scc_port_stop (struct ata_port *ap)
 }
 
 static struct scsi_host_template scc_sht = {
-       .module                 = THIS_MODULE,
-       .name                   = DRV_NAME,
-       .ioctl                  = ata_scsi_ioctl,
-       .queuecommand           = ata_scsi_queuecmd,
-       .can_queue              = ATA_DEF_QUEUE,
-       .this_id                = ATA_SHT_THIS_ID,
-       .sg_tablesize           = LIBATA_MAX_PRD,
-       .cmd_per_lun            = ATA_SHT_CMD_PER_LUN,
-       .emulated               = ATA_SHT_EMULATED,
-       .use_clustering         = ATA_SHT_USE_CLUSTERING,
-       .proc_name              = DRV_NAME,
-       .dma_boundary           = ATA_DMA_BOUNDARY,
-       .slave_configure        = ata_scsi_slave_config,
-       .slave_destroy          = ata_scsi_slave_destroy,
-       .bios_param             = ata_std_bios_param,
+       ATA_BMDMA_SHT(DRV_NAME),
 };
 
 static const struct ata_port_operations scc_pata_ops = {
@@ -1005,6 +993,8 @@ static const struct ata_port_operations scc_pata_ops = {
        .qc_issue               = ata_qc_issue_prot,
 
        .freeze                 = scc_bmdma_freeze,
+       .thaw                   = ata_bmdma_thaw,
+
        .error_handler          = scc_error_handler,
        .post_internal_cmd      = scc_bmdma_stop,
 
This page took 0.025397 seconds and 5 git commands to generate.