aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-22 14:27:05 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-22 14:27:05 -0400
commit057ace5e79da9ebf2aa82833cfea825533ac06fb (patch)
treef27ed6cbd9a185041862471ef421e6415e099344 /include/linux
parentcf482935c6abe5245e481213c6e6df808c976f56 (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.h6
-rw-r--r--include/linux/libata.h32
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
264static inline int ata_id_current_chs_valid(u16 *id) 264static 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
276static inline int atapi_cdb_len(u16 *dev_id) 276static 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
286static inline int is_atapi_taskfile(struct ata_taskfile *tf) 286static 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 {
202struct ata_probe_ent { 202struct 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
295struct ata_port { 295struct 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
391struct ata_timing { 391struct 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);
414extern void ata_pci_remove_one (struct pci_dev *pdev); 414extern void ata_pci_remove_one (struct pci_dev *pdev);
415#endif /* CONFIG_PCI */ 415#endif /* CONFIG_PCI */
416extern int ata_device_add(struct ata_probe_ent *ent); 416extern int ata_device_add(const struct ata_probe_ent *ent);
417extern void ata_host_set_remove(struct ata_host_set *host_set); 417extern void ata_host_set_remove(struct ata_host_set *host_set);
418extern int ata_scsi_detect(Scsi_Host_Template *sht); 418extern int ata_scsi_detect(Scsi_Host_Template *sht);
419extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 419extern 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 */
429extern void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf); 429extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf);
430extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); 430extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
431extern void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp); 431extern void ata_tf_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp);
432extern void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf); 432extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
433extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device); 433extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device);
434extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); 434extern void ata_std_dev_select (struct ata_port *ap, unsigned int device);
435extern u8 ata_check_status(struct ata_port *ap); 435extern u8 ata_check_status(struct ata_port *ap);
436extern u8 ata_altstatus(struct ata_port *ap); 436extern u8 ata_altstatus(struct ata_port *ap);
437extern u8 ata_chk_err(struct ata_port *ap); 437extern u8 ata_chk_err(struct ata_port *ap);
438extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf); 438extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf);
439extern int ata_port_start (struct ata_port *ap); 439extern int ata_port_start (struct ata_port *ap);
440extern void ata_port_stop (struct ata_port *ap); 440extern void ata_port_stop (struct ata_port *ap);
441extern void ata_host_stop (struct ata_host_set *host_set); 441extern 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);
447extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 447extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
448 unsigned int n_elem); 448 unsigned int n_elem);
449extern unsigned int ata_dev_classify(struct ata_taskfile *tf); 449extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
450extern void ata_dev_id_string(u16 *id, unsigned char *s, 450extern 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);
452extern void ata_dev_config(struct ata_port *ap, unsigned int i); 452extern void ata_dev_config(struct ata_port *ap, unsigned int i);
453extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 453extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
@@ -502,7 +502,7 @@ struct pci_bits {
502extern void ata_pci_host_stop (struct ata_host_set *host_set); 502extern void ata_pci_host_stop (struct ata_host_set *host_set);
503extern struct ata_probe_ent * 503extern struct ata_probe_ent *
504ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); 504ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask);
505extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits); 505extern 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
515static inline unsigned int ata_dev_present(struct ata_device *dev) 515static 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
714static inline int ata_try_flush_cache(struct ata_device *dev) 714static 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) ||