asus_acpi: convert to seq_file
[safe/jmp/linux-2.6] / drivers / ata / pata_isapnp.c
index 5525518..4bceb88 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
  *   pata-isapnp.c - ISA PnP PATA controller driver.
- *   Copyright 2005/2006 Red Hat Inc <alan@redhat.com>, all rights reserved.
+ *   Copyright 2005/2006 Red Hat Inc, all rights reserved.
  *
  *   Based in part on ide-pnp.c by Andrey Panin <pazke@donpac.ru>
  */
 #include <linux/libata.h>
 
 #define DRV_NAME "pata_isapnp"
-#define DRV_VERSION "0.2.1"
+#define DRV_VERSION "0.2.5"
 
 static struct scsi_host_template isapnp_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_PIO_SHT(DRV_NAME),
 };
 
 static struct ata_port_operations isapnp_port_ops = {
-       .port_disable   = ata_port_disable,
-       .tf_load        = ata_tf_load,
-       .tf_read        = ata_tf_read,
-       .check_status   = ata_check_status,
-       .exec_command   = ata_exec_command,
-       .dev_select     = ata_std_dev_select,
-
-       .freeze         = ata_bmdma_freeze,
-       .thaw           = ata_bmdma_thaw,
-       .error_handler  = ata_bmdma_error_handler,
-       .post_internal_cmd = ata_bmdma_post_internal_cmd,
+       .inherits       = &ata_sff_port_ops,
        .cable_detect   = ata_cable_40wire,
+};
 
-       .qc_prep        = ata_qc_prep,
-       .qc_issue       = ata_qc_issue_prot,
-
-       .data_xfer      = ata_data_xfer,
-
-       .irq_clear      = ata_bmdma_irq_clear,
-       .irq_on         = ata_irq_on,
-       .irq_ack        = ata_irq_ack,
-
-       .port_start     = ata_port_start,
+static struct ata_port_operations isapnp_noalt_port_ops = {
+       .inherits       = &ata_sff_port_ops,
+       .cable_detect   = ata_cable_40wire,
+       /* No altstatus so we don't want to use the lost interrupt poll */
+       .lost_interrupt = ATA_OP_NULL,
 };
 
 /**
@@ -77,13 +49,16 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev
        struct ata_host *host;
        struct ata_port *ap;
        void __iomem *cmd_addr, *ctl_addr;
+       int irq = 0;
+       irq_handler_t handler = NULL;
 
        if (pnp_port_valid(idev, 0) == 0)
                return -ENODEV;
 
-       /* FIXME: Should selected polled PIO here not fail */
-       if (pnp_irq_valid(idev, 0) == 0)
-               return -ENODEV;
+       if (pnp_irq_valid(idev, 0)) {
+               irq = pnp_irq(idev, 0);
+               handler = ata_sff_interrupt;
+       }
 
        /* allocate host */
        host = ata_host_alloc(&idev->dev, 1);
@@ -97,8 +72,8 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev
 
        ap = host->ports[0];
 
-       ap->ops = &isapnp_port_ops;
-       ap->pio_mask = 1;
+       ap->ops = &isapnp_noalt_port_ops;
+       ap->pio_mask = ATA_PIO0;
        ap->flags |= ATA_FLAG_SLAVE_POSS;
 
        ap->ioaddr.cmd_addr = cmd_addr;
@@ -108,12 +83,17 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev
                                           pnp_port_start(idev, 1), 1);
                ap->ioaddr.altstatus_addr = ctl_addr;
                ap->ioaddr.ctl_addr = ctl_addr;
+               ap->ops = &isapnp_port_ops;
        }
 
-       ata_std_ports(&ap->ioaddr);
+       ata_sff_std_ports(&ap->ioaddr);
+
+       ata_port_desc(ap, "cmd 0x%llx ctl 0x%llx",
+                     (unsigned long long)pnp_port_start(idev, 0),
+                     (unsigned long long)pnp_port_start(idev, 1));
 
        /* activate */
-       return ata_host_activate(host, pnp_irq(idev, 0), ata_interrupt, 0,
+       return ata_host_activate(host, irq, handler, 0,
                                 &isapnp_sht);
 }
 
@@ -139,6 +119,8 @@ static struct pnp_device_id isapnp_devices[] = {
        {.id = ""}
 };
 
+MODULE_DEVICE_TABLE(pnp, isapnp_devices);
+
 static struct pnp_driver isapnp_driver = {
        .name           = DRV_NAME,
        .id_table       = isapnp_devices,