Skip to contentSkip to conversation

libata: make ata_port_type const

PATCH Applied Bhumika Goyal 2 participants 2 messages Sep 30, 2017 – Oct 2, 2017 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libata: make ata_port_type const

Make this const as it is only stored in the const field of a device structure. Make the declaration in header const too.

Structure found using Coccinelle and changes done by hand.

---
 drivers/ata/libata-core.c | 2 +-
 drivers/ata/libata.h      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/ata/libata-core.c +1 -1
index 65f7574..29e3516 100644
@@ -5824,7 +5824,7 @@ void ata_host_resume(struct ata_host *host)
 }
 #endif
 
-struct device_type ata_port_type = {
+const struct device_type ata_port_type = {
 	.name = "ata_port",
 #ifdef CONFIG_PM
 	.pm = &ata_port_pm_ops,
drivers/ata/libata.h +1 -1
index 839d487..18bf1e9 100644
@@ -51,7 +51,7 @@ enum {
 extern int libata_fua;
 extern int libata_noacpi;
 extern int libata_allow_tpm;
-extern struct device_type ata_port_type;
+extern const struct device_type ata_port_type;
 extern struct ata_link *ata_dev_phys_link(struct ata_device *dev);
 extern void ata_force_cbl(struct ata_port *ap);
 extern u64 ata_tf_to_lba(const struct ata_taskfile *tf);
Signature · 1 line
1.9.1
Applied
#1 lore raw
Quoted 6 lines · Bhumika Goyal

Make this const as it is only stored in the const field of a device structure. Make the declaration in header const too.

Structure found using Coccinelle and changes done by hand.

Applied to libata/for-4.15.

Thanks.

Signature · 1 line
tejun