]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
libata: const-ification bombing run
authorJeff Garzik <jgarzik@pobox.com>
Sat, 22 Oct 2005 18:27:05 +0000 (14:27 -0400)
committerJeff Garzik <jgarzik@pobox.com>
Sat, 22 Oct 2005 18:27:05 +0000 (14:27 -0400)
Enforce access rules where appropriate.

If the compiler is smart enough, this may buy us an optimization or two
as a side effect.

20 files changed:
drivers/scsi/ahci.c
drivers/scsi/ata_piix.c
drivers/scsi/libata-core.c
drivers/scsi/libata-scsi.c
drivers/scsi/libata.h
drivers/scsi/pdc_adma.c
drivers/scsi/sata_mv.c
drivers/scsi/sata_nv.c
drivers/scsi/sata_promise.c
drivers/scsi/sata_qstor.c
drivers/scsi/sata_sil.c
drivers/scsi/sata_sil24.c
drivers/scsi/sata_sis.c
drivers/scsi/sata_svw.c
drivers/scsi/sata_sx4.c
drivers/scsi/sata_uli.c
drivers/scsi/sata_via.c
drivers/scsi/sata_vsc.c
include/linux/ata.h
include/linux/libata.h

index cfa22e4ee547d8e31a438d38eaaa1663e6c54fe6..fe8187d6f58be248bdcf2f5ab053ff997ecb2dac 100644 (file)
@@ -216,7 +216,7 @@ static Scsi_Host_Template ahci_sht = {
        .ordered_flush          = 1,
 };
 
-static struct ata_port_operations ahci_ops = {
+static const struct ata_port_operations ahci_ops = {
        .port_disable           = ata_port_disable,
 
        .check_status           = ahci_check_status,
index d71cef767cec7849c09a6217234872f370a8926a..be021478f41628ddc53f95adf0150534ce937454 100644 (file)
@@ -147,7 +147,7 @@ static Scsi_Host_Template piix_sht = {
        .ordered_flush          = 1,
 };
 
-static struct ata_port_operations piix_pata_ops = {
+static const struct ata_port_operations piix_pata_ops = {
        .port_disable           = ata_port_disable,
        .set_piomode            = piix_set_piomode,
        .set_dmamode            = piix_set_dmamode,
@@ -177,7 +177,7 @@ static struct ata_port_operations piix_pata_ops = {
        .host_stop              = ata_host_stop,
 };
 
-static struct ata_port_operations piix_sata_ops = {
+static const struct ata_port_operations piix_sata_ops = {
        .port_disable           = ata_port_disable,
 
        .tf_load                = ata_tf_load,
index 9269fd9b814f9546aadc8f0bae84553bc430fa2d..d55f12dacfcb28e31306d7b08bf58eff955cf5ee 100644 (file)
@@ -67,9 +67,9 @@ static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev);
 static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev);
 static void ata_set_mode(struct ata_port *ap);
 static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev);
-static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift);
+static unsigned int ata_get_mode_mask(const struct ata_port *ap, int shift);
 static int fgb(u32 bitmap);
-static int ata_choose_xfer_mode(struct ata_port *ap,
+static int ata_choose_xfer_mode(const struct ata_port *ap,
                                u8 *xfer_mode_out,
                                unsigned int *xfer_shift_out);
 static void __ata_qc_complete(struct ata_queued_cmd *qc);
@@ -97,7 +97,7 @@ MODULE_VERSION(DRV_VERSION);
  *     Inherited from caller.
  */
 
-static void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf)
+static void ata_tf_load_pio(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        struct ata_ioports *ioaddr = &ap->ioaddr;
        unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
@@ -155,7 +155,7 @@ static void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf)
  *     Inherited from caller.
  */
 
-static void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
+static void ata_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        struct ata_ioports *ioaddr = &ap->ioaddr;
        unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
@@ -224,7 +224,7 @@ static void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
  *     LOCKING:
  *     Inherited from caller.
  */
-void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf)
+void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        if (ap->flags & ATA_FLAG_MMIO)
                ata_tf_load_mmio(ap, tf);
@@ -244,7 +244,7 @@ void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf)
  *     spin_lock_irqsave(host_set lock)
  */
 
-static void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf)
+static void ata_exec_command_pio(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command);
 
@@ -265,7 +265,7 @@ static void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf)
  *     spin_lock_irqsave(host_set lock)
  */
 
-static void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
+static void ata_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command);
 
@@ -285,7 +285,7 @@ static void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
  *     LOCKING:
  *     spin_lock_irqsave(host_set lock)
  */
-void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf)
+void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        if (ap->flags & ATA_FLAG_MMIO)
                ata_exec_command_mmio(ap, tf);
@@ -305,7 +305,7 @@ void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf)
  *     Obtains host_set lock.
  */
 
-static inline void ata_exec(struct ata_port *ap, struct ata_taskfile *tf)
+static inline void ata_exec(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        unsigned long flags;
 
@@ -328,7 +328,7 @@ static inline void ata_exec(struct ata_port *ap, struct ata_taskfile *tf)
  *     Obtains host_set lock.
  */
 
-static void ata_tf_to_host(struct ata_port *ap, struct ata_taskfile *tf)
+static void ata_tf_to_host(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        ap->ops->tf_load(ap, tf);
 
@@ -348,7 +348,7 @@ static void ata_tf_to_host(struct ata_port *ap, struct ata_taskfile *tf)
  *     spin_lock_irqsave(host_set lock)
  */
 
-void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf)
+void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        ap->ops->tf_load(ap, tf);
        ap->ops->exec_command(ap, tf);
@@ -558,7 +558,7 @@ u8 ata_chk_err(struct ata_port *ap)
  *     Inherited from caller.
  */
 
-void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp)
+void ata_tf_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp)
 {
        fis[0] = 0x27;  /* Register - Host to Device FIS */
        fis[1] = (pmp & 0xf) | (1 << 7); /* Port multiplier number,
@@ -599,7 +599,7 @@ void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp)
  *     Inherited from caller.
  */
 
-void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf)
+void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf)
 {
        tf->command     = fis[2];       /* status */
        tf->feature     = fis[3];       /* error */
@@ -845,7 +845,7 @@ static unsigned int ata_devchk(struct ata_port *ap,
  *     the event of failure.
  */
 
-unsigned int ata_dev_classify(struct ata_taskfile *tf)
+unsigned int ata_dev_classify(const struct ata_taskfile *tf)
 {
        /* Apple's open source Darwin code hints that some devices only
         * put a proper signature into the LBA mid/high registers,
@@ -937,7 +937,7 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device)
  *     caller.
  */
 
-void ata_dev_id_string(u16 *id, unsigned char *s,
+void ata_dev_id_string(const u16 *id, unsigned char *s,
                       unsigned int ofs, unsigned int len)
 {
        unsigned int c;
@@ -1054,7 +1054,7 @@ void ata_dev_select(struct ata_port *ap, unsigned int device,
  *     caller.
  */
 
-static inline void ata_dump_id(struct ata_device *dev)
+static inline void ata_dump_id(const struct ata_device *dev)
 {
        DPRINTK("49==0x%04x  "
                "53==0x%04x  "
@@ -1089,7 +1089,7 @@ static inline void ata_dump_id(struct ata_device *dev)
  *     FIXME: pre IDE drive timing (do we care ?). 
  */
 
-static unsigned int ata_pio_modes(struct ata_device *adev)
+static unsigned int ata_pio_modes(const struct ata_device *adev)
 {
        u16 modes;
 
@@ -1352,7 +1352,7 @@ err_out:
 }
 
 
-static inline u8 ata_dev_knobble(struct ata_port *ap)
+static inline u8 ata_dev_knobble(const struct ata_port *ap)
 {
        return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(ap->device->id)));
 }
@@ -1684,7 +1684,7 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed,
        return 0;
 }
 
-static struct {
+static const struct {
        unsigned int shift;
        u8 base;
 } xfer_mode_classes[] = {
@@ -2093,7 +2093,8 @@ err_out:
        DPRINTK("EXIT\n");
 }
 
-static void ata_pr_blacklisted(struct ata_port *ap, struct ata_device *dev)
+static void ata_pr_blacklisted(const struct ata_port *ap,
+                              const struct ata_device *dev)
 {
        printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, disabling DMA\n",
                ap->id, dev->devno);
@@ -2131,7 +2132,7 @@ static const char * ata_dma_blacklist [] = {
        "_NEC DV5800A",
 };
 
-static int ata_dma_blacklisted(struct ata_port *ap, struct ata_device *dev)
+static int ata_dma_blacklisted(const struct ata_device *dev)
 {
        unsigned char model_num[40];
        char *s;
@@ -2156,9 +2157,9 @@ static int ata_dma_blacklisted(struct ata_port *ap, struct ata_device *dev)
        return 0;
 }
 
-static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift)
+static unsigned int ata_get_mode_mask(const struct ata_port *ap, int shift)
 {
-       struct ata_device *master, *slave;
+       const struct ata_device *master, *slave;
        unsigned int mask;
 
        master = &ap->device[0];
@@ -2170,14 +2171,14 @@ static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift)
                mask = ap->udma_mask;
                if (ata_dev_present(master)) {
                        mask &= (master->id[ATA_ID_UDMA_MODES] & 0xff);
-                       if (ata_dma_blacklisted(ap, master)) {
+                       if (ata_dma_blacklisted(master)) {
                                mask = 0;
                                ata_pr_blacklisted(ap, master);
                        }
                }
                if (ata_dev_present(slave)) {
                        mask &= (slave->id[ATA_ID_UDMA_MODES] & 0xff);
-                       if (ata_dma_blacklisted(ap, slave)) {
+                       if (ata_dma_blacklisted(slave)) {
                                mask = 0;
                                ata_pr_blacklisted(ap, slave);
                        }
@@ -2187,14 +2188,14 @@ static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift)
                mask = ap->mwdma_mask;
                if (ata_dev_present(master)) {
                        mask &= (master->id[ATA_ID_MWDMA_MODES] & 0x07);
-                       if (ata_dma_blacklisted(ap, master)) {
+                       if (ata_dma_blacklisted(master)) {
                                mask = 0;
                                ata_pr_blacklisted(ap, master);
                        }
                }
                if (ata_dev_present(slave)) {
                        mask &= (slave->id[ATA_ID_MWDMA_MODES] & 0x07);
-                       if (ata_dma_blacklisted(ap, slave)) {
+                       if (ata_dma_blacklisted(slave)) {
                                mask = 0;
                                ata_pr_blacklisted(ap, slave);
                        }
@@ -2258,7 +2259,7 @@ static int fgb(u32 bitmap)
  *     Zero on success, negative on error.
  */
 
-static int ata_choose_xfer_mode(struct ata_port *ap,
+static int ata_choose_xfer_mode(const struct ata_port *ap,
                                u8 *xfer_mode_out,
                                unsigned int *xfer_shift_out)
 {
@@ -4144,7 +4145,7 @@ static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister)
 
 static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
                          struct ata_host_set *host_set,
-                         struct ata_probe_ent *ent, unsigned int port_no)
+                         const struct ata_probe_ent *ent, unsigned int port_no)
 {
        unsigned int i;
 
@@ -4203,7 +4204,7 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
  *
  */
 
-static struct ata_port * ata_host_add(struct ata_probe_ent *ent,
+static struct ata_port * ata_host_add(const struct ata_probe_ent *ent,
                                      struct ata_host_set *host_set,
                                      unsigned int port_no)
 {
@@ -4251,7 +4252,7 @@ err_out:
  *
  */
 
-int ata_device_add(struct ata_probe_ent *ent)
+int ata_device_add(const struct ata_probe_ent *ent)
 {
        unsigned int count = 0, i;
        struct device *dev = ent->dev;
@@ -4470,7 +4471,7 @@ void ata_std_ports(struct ata_ioports *ioaddr)
 }
 
 static struct ata_probe_ent *
-ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port)
+ata_probe_ent_alloc(struct device *dev, const struct ata_port_info *port)
 {
        struct ata_probe_ent *probe_ent;
 
@@ -4570,7 +4571,6 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, stru
        if (!probe_ent)
                return NULL;
 
-       
        probe_ent->legacy_mode = 1;
        probe_ent->n_ports = 1;
        probe_ent->hard_port_no = port_num;
@@ -4783,7 +4783,7 @@ void ata_pci_remove_one (struct pci_dev *pdev)
 }
 
 /* move to PCI subsystem */
-int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits)
+int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits)
 {
        unsigned long tmp = 0;
 
index 90bf22204668c1828934c598db6492a9a1d96de7..58858886d751c8886fb4c5af8d354c57ff3069fc 100644 (file)
@@ -44,9 +44,9 @@
 
 #include "libata.h"
 
-typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, u8 *scsicmd);
+typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, const u8 *scsicmd);
 static struct ata_device *
-ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev);
+ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev);
 
 
 static void ata_scsi_invalid_field(struct scsi_cmnd *cmd,
@@ -418,7 +418,7 @@ int ata_scsi_error(struct Scsi_Host *host)
  */
 
 static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc,
-                                            u8 *scsicmd)
+                                            const u8 *scsicmd)
 {
        struct ata_taskfile *tf = &qc->tf;
 
@@ -485,7 +485,7 @@ invalid_fld:
  *     Zero on success, non-zero on error.
  */
 
-static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
+static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd)
 {
        struct ata_taskfile *tf = &qc->tf;
 
@@ -512,7 +512,7 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
  *     @plen: the transfer length
  */
 
-static void scsi_6_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
+static void scsi_6_lba_len(const u8 *scsicmd, u64 *plba, u32 *plen)
 {
        u64 lba = 0;
        u32 len = 0;
@@ -539,7 +539,7 @@ static void scsi_6_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
  *     @plen: the transfer length
  */
 
-static void scsi_10_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
+static void scsi_10_lba_len(const u8 *scsicmd, u64 *plba, u32 *plen)
 {
        u64 lba = 0;
        u32 len = 0;
@@ -569,7 +569,7 @@ static void scsi_10_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
  *     @plen: the transfer length
  */
 
-static void scsi_16_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
+static void scsi_16_lba_len(const u8 *scsicmd, u64 *plba, u32 *plen)
 {
        u64 lba = 0;
        u32 len = 0;
@@ -608,7 +608,7 @@ static void scsi_16_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
  *     Zero on success, non-zero on error.
  */
 
-static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
+static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd)
 {
        struct ata_taskfile *tf = &qc->tf;
        struct ata_device *dev = qc->dev;
@@ -734,7 +734,7 @@ nothing_to_do:
  *     Zero on success, non-zero on error.
  */
 
-static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
+static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd)
 {
        struct ata_taskfile *tf = &qc->tf;
        struct ata_device *dev = qc->dev;
@@ -1688,7 +1688,7 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
  *     Zero on success, non-zero on failure.
  */
 
-static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
+static unsigned int atapi_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd)
 {
        struct scsi_cmnd *cmd = qc->scsicmd;
        struct ata_device *dev = qc->dev;
@@ -1757,7 +1757,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
  */
 
 static struct ata_device *
-ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev)
+ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
 {
        struct ata_device *dev;
 
@@ -1914,7 +1914,7 @@ void ata_scsi_simulate(u16 *id,
                      void (*done)(struct scsi_cmnd *))
 {
        struct ata_scsi_args args;
-       u8 *scsicmd = cmd->cmnd;
+       const u8 *scsicmd = cmd->cmnd;
 
        args.id = id;
        args.cmd = cmd;
index 67d752ca8ae2e5fd3115ac41867c4d6f651b0602..3d60190584ba00355b1de133f7d322d49c27c0af 100644 (file)
@@ -48,7 +48,7 @@ extern int ata_qc_issue(struct ata_queued_cmd *qc);
 extern int ata_check_atapi_dma(struct ata_queued_cmd *qc);
 extern void ata_dev_select(struct ata_port *ap, unsigned int device,
                            unsigned int wait, unsigned int can_sleep);
-extern void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf);
+extern void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf);
 extern void swap_buf_le16(u16 *buf, unsigned int buf_words);
 
 
index 53b8db4be1a9e3700218741c9b899e4722951081..9820f272f889291680f0771c7c84afd3ae6b5f39 100644 (file)
@@ -158,7 +158,7 @@ static Scsi_Host_Template adma_ata_sht = {
        .bios_param             = ata_std_bios_param,
 };
 
-static struct ata_port_operations adma_ata_ops = {
+static const struct ata_port_operations adma_ata_ops = {
        .port_disable           = ata_port_disable,
        .tf_load                = ata_tf_load,
        .tf_read                = ata_tf_read,
index 9b6213928f7aaa825527cafb0b6478272ed7ecd8..422e0b6f603ac5b8960073def04a2757f8ed79e8 100644 (file)
@@ -290,7 +290,7 @@ static Scsi_Host_Template mv_sht = {
        .ordered_flush          = 1,
 };
 
-static struct ata_port_operations mv_ops = {
+static const struct ata_port_operations mv_ops = {
        .port_disable           = ata_port_disable,
 
        .tf_load                = ata_tf_load,
index 8866530bc4915cf70c0a0b6e81d483d275a8071d..1a56d6c79dddfc8fac2e52d4320110977e1ce599 100644 (file)
@@ -238,7 +238,7 @@ static Scsi_Host_Template nv_sht = {
        .ordered_flush          = 1,
 };
 
-static struct ata_port_operations nv_ops = {
+static const struct ata_port_operations nv_ops = {
        .port_disable           = ata_port_disable,
        .tf_load                = ata_tf_load,
        .tf_read                = ata_tf_read,
index 9bf8cbd2990131619e883df08db59c3b89a1e72f..eee93b0016df36f86056cd4f8040ba0182019d76 100644 (file)
@@ -87,8 +87,8 @@ static void pdc_port_stop(struct ata_port *ap);
 static void pdc_pata_phy_reset(struct ata_port *ap);
 static void pdc_sata_phy_reset(struct ata_port *ap);
 static void pdc_qc_prep(struct ata_queued_cmd *qc);
-static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf);
-static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf);
+static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
+static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
 static void pdc_irq_clear(struct ata_port *ap);
 static int pdc_qc_issue_prot(struct ata_queued_cmd *qc);
 
@@ -113,7 +113,7 @@ static Scsi_Host_Template pdc_ata_sht = {
        .ordered_flush          = 1,
 };
 
-static struct ata_port_operations pdc_sata_ops = {
+static const struct ata_port_operations pdc_sata_ops = {
        .port_disable           = ata_port_disable,
        .tf_load                = pdc_tf_load_mmio,
        .tf_read                = ata_tf_read,
@@ -136,7 +136,7 @@ static struct ata_port_operations pdc_sata_ops = {
        .host_stop              = ata_pci_host_stop,
 };
 
-static struct ata_port_operations pdc_pata_ops = {
+static const struct ata_port_operations pdc_pata_ops = {
        .port_disable           = ata_port_disable,
        .tf_load                = pdc_tf_load_mmio,
        .tf_read                = ata_tf_read,
@@ -546,7 +546,7 @@ static int pdc_qc_issue_prot(struct ata_queued_cmd *qc)
        return ata_qc_issue_prot(qc);
 }
 
-static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
+static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        WARN_ON (tf->protocol == ATA_PROT_DMA ||
                 tf->protocol == ATA_PROT_NODATA);
@@ -554,7 +554,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
 }
 
 
-static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
+static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        WARN_ON (tf->protocol == ATA_PROT_DMA ||
                 tf->protocol == ATA_PROT_NODATA);
index e1c1dae27c522970eefb541e9a66a1b994896de0..250dafa6bc363721f189ceeaf030522356ad8242 100644 (file)
@@ -147,7 +147,7 @@ static Scsi_Host_Template qs_ata_sht = {
        .bios_param             = ata_std_bios_param,
 };
 
-static struct ata_port_operations qs_ata_ops = {
+static const struct ata_port_operations qs_ata_ops = {
        .port_disable           = ata_port_disable,
        .tf_load                = ata_tf_load,
        .tf_read                = ata_tf_read,
index f6f0184e1ac858c9f9acf5207a5b297019a58c9b..3a056173fb95a2c9a62598906fcec57231e7db76 100644 (file)
@@ -150,7 +150,7 @@ static Scsi_Host_Template sil_sht = {
        .ordered_flush          = 1,
 };
 
-static struct ata_port_operations sil_ops = {
+static const struct ata_port_operations sil_ops = {
        .port_disable           = ata_port_disable,
        .dev_config             = sil_dev_config,
        .tf_load                = ata_tf_load,
index 19857814d69fbe25874b19565b58115896cc4128..32d730bd5bb605468b3ba67f07420a8ef2480fca 100644 (file)
@@ -275,7 +275,7 @@ static Scsi_Host_Template sil24_sht = {
        .ordered_flush          = 1, /* NCQ not supported yet */
 };
 
-static struct ata_port_operations sil24_ops = {
+static const struct ata_port_operations sil24_ops = {
        .port_disable           = ata_port_disable,
 
        .check_status           = sil24_check_status,
index 0761a3234fcf092be55ac1f2c837c5c713b61253..057f7b98b6c448dea78cc02a4c6688f545c5bb05 100644 (file)
@@ -102,7 +102,7 @@ static Scsi_Host_Template sis_sht = {
        .ordered_flush          = 1,
 };
 
-static struct ata_port_operations sis_ops = {
+static const struct ata_port_operations sis_ops = {
        .port_disable           = ata_port_disable,
        .tf_load                = ata_tf_load,
        .tf_read                = ata_tf_read,
index d89d968bedace68ad91771a168455b0164b12bb0..e0f9570bc6ddd391a96cfb6c53eeb40b63eaef5b 100644 (file)
@@ -102,7 +102,7 @@ static void k2_sata_scr_write (struct ata_port *ap, unsigned int sc_reg,
 }
 
 
-static void k2_sata_tf_load(struct ata_port *ap, struct ata_taskfile *tf)
+static void k2_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        struct ata_ioports *ioaddr = &ap->ioaddr;
        unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
@@ -297,7 +297,7 @@ static Scsi_Host_Template k2_sata_sht = {
 };
 
 
-static struct ata_port_operations k2_sata_ops = {
+static const struct ata_port_operations k2_sata_ops = {
        .port_disable           = ata_port_disable,
        .tf_load                = k2_sata_tf_load,
        .tf_read                = k2_sata_tf_read,
index d6d350a0b5e98d0a4e6b4e0a2adee41442ea014b..af08f4f650c1ef6da8526b3524259a4b031fa159 100644 (file)
@@ -157,8 +157,8 @@ static void pdc_20621_phy_reset (struct ata_port *ap);
 static int pdc_port_start(struct ata_port *ap);
 static void pdc_port_stop(struct ata_port *ap);
 static void pdc20621_qc_prep(struct ata_queued_cmd *qc);
-static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf);
-static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf);
+static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
+static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
 static void pdc20621_host_stop(struct ata_host_set *host_set);
 static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe);
 static int pdc20621_detect_dimm(struct ata_probe_ent *pe);
@@ -196,7 +196,7 @@ static Scsi_Host_Template pdc_sata_sht = {
        .ordered_flush          = 1,
 };
 
-static struct ata_port_operations pdc_20621_ops = {
+static const struct ata_port_operations pdc_20621_ops = {
        .port_disable           = ata_port_disable,
        .tf_load                = pdc_tf_load_mmio,
        .tf_read                = ata_tf_read,
@@ -899,7 +899,7 @@ out:
        DPRINTK("EXIT\n");
 }
 
-static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
+static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        WARN_ON (tf->protocol == ATA_PROT_DMA ||
                 tf->protocol == ATA_PROT_NODATA);
@@ -907,7 +907,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
 }
 
 
-static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
+static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        WARN_ON (tf->protocol == ATA_PROT_DMA ||
                 tf->protocol == ATA_PROT_NODATA);
index 9c06f2abe7f7950f8bd0a945cb694cc2dca399a5..d68dc7d3422c4c54384789b24f605db45962e3e9 100644 (file)
@@ -90,7 +90,7 @@ static Scsi_Host_Template uli_sht = {
        .ordered_flush          = 1,
 };
 
-static struct ata_port_operations uli_ops = {
+static const struct ata_port_operations uli_ops = {
        .port_disable           = ata_port_disable,
 
        .tf_load                = ata_tf_load,
index 565872479b9a03258a0dc3351c24d83fb4665c6c..80e291a909a972be9dc34366df1ab407689a22fc 100644 (file)
@@ -109,7 +109,7 @@ static Scsi_Host_Template svia_sht = {
        .ordered_flush          = 1,
 };
 
-static struct ata_port_operations svia_sata_ops = {
+static const struct ata_port_operations svia_sata_ops = {
        .port_disable           = ata_port_disable,
 
        .tf_load                = ata_tf_load,
index 877b9fda39650424a18c5905c52f5ee07f954723..5af05fdf8544392cc8eb6a1d4d950c39fa808b81 100644 (file)
@@ -115,7 +115,7 @@ static void vsc_intr_mask_update(struct ata_port *ap, u8 ctl)
 }
 
 
-static void vsc_sata_tf_load(struct ata_port *ap, struct ata_taskfile *tf)
+static void vsc_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        struct ata_ioports *ioaddr = &ap->ioaddr;
        unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
@@ -231,7 +231,7 @@ static Scsi_Host_Template vsc_sata_sht = {
 };
 
 
-static struct ata_port_operations vsc_sata_ops = {
+static const struct ata_port_operations vsc_sata_ops = {
        .port_disable           = ata_port_disable,
        .tf_load                = vsc_sata_tf_load,
        .tf_read                = vsc_sata_tf_read,
index 33276d1d05d26e0672e9bf89c8b7b3da809abbc1..d2873b732bb1255ac08515d21e3ca832f601a058 100644 (file)
@@ -261,7 +261,7 @@ struct ata_taskfile {
          ((u64) (id)[(n) + 1] << 16) | \
          ((u64) (id)[(n) + 0]) )
 
-static inline int ata_id_current_chs_valid(u16 *id)
+static inline int ata_id_current_chs_valid(const u16 *id)
 {
        /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 
           has not been issued to the device then the values of 
@@ -273,7 +273,7 @@ static inline int ata_id_current_chs_valid(u16 *id)
                id[56];    /* sectors in current translation */
 }
 
-static inline int atapi_cdb_len(u16 *dev_id)
+static inline int atapi_cdb_len(const u16 *dev_id)
 {
        u16 tmp = dev_id[0] & 0x3;
        switch (tmp) {
@@ -283,7 +283,7 @@ static inline int atapi_cdb_len(u16 *dev_id)
        }
 }
 
-static inline int is_atapi_taskfile(struct ata_taskfile *tf)
+static inline int is_atapi_taskfile(const struct ata_taskfile *tf)
 {
        return (tf->protocol == ATA_PROT_ATAPI) ||
               (tf->protocol == ATA_PROT_ATAPI_NODATA) ||
index 634b5aa0a615d2fa568431e01f3151ee36feebf7..00a8a5738858bd4e3a13e53cd93c3ec03196f22b 100644 (file)
@@ -202,7 +202,7 @@ struct ata_ioports {
 struct ata_probe_ent {
        struct list_head        node;
        struct device           *dev;
-       struct ata_port_operations      *port_ops;
+       const struct ata_port_operations *port_ops;
        Scsi_Host_Template      *sht;
        struct ata_ioports      port[ATA_MAX_PORTS];
        unsigned int            n_ports;
@@ -225,7 +225,7 @@ struct ata_host_set {
        void __iomem            *mmio_base;
        unsigned int            n_ports;
        void                    *private_data;
-       struct ata_port_operations *ops;
+       const struct ata_port_operations *ops;
        struct ata_port *       ports[0];
 };
 
@@ -294,7 +294,7 @@ struct ata_device {
 
 struct ata_port {
        struct Scsi_Host        *host;  /* our co-allocated scsi host */
-       struct ata_port_operations      *ops;
+       const struct ata_port_operations *ops;
        unsigned long           flags;  /* ATA_FLAG_xxx */
        unsigned int            id;     /* unique id req'd by scsi midlyr */
        unsigned int            port_no; /* unique port #; from zero */
@@ -341,10 +341,10 @@ struct ata_port_operations {
        void (*set_piomode) (struct ata_port *, struct ata_device *);
        void (*set_dmamode) (struct ata_port *, struct ata_device *);
 
-       void (*tf_load) (struct ata_port *ap, struct ata_taskfile *tf);
+       void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf);
        void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf);
 
-       void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf);
+       void (*exec_command)(struct ata_port *ap, const struct ata_taskfile *tf);
        u8   (*check_status)(struct ata_port *ap);
        u8   (*check_altstatus)(struct ata_port *ap);
        u8   (*check_err)(struct ata_port *ap);
@@ -385,7 +385,7 @@ struct ata_port_info {
        unsigned long           pio_mask;
        unsigned long           mwdma_mask;
        unsigned long           udma_mask;
-       struct ata_port_operations      *port_ops;
+       const struct ata_port_operations *port_ops;
 };
 
 struct ata_timing {
@@ -413,7 +413,7 @@ extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_i
                             unsigned int n_ports);
 extern void ata_pci_remove_one (struct pci_dev *pdev);
 #endif /* CONFIG_PCI */
-extern int ata_device_add(struct ata_probe_ent *ent);
+extern int ata_device_add(const struct ata_probe_ent *ent);
 extern void ata_host_set_remove(struct ata_host_set *host_set);
 extern int ata_scsi_detect(Scsi_Host_Template *sht);
 extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
@@ -426,16 +426,16 @@ extern int ata_ratelimit(void);
 /*
  * Default driver ops implementations
  */
-extern void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf);
+extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf);
 extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
-extern void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp);
-extern void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf);
+extern void ata_tf_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp);
+extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
 extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device);
 extern void ata_std_dev_select (struct ata_port *ap, unsigned int device);
 extern u8 ata_check_status(struct ata_port *ap);
 extern u8 ata_altstatus(struct ata_port *ap);
 extern u8 ata_chk_err(struct ata_port *ap);
-extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf);
+extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf);
 extern int ata_port_start (struct ata_port *ap);
 extern void ata_port_stop (struct ata_port *ap);
 extern void ata_host_stop (struct ata_host_set *host_set);
@@ -446,8 +446,8 @@ extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf,
                unsigned int buflen);
 extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
                 unsigned int n_elem);
-extern unsigned int ata_dev_classify(struct ata_taskfile *tf);
-extern void ata_dev_id_string(u16 *id, unsigned char *s,
+extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
+extern void ata_dev_id_string(const u16 *id, unsigned char *s,
                              unsigned int ofs, unsigned int len);
 extern void ata_dev_config(struct ata_port *ap, unsigned int i);
 extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
@@ -502,7 +502,7 @@ struct pci_bits {
 extern void ata_pci_host_stop (struct ata_host_set *host_set);
 extern struct ata_probe_ent *
 ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask);
-extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits);
+extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
 
 #endif /* CONFIG_PCI */
 
@@ -512,7 +512,7 @@ static inline unsigned int ata_tag_valid(unsigned int tag)
        return (tag < ATA_MAX_QUEUE) ? 1 : 0;
 }
 
-static inline unsigned int ata_dev_present(struct ata_device *dev)
+static inline unsigned int ata_dev_present(const struct ata_device *dev)
 {
        return ((dev->class == ATA_DEV_ATA) ||
                (dev->class == ATA_DEV_ATAPI));
@@ -711,7 +711,7 @@ static inline unsigned int sata_dev_present(struct ata_port *ap)
        return ((scr_read(ap, SCR_STATUS) & 0xf) == 0x3) ? 1 : 0;
 }
 
-static inline int ata_try_flush_cache(struct ata_device *dev)
+static inline int ata_try_flush_cache(const struct ata_device *dev)
 {
        return ata_id_wcache_enabled(dev->id) ||
               ata_id_has_flush(dev->id) ||