diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-22 14:27:05 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-22 14:27:05 -0400 |
commit | 057ace5e79da9ebf2aa82833cfea825533ac06fb (patch) | |
tree | f27ed6cbd9a185041862471ef421e6415e099344 /include/linux | |
parent | cf482935c6abe5245e481213c6e6df808c976f56 (diff) |
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.
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/ata.h | 6 | ||||
-rw-r--r-- | include/linux/libata.h | 32 |
2 files changed, 19 insertions, 19 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h index 33276d1d05d2..d2873b732bb1 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -261,7 +261,7 @@ struct ata_taskfile { | |||
261 | ((u64) (id)[(n) + 1] << 16) | \ | 261 | ((u64) (id)[(n) + 1] << 16) | \ |
262 | ((u64) (id)[(n) + 0]) ) | 262 | ((u64) (id)[(n) + 0]) ) |
263 | 263 | ||
264 | static inline int ata_id_current_chs_valid(u16 *id) | 264 | static inline int ata_id_current_chs_valid(const u16 *id) |
265 | { | 265 | { |
266 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | 266 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command |
267 | has not been issued to the device then the values of | 267 | 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 | id[56]; /* sectors in current translation */ | 273 | id[56]; /* sectors in current translation */ |
274 | } | 274 | } |
275 | 275 | ||
276 | static inline int atapi_cdb_len(u16 *dev_id) | 276 | static inline int atapi_cdb_len(const u16 *dev_id) |
277 | { | 277 | { |
278 | u16 tmp = dev_id[0] & 0x3; | 278 | u16 tmp = dev_id[0] & 0x3; |
279 | switch (tmp) { | 279 | switch (tmp) { |
@@ -283,7 +283,7 @@ static inline int atapi_cdb_len(u16 *dev_id) | |||
283 | } | 283 | } |
284 | } | 284 | } |
285 | 285 | ||
286 | static inline int is_atapi_taskfile(struct ata_taskfile *tf) | 286 | static inline int is_atapi_taskfile(const struct ata_taskfile *tf) |
287 | { | 287 | { |
288 | return (tf->protocol == ATA_PROT_ATAPI) || | 288 | return (tf->protocol == ATA_PROT_ATAPI) || |
289 | (tf->protocol == ATA_PROT_ATAPI_NODATA) || | 289 | (tf->protocol == ATA_PROT_ATAPI_NODATA) || |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 634b5aa0a615..00a8a5738858 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -202,7 +202,7 @@ struct ata_ioports { | |||
202 | struct ata_probe_ent { | 202 | struct ata_probe_ent { |
203 | struct list_head node; | 203 | struct list_head node; |
204 | struct device *dev; | 204 | struct device *dev; |
205 | struct ata_port_operations *port_ops; | 205 | const struct ata_port_operations *port_ops; |
206 | Scsi_Host_Template *sht; | 206 | Scsi_Host_Template *sht; |
207 | struct ata_ioports port[ATA_MAX_PORTS]; | 207 | struct ata_ioports port[ATA_MAX_PORTS]; |
208 | unsigned int n_ports; | 208 | unsigned int n_ports; |
@@ -225,7 +225,7 @@ struct ata_host_set { | |||
225 | void __iomem *mmio_base; | 225 | void __iomem *mmio_base; |
226 | unsigned int n_ports; | 226 | unsigned int n_ports; |
227 | void *private_data; | 227 | void *private_data; |
228 | struct ata_port_operations *ops; | 228 | const struct ata_port_operations *ops; |
229 | struct ata_port * ports[0]; | 229 | struct ata_port * ports[0]; |
230 | }; | 230 | }; |
231 | 231 | ||
@@ -294,7 +294,7 @@ struct ata_device { | |||
294 | 294 | ||
295 | struct ata_port { | 295 | struct ata_port { |
296 | struct Scsi_Host *host; /* our co-allocated scsi host */ | 296 | struct Scsi_Host *host; /* our co-allocated scsi host */ |
297 | struct ata_port_operations *ops; | 297 | const struct ata_port_operations *ops; |
298 | unsigned long flags; /* ATA_FLAG_xxx */ | 298 | unsigned long flags; /* ATA_FLAG_xxx */ |
299 | unsigned int id; /* unique id req'd by scsi midlyr */ | 299 | unsigned int id; /* unique id req'd by scsi midlyr */ |
300 | unsigned int port_no; /* unique port #; from zero */ | 300 | unsigned int port_no; /* unique port #; from zero */ |
@@ -341,10 +341,10 @@ struct ata_port_operations { | |||
341 | void (*set_piomode) (struct ata_port *, struct ata_device *); | 341 | void (*set_piomode) (struct ata_port *, struct ata_device *); |
342 | void (*set_dmamode) (struct ata_port *, struct ata_device *); | 342 | void (*set_dmamode) (struct ata_port *, struct ata_device *); |
343 | 343 | ||
344 | void (*tf_load) (struct ata_port *ap, struct ata_taskfile *tf); | 344 | void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf); |
345 | void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); | 345 | void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); |
346 | 346 | ||
347 | void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf); | 347 | void (*exec_command)(struct ata_port *ap, const struct ata_taskfile *tf); |
348 | u8 (*check_status)(struct ata_port *ap); | 348 | u8 (*check_status)(struct ata_port *ap); |
349 | u8 (*check_altstatus)(struct ata_port *ap); | 349 | u8 (*check_altstatus)(struct ata_port *ap); |
350 | u8 (*check_err)(struct ata_port *ap); | 350 | u8 (*check_err)(struct ata_port *ap); |
@@ -385,7 +385,7 @@ struct ata_port_info { | |||
385 | unsigned long pio_mask; | 385 | unsigned long pio_mask; |
386 | unsigned long mwdma_mask; | 386 | unsigned long mwdma_mask; |
387 | unsigned long udma_mask; | 387 | unsigned long udma_mask; |
388 | struct ata_port_operations *port_ops; | 388 | const struct ata_port_operations *port_ops; |
389 | }; | 389 | }; |
390 | 390 | ||
391 | struct ata_timing { | 391 | struct ata_timing { |
@@ -413,7 +413,7 @@ extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_i | |||
413 | unsigned int n_ports); | 413 | unsigned int n_ports); |
414 | extern void ata_pci_remove_one (struct pci_dev *pdev); | 414 | extern void ata_pci_remove_one (struct pci_dev *pdev); |
415 | #endif /* CONFIG_PCI */ | 415 | #endif /* CONFIG_PCI */ |
416 | extern int ata_device_add(struct ata_probe_ent *ent); | 416 | extern int ata_device_add(const struct ata_probe_ent *ent); |
417 | extern void ata_host_set_remove(struct ata_host_set *host_set); | 417 | extern void ata_host_set_remove(struct ata_host_set *host_set); |
418 | extern int ata_scsi_detect(Scsi_Host_Template *sht); | 418 | extern int ata_scsi_detect(Scsi_Host_Template *sht); |
419 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); | 419 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); |
@@ -426,16 +426,16 @@ extern int ata_ratelimit(void); | |||
426 | /* | 426 | /* |
427 | * Default driver ops implementations | 427 | * Default driver ops implementations |
428 | */ | 428 | */ |
429 | extern void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf); | 429 | extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); |
430 | extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | 430 | extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); |
431 | extern void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp); | 431 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp); |
432 | extern void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf); | 432 | extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); |
433 | extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device); | 433 | extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device); |
434 | extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); | 434 | extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); |
435 | extern u8 ata_check_status(struct ata_port *ap); | 435 | extern u8 ata_check_status(struct ata_port *ap); |
436 | extern u8 ata_altstatus(struct ata_port *ap); | 436 | extern u8 ata_altstatus(struct ata_port *ap); |
437 | extern u8 ata_chk_err(struct ata_port *ap); | 437 | extern u8 ata_chk_err(struct ata_port *ap); |
438 | extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf); | 438 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); |
439 | extern int ata_port_start (struct ata_port *ap); | 439 | extern int ata_port_start (struct ata_port *ap); |
440 | extern void ata_port_stop (struct ata_port *ap); | 440 | extern void ata_port_stop (struct ata_port *ap); |
441 | extern void ata_host_stop (struct ata_host_set *host_set); | 441 | 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 | unsigned int buflen); | 446 | unsigned int buflen); |
447 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, | 447 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, |
448 | unsigned int n_elem); | 448 | unsigned int n_elem); |
449 | extern unsigned int ata_dev_classify(struct ata_taskfile *tf); | 449 | extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); |
450 | extern void ata_dev_id_string(u16 *id, unsigned char *s, | 450 | extern void ata_dev_id_string(const u16 *id, unsigned char *s, |
451 | unsigned int ofs, unsigned int len); | 451 | unsigned int ofs, unsigned int len); |
452 | extern void ata_dev_config(struct ata_port *ap, unsigned int i); | 452 | extern void ata_dev_config(struct ata_port *ap, unsigned int i); |
453 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); | 453 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); |
@@ -502,7 +502,7 @@ struct pci_bits { | |||
502 | extern void ata_pci_host_stop (struct ata_host_set *host_set); | 502 | extern void ata_pci_host_stop (struct ata_host_set *host_set); |
503 | extern struct ata_probe_ent * | 503 | extern struct ata_probe_ent * |
504 | ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); | 504 | ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); |
505 | extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits); | 505 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); |
506 | 506 | ||
507 | #endif /* CONFIG_PCI */ | 507 | #endif /* CONFIG_PCI */ |
508 | 508 | ||
@@ -512,7 +512,7 @@ static inline unsigned int ata_tag_valid(unsigned int tag) | |||
512 | return (tag < ATA_MAX_QUEUE) ? 1 : 0; | 512 | return (tag < ATA_MAX_QUEUE) ? 1 : 0; |
513 | } | 513 | } |
514 | 514 | ||
515 | static inline unsigned int ata_dev_present(struct ata_device *dev) | 515 | static inline unsigned int ata_dev_present(const struct ata_device *dev) |
516 | { | 516 | { |
517 | return ((dev->class == ATA_DEV_ATA) || | 517 | return ((dev->class == ATA_DEV_ATA) || |
518 | (dev->class == ATA_DEV_ATAPI)); | 518 | (dev->class == ATA_DEV_ATAPI)); |
@@ -711,7 +711,7 @@ static inline unsigned int sata_dev_present(struct ata_port *ap) | |||
711 | return ((scr_read(ap, SCR_STATUS) & 0xf) == 0x3) ? 1 : 0; | 711 | return ((scr_read(ap, SCR_STATUS) & 0xf) == 0x3) ? 1 : 0; |
712 | } | 712 | } |
713 | 713 | ||
714 | static inline int ata_try_flush_cache(struct ata_device *dev) | 714 | static inline int ata_try_flush_cache(const struct ata_device *dev) |
715 | { | 715 | { |
716 | return ata_id_wcache_enabled(dev->id) || | 716 | return ata_id_wcache_enabled(dev->id) || |
717 | ata_id_has_flush(dev->id) || | 717 | ata_id_has_flush(dev->id) || |