Re: [PATCH 1/4] scsi: core: constify pointer to scsi_host_template

From: John Garry
Date: Fri Apr 08 2022 - 08:14:23 EST


On 08/04/2022 11:30, Krzysztof Kozlowski wrote:
Several pointers to 'struct scsi_host_template' do not modify it, so
made them const for safety.


Is this standard practice? What is so special here?

Thanks,
john


Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
---
drivers/scsi/hosts.c | 2 +-
drivers/scsi/scsi_error.c | 17 +++++++++--------
drivers/scsi/scsi_proc.c | 2 +-
drivers/scsi/scsi_sysfs.c | 6 +++---
4 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index f69b77cbf538..65616a01761a 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -209,7 +209,7 @@ EXPORT_SYMBOL(scsi_remove_host);
int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
struct device *dma_dev)
{
- struct scsi_host_template *sht = shost->hostt;
+ const struct scsi_host_template *sht = shost->hostt;
int error = -EINVAL;
shost_printk(KERN_INFO, shost, "%s\n",
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c