Commit 057ace5e authored by Jeff Garzik's avatar Jeff Garzik

libata: const-ification bombing run

Enforce access rules where appropriate.

If the compiler is smart enough, this may buy us an optimization or two
as a side effect.
parent cf482935
...@@ -216,7 +216,7 @@ static Scsi_Host_Template ahci_sht = { ...@@ -216,7 +216,7 @@ static Scsi_Host_Template ahci_sht = {
.ordered_flush = 1, .ordered_flush = 1,
}; };
static struct ata_port_operations ahci_ops = { static const struct ata_port_operations ahci_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.check_status = ahci_check_status, .check_status = ahci_check_status,
......
...@@ -147,7 +147,7 @@ static Scsi_Host_Template piix_sht = { ...@@ -147,7 +147,7 @@ static Scsi_Host_Template piix_sht = {
.ordered_flush = 1, .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, .port_disable = ata_port_disable,
.set_piomode = piix_set_piomode, .set_piomode = piix_set_piomode,
.set_dmamode = piix_set_dmamode, .set_dmamode = piix_set_dmamode,
...@@ -177,7 +177,7 @@ static struct ata_port_operations piix_pata_ops = { ...@@ -177,7 +177,7 @@ static struct ata_port_operations piix_pata_ops = {
.host_stop = ata_host_stop, .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, .port_disable = ata_port_disable,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
......
This diff is collapsed.
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
#include "libata.h" #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 * 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, static void ata_scsi_invalid_field(struct scsi_cmnd *cmd,
...@@ -418,7 +418,7 @@ int ata_scsi_error(struct Scsi_Host *host) ...@@ -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, static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc,
u8 *scsicmd) const u8 *scsicmd)
{ {
struct ata_taskfile *tf = &qc->tf; struct ata_taskfile *tf = &qc->tf;
...@@ -485,7 +485,7 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc, ...@@ -485,7 +485,7 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc,
* Zero on success, non-zero on error. * 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; struct ata_taskfile *tf = &qc->tf;
...@@ -512,7 +512,7 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) ...@@ -512,7 +512,7 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
* @plen: the transfer length * @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; u64 lba = 0;
u32 len = 0; u32 len = 0;
...@@ -539,7 +539,7 @@ static void scsi_6_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) ...@@ -539,7 +539,7 @@ static void scsi_6_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
* @plen: the transfer length * @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; u64 lba = 0;
u32 len = 0; u32 len = 0;
...@@ -569,7 +569,7 @@ static void scsi_10_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) ...@@ -569,7 +569,7 @@ static void scsi_10_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
* @plen: the transfer length * @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; u64 lba = 0;
u32 len = 0; u32 len = 0;
...@@ -608,7 +608,7 @@ static void scsi_16_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) ...@@ -608,7 +608,7 @@ static void scsi_16_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
* Zero on success, non-zero on error. * 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_taskfile *tf = &qc->tf;
struct ata_device *dev = qc->dev; struct ata_device *dev = qc->dev;
...@@ -734,7 +734,7 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) ...@@ -734,7 +734,7 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
* Zero on success, non-zero on error. * 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_taskfile *tf = &qc->tf;
struct ata_device *dev = qc->dev; struct ata_device *dev = qc->dev;
...@@ -1688,7 +1688,7 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) ...@@ -1688,7 +1688,7 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
* Zero on success, non-zero on failure. * 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 scsi_cmnd *cmd = qc->scsicmd;
struct ata_device *dev = qc->dev; struct ata_device *dev = qc->dev;
...@@ -1757,7 +1757,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) ...@@ -1757,7 +1757,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
*/ */
static struct ata_device * 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; struct ata_device *dev;
...@@ -1914,7 +1914,7 @@ void ata_scsi_simulate(u16 *id, ...@@ -1914,7 +1914,7 @@ void ata_scsi_simulate(u16 *id,
void (*done)(struct scsi_cmnd *)) void (*done)(struct scsi_cmnd *))
{ {
struct ata_scsi_args args; struct ata_scsi_args args;
u8 *scsicmd = cmd->cmnd; const u8 *scsicmd = cmd->cmnd;
args.id = id; args.id = id;
args.cmd = cmd; args.cmd = cmd;
......
...@@ -48,7 +48,7 @@ extern int ata_qc_issue(struct ata_queued_cmd *qc); ...@@ -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 int ata_check_atapi_dma(struct ata_queued_cmd *qc);
extern void ata_dev_select(struct ata_port *ap, unsigned int device, extern void ata_dev_select(struct ata_port *ap, unsigned int device,
unsigned int wait, unsigned int can_sleep); 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); extern void swap_buf_le16(u16 *buf, unsigned int buf_words);
......
...@@ -158,7 +158,7 @@ static Scsi_Host_Template adma_ata_sht = { ...@@ -158,7 +158,7 @@ static Scsi_Host_Template adma_ata_sht = {
.bios_param = ata_std_bios_param, .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, .port_disable = ata_port_disable,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
......
...@@ -290,7 +290,7 @@ static Scsi_Host_Template mv_sht = { ...@@ -290,7 +290,7 @@ static Scsi_Host_Template mv_sht = {
.ordered_flush = 1, .ordered_flush = 1,
}; };
static struct ata_port_operations mv_ops = { static const struct ata_port_operations mv_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
......
...@@ -238,7 +238,7 @@ static Scsi_Host_Template nv_sht = { ...@@ -238,7 +238,7 @@ static Scsi_Host_Template nv_sht = {
.ordered_flush = 1, .ordered_flush = 1,
}; };
static struct ata_port_operations nv_ops = { static const struct ata_port_operations nv_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
......
...@@ -87,8 +87,8 @@ static void pdc_port_stop(struct ata_port *ap); ...@@ -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_pata_phy_reset(struct ata_port *ap);
static void pdc_sata_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_qc_prep(struct ata_queued_cmd *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);
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);
static void pdc_irq_clear(struct ata_port *ap); static void pdc_irq_clear(struct ata_port *ap);
static int pdc_qc_issue_prot(struct ata_queued_cmd *qc); static int pdc_qc_issue_prot(struct ata_queued_cmd *qc);
...@@ -113,7 +113,7 @@ static Scsi_Host_Template pdc_ata_sht = { ...@@ -113,7 +113,7 @@ static Scsi_Host_Template pdc_ata_sht = {
.ordered_flush = 1, .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, .port_disable = ata_port_disable,
.tf_load = pdc_tf_load_mmio, .tf_load = pdc_tf_load_mmio,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
...@@ -136,7 +136,7 @@ static struct ata_port_operations pdc_sata_ops = { ...@@ -136,7 +136,7 @@ static struct ata_port_operations pdc_sata_ops = {
.host_stop = ata_pci_host_stop, .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, .port_disable = ata_port_disable,
.tf_load = pdc_tf_load_mmio, .tf_load = pdc_tf_load_mmio,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
...@@ -546,7 +546,7 @@ static int pdc_qc_issue_prot(struct ata_queued_cmd *qc) ...@@ -546,7 +546,7 @@ static int pdc_qc_issue_prot(struct ata_queued_cmd *qc)
return ata_qc_issue_prot(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 || WARN_ON (tf->protocol == ATA_PROT_DMA ||
tf->protocol == ATA_PROT_NODATA); tf->protocol == ATA_PROT_NODATA);
...@@ -554,7 +554,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) ...@@ -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 || WARN_ON (tf->protocol == ATA_PROT_DMA ||
tf->protocol == ATA_PROT_NODATA); tf->protocol == ATA_PROT_NODATA);
......
...@@ -147,7 +147,7 @@ static Scsi_Host_Template qs_ata_sht = { ...@@ -147,7 +147,7 @@ static Scsi_Host_Template qs_ata_sht = {
.bios_param = ata_std_bios_param, .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, .port_disable = ata_port_disable,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
......
...@@ -150,7 +150,7 @@ static Scsi_Host_Template sil_sht = { ...@@ -150,7 +150,7 @@ static Scsi_Host_Template sil_sht = {
.ordered_flush = 1, .ordered_flush = 1,
}; };
static struct ata_port_operations sil_ops = { static const struct ata_port_operations sil_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.dev_config = sil_dev_config, .dev_config = sil_dev_config,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
......
...@@ -275,7 +275,7 @@ static Scsi_Host_Template sil24_sht = { ...@@ -275,7 +275,7 @@ static Scsi_Host_Template sil24_sht = {
.ordered_flush = 1, /* NCQ not supported yet */ .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, .port_disable = ata_port_disable,
.check_status = sil24_check_status, .check_status = sil24_check_status,
......
...@@ -102,7 +102,7 @@ static Scsi_Host_Template sis_sht = { ...@@ -102,7 +102,7 @@ static Scsi_Host_Template sis_sht = {
.ordered_flush = 1, .ordered_flush = 1,
}; };
static struct ata_port_operations sis_ops = { static const struct ata_port_operations sis_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
......
...@@ -102,7 +102,7 @@ static void k2_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, ...@@ -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; struct ata_ioports *ioaddr = &ap->ioaddr;
unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
...@@ -297,7 +297,7 @@ static Scsi_Host_Template k2_sata_sht = { ...@@ -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, .port_disable = ata_port_disable,
.tf_load = k2_sata_tf_load, .tf_load = k2_sata_tf_load,
.tf_read = k2_sata_tf_read, .tf_read = k2_sata_tf_read,
......
...@@ -157,8 +157,8 @@ static void pdc_20621_phy_reset (struct ata_port *ap); ...@@ -157,8 +157,8 @@ static void pdc_20621_phy_reset (struct ata_port *ap);
static int pdc_port_start(struct ata_port *ap); static int pdc_port_start(struct ata_port *ap);
static void pdc_port_stop(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 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_tf_load_mmio(struct ata_port *ap, const 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);
static void pdc20621_host_stop(struct ata_host_set *host_set); static void pdc20621_host_stop(struct ata_host_set *host_set);
static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe); static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe);
static int pdc20621_detect_dimm(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 = { ...@@ -196,7 +196,7 @@ static Scsi_Host_Template pdc_sata_sht = {
.ordered_flush = 1, .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, .port_disable = ata_port_disable,
.tf_load = pdc_tf_load_mmio, .tf_load = pdc_tf_load_mmio,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
...@@ -899,7 +899,7 @@ static void pdc_eng_timeout(struct ata_port *ap) ...@@ -899,7 +899,7 @@ static void pdc_eng_timeout(struct ata_port *ap)
DPRINTK("EXIT\n"); 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 || WARN_ON (tf->protocol == ATA_PROT_DMA ||
tf->protocol == ATA_PROT_NODATA); tf->protocol == ATA_PROT_NODATA);
...@@ -907,7 +907,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) ...@@ -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 || WARN_ON (tf->protocol == ATA_PROT_DMA ||
tf->protocol == ATA_PROT_NODATA); tf->protocol == ATA_PROT_NODATA);
......
...@@ -90,7 +90,7 @@ static Scsi_Host_Template uli_sht = { ...@@ -90,7 +90,7 @@ static Scsi_Host_Template uli_sht = {
.ordered_flush = 1, .ordered_flush = 1,
}; };
static struct ata_port_operations uli_ops = { static const struct ata_port_operations uli_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
......
...@@ -109,7 +109,7 @@ static Scsi_Host_Template svia_sht = { ...@@ -109,7 +109,7 @@ static Scsi_Host_Template svia_sht = {
.ordered_flush = 1, .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, .port_disable = ata_port_disable,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
......
...@@ -115,7 +115,7 @@ static void vsc_intr_mask_update(struct ata_port *ap, u8 ctl) ...@@ -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; struct ata_ioports *ioaddr = &ap->ioaddr;
unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
...@@ -231,7 +231,7 @@ static Scsi_Host_Template vsc_sata_sht = { ...@@ -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, .port_disable = ata_port_disable,
.tf_load = vsc_sata_tf_load, .tf_load = vsc_sata_tf_load,
.tf_read = vsc_sata_tf_read, .tf_read = vsc_sata_tf_read,
......
...@@ -261,7 +261,7 @@ struct ata_taskfile { ...@@ -261,7 +261,7 @@ struct ata_taskfile {
((u64) (id)[(n) + 1] << 16) | \ ((u64) (id)[(n) + 1] << 16) | \
((u64) (id)[(n) + 0]) ) ((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 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
has not been issued to the device then the values of 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) ...@@ -273,7 +273,7 @@ static inline int ata_id_current_chs_valid(u16 *id)
id[56]; /* sectors in current translation */ 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; u16 tmp = dev_id[0] & 0x3;
switch (tmp) { switch (tmp) {
...@@ -283,7 +283,7 @@ static inline int atapi_cdb_len(u16 *dev_id) ...@@ -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) || return (tf->protocol == ATA_PROT_ATAPI) ||
(tf->protocol == ATA_PROT_ATAPI_NODATA) || (tf->protocol == ATA_PROT_ATAPI_NODATA) ||
......
...@@ -202,7 +202,7 @@ struct ata_ioports { ...@@ -202,7 +202,7 @@ struct ata_ioports {
struct ata_probe_ent { struct ata_probe_ent {
struct list_head node; struct list_head node;
struct device *dev; struct device *dev;
struct ata_port_operations *port_ops; const struct ata_port_operations *port_ops;
Scsi_Host_Template *sht; Scsi_Host_Template *sht;
struct ata_ioports port[ATA_MAX_PORTS]; struct ata_ioports port[ATA_MAX_PORTS];
unsigned int n_ports; unsigned int n_ports;
...@@ -225,7 +225,7 @@ struct ata_host_set { ...@@ -225,7 +225,7 @@ struct ata_host_set {
void __iomem *mmio_base; void __iomem *mmio_base;
unsigned int n_ports; unsigned int n_ports;
void *private_data; void *private_data;
struct ata_port_operations *ops; const struct ata_port_operations *ops;
struct ata_port * ports[0]; struct ata_port * ports[0];
}; };
...@@ -294,7 +294,7 @@ struct ata_device { ...@@ -294,7 +294,7 @@ struct ata_device {
struct ata_port { struct ata_port {
struct Scsi_Host *host; /* our co-allocated scsi host */ 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 long flags; /* ATA_FLAG_xxx */
unsigned int id; /* unique id req'd by scsi midlyr */ unsigned int id; /* unique id req'd by scsi midlyr */
unsigned int port_no; /* unique port #; from zero */ unsigned int port_no; /* unique port #; from zero */
...@@ -341,10 +341,10 @@ struct ata_port_operations { ...@@ -341,10 +341,10 @@ struct ata_port_operations {
void (*set_piomode) (struct ata_port *, struct ata_device *); void (*set_piomode) (struct ata_port *, struct ata_device *);
void (*set_dmamode) (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 (*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_status)(struct ata_port *ap);
u8 (*check_altstatus)(struct ata_port *ap); u8 (*check_altstatus)(struct ata_port *ap);
u8 (*check_err)(struct ata_port *ap); u8 (*check_err)(struct ata_port *ap);
...@@ -385,7 +385,7 @@ struct ata_port_info { ...@@ -385,7 +385,7 @@ struct ata_port_info {
unsigned long pio_mask; unsigned long pio_mask;
unsigned long mwdma_mask; unsigned long mwdma_mask;
unsigned long udma_mask; unsigned long udma_mask;
struct ata_port_operations *port_ops; const struct ata_port_operations *port_ops;
}; };
struct ata_timing { struct ata_timing {
...@@ -413,7 +413,7 @@ extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_i ...@@ -413,7 +413,7 @@ extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_i
unsigned int n_ports); unsigned int n_ports);
extern void ata_pci_remove_one (struct pci_dev *pdev); extern void ata_pci_remove_one (struct pci_dev *pdev);
#endif /* CONFIG_PCI */ #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 void ata_host_set_remove(struct ata_host_set *host_set);
extern int ata_scsi_detect(Scsi_Host_Template *sht); extern int ata_scsi_detect(Scsi_Host_Template *sht);
extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
...@@ -426,16 +426,16 @@ extern int ata_ratelimit(void); ...@@ -426,16 +426,16 @@ extern int ata_ratelimit(void);
/* /*
* Default driver ops implementations * 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_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_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp);
extern void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf); 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_noop_dev_select (struct ata_port *ap, unsigned int device);
extern void ata_std_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_check_status(struct ata_port *ap);
extern u8 ata_altstatus(struct ata_port *ap); extern u8 ata_altstatus(struct ata_port *ap);
extern u8 ata_chk_err(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 int ata_port_start (struct ata_port *ap);
extern void ata_port_stop (struct ata_port *ap); extern void ata_port_stop (struct ata_port *ap);
extern void ata_host_stop (struct ata_host_set *host_set); 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, ...@@ -446,8 +446,8 @@ extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf,
unsigned int buflen); unsigned int buflen);
extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
unsigned int n_elem); unsigned int n_elem);
extern unsigned int ata_dev_classify(struct ata_taskfile *tf); extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
extern void ata_dev_id_string(u16 *id, unsigned char *s, extern void ata_dev_id_string(const u16 *id, unsigned char *s,
unsigned int ofs, unsigned int len); unsigned int ofs, unsigned int len);
extern void ata_dev_config(struct ata_port *ap, unsigned int i); extern void ata_dev_config(struct ata_port *ap, unsigned int i);
extern void ata_bmdma_setup (struct ata_queued_cmd *qc); extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
...@@ -502,7 +502,7 @@ struct pci_bits { ...@@ -502,7 +502,7 @@ struct pci_bits {
extern void ata_pci_host_stop (struct ata_host_set *host_set); extern void ata_pci_host_stop (struct ata_host_set *host_set);
extern struct ata_probe_ent * extern struct ata_probe_ent *
ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); 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 */ #endif /* CONFIG_PCI */
...@@ -512,7 +512,7 @@ static inline unsigned int ata_tag_valid(unsigned int tag) ...@@ -512,7 +512,7 @@ static inline unsigned int ata_tag_valid(unsigned int tag)
return (tag < ATA_MAX_QUEUE) ? 1 : 0; 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) || return ((dev->class == ATA_DEV_ATA) ||
(dev->class == ATA_DEV_ATAPI)); (dev->class == ATA_DEV_ATAPI));
...@@ -711,7 +711,7 @@ static inline unsigned int sata_dev_present(struct ata_port *ap) ...@@ -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; 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) || return ata_id_wcache_enabled(dev->id) ||
ata_id_has_flush(dev->id) || ata_id_has_flush(dev->id) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment