Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
[safe/jmp/linux-2.6] / drivers / ata / pata_platform.c
index 224bb6c..50400fa 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Based on pata_pcmcia:
  *
- *   Copyright 2005-2006 Red Hat Inc <alan@redhat.com>, all rights reserved.
+ *   Copyright 2005-2006 Red Hat Inc, all rights reserved.
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -19,7 +19,7 @@
 #include <linux/ata.h>
 #include <linux/libata.h>
 #include <linux/platform_device.h>
-#include <linux/pata_platform.h>
+#include <linux/ata_platform.h>
 
 #define DRV_NAME "pata_platform"
 #define DRV_VERSION "1.2"
@@ -34,62 +34,25 @@ static int pata_platform_set_mode(struct ata_link *link, struct ata_device **unu
 {
        struct ata_device *dev;
 
-       ata_link_for_each_dev(dev, link) {
-               if (ata_dev_enabled(dev)) {
-                       /* We don't really care */
-                       dev->pio_mode = dev->xfer_mode = XFER_PIO_0;
-                       dev->xfer_shift = ATA_SHIFT_PIO;
-                       dev->flags |= ATA_DFLAG_PIO;
-                       ata_dev_printk(dev, KERN_INFO, "configured for PIO\n");
-               }
+       ata_for_each_dev(dev, link, ENABLED) {
+               /* We don't really care */
+               dev->pio_mode = dev->xfer_mode = XFER_PIO_0;
+               dev->xfer_shift = ATA_SHIFT_PIO;
+               dev->flags |= ATA_DFLAG_PIO;
+               ata_dev_printk(dev, KERN_INFO, "configured for PIO\n");
        }
        return 0;
 }
 
-static int ata_dummy_ret0(struct ata_port *ap) { return 0; }
-
 static struct scsi_host_template pata_platform_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 pata_platform_port_ops = {
-       .set_mode               = pata_platform_set_mode,
-
-       .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,
+       .sff_data_xfer          = ata_sff_data_xfer_noirq,
        .cable_detect           = ata_cable_unknown,
-
-       .qc_prep                = ata_qc_prep,
-       .qc_issue               = ata_qc_issue_prot,
-
-       .data_xfer              = ata_data_xfer_noirq,
-
-       .irq_clear              = ata_bmdma_irq_clear,
-       .irq_on                 = ata_irq_on,
-
-       .port_start             = ata_dummy_ret0,
+       .set_mode               = pata_platform_set_mode,
 };
 
 static void pata_platform_setup_port(struct ata_ioports *ioaddr,
@@ -187,14 +150,14 @@ int __devinit __pata_platform_probe(struct device *dev,
         */
        if (mmio) {
                ap->ioaddr.cmd_addr = devm_ioremap(dev, io_res->start,
-                               io_res->end - io_res->start + 1);
+                               resource_size(io_res));
                ap->ioaddr.ctl_addr = devm_ioremap(dev, ctl_res->start,
-                               ctl_res->end - ctl_res->start + 1);
+                               resource_size(ctl_res));
        } else {
                ap->ioaddr.cmd_addr = devm_ioport_map(dev, io_res->start,
-                               io_res->end - io_res->start + 1);
+                               resource_size(io_res));
                ap->ioaddr.ctl_addr = devm_ioport_map(dev, ctl_res->start,
-                               ctl_res->end - ctl_res->start + 1);
+                               resource_size(ctl_res));
        }
        if (!ap->ioaddr.cmd_addr || !ap->ioaddr.ctl_addr) {
                dev_err(dev, "failed to map IO/CTL base\n");
@@ -210,7 +173,7 @@ int __devinit __pata_platform_probe(struct device *dev,
                      (unsigned long long)ctl_res->start);
 
        /* activate */
-       return ata_host_activate(host, irq, irq ? ata_interrupt : NULL,
+       return ata_host_activate(host, irq, irq ? ata_sff_interrupt : NULL,
                                 irq_flags, &pata_platform_sht);
 }
 EXPORT_SYMBOL_GPL(__pata_platform_probe);
@@ -222,7 +185,7 @@ EXPORT_SYMBOL_GPL(__pata_platform_probe);
  *     A platform bus ATA device has been unplugged. Perform the needed
  *     cleanup. Also called on module unload for any active devices.
  */
-int __devexit __pata_platform_remove(struct device *dev)
+int __pata_platform_remove(struct device *dev)
 {
        struct ata_host *host = dev_get_drvdata(dev);
 
@@ -311,3 +274,4 @@ MODULE_AUTHOR("Paul Mundt");
 MODULE_DESCRIPTION("low-level driver for platform device ATA");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
+MODULE_ALIAS("platform:" DRV_NAME);