scsi: core: Declare most SCSI host template pointers const
authorBart Van Assche <bvanassche@acm.org>
Wed, 22 Mar 2023 19:53:57 +0000 (12:53 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 24 Mar 2023 23:19:19 +0000 (19:19 -0400)
Prepare for constifying most SCSI host template pointers by constifying the
SCSI host template pointer arguments and variables in the SCSI core.

Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-3-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_error.c
drivers/scsi/scsi_sysfs.c

index 2aa2c2aee6e7f99cc3275244d5f70d72dc02a09e..3ec8bfd4090f9eaa7bee047e9664597152a19cbf 100644 (file)
@@ -58,7 +58,7 @@
 #define HOST_RESET_SETTLE_TIME  (10)
 
 static int scsi_eh_try_stu(struct scsi_cmnd *scmd);
-static enum scsi_disposition scsi_try_to_abort_cmd(struct scsi_host_template *,
+static enum scsi_disposition scsi_try_to_abort_cmd(const struct scsi_host_template *,
                                                   struct scsi_cmnd *);
 
 void scsi_eh_wakeup(struct Scsi_Host *shost)
@@ -699,7 +699,7 @@ EXPORT_SYMBOL_GPL(scsi_check_sense);
 
 static void scsi_handle_queue_ramp_up(struct scsi_device *sdev)
 {
-       struct scsi_host_template *sht = sdev->host->hostt;
+       const struct scsi_host_template *sht = sdev->host->hostt;
        struct scsi_device *tmp_sdev;
 
        if (!sht->track_queue_depth ||
@@ -731,7 +731,7 @@ static void scsi_handle_queue_ramp_up(struct scsi_device *sdev)
 
 static void scsi_handle_queue_full(struct scsi_device *sdev)
 {
-       struct scsi_host_template *sht = sdev->host->hostt;
+       const struct scsi_host_template *sht = sdev->host->hostt;
        struct scsi_device *tmp_sdev;
 
        if (!sht->track_queue_depth)
@@ -840,7 +840,7 @@ static enum scsi_disposition scsi_try_host_reset(struct scsi_cmnd *scmd)
        unsigned long flags;
        enum scsi_disposition rtn;
        struct Scsi_Host *host = scmd->device->host;
-       struct scsi_host_template *hostt = host->hostt;
+       const struct scsi_host_template *hostt = host->hostt;
 
        SCSI_LOG_ERROR_RECOVERY(3,
                shost_printk(KERN_INFO, host, "Snd Host RST\n"));
@@ -870,7 +870,7 @@ static enum scsi_disposition scsi_try_bus_reset(struct scsi_cmnd *scmd)
        unsigned long flags;
        enum scsi_disposition rtn;
        struct Scsi_Host *host = scmd->device->host;
-       struct scsi_host_template *hostt = host->hostt;
+       const struct scsi_host_template *hostt = host->hostt;
 
        SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd,
                "%s: Snd Bus RST\n", __func__));
@@ -912,7 +912,7 @@ static enum scsi_disposition scsi_try_target_reset(struct scsi_cmnd *scmd)
        unsigned long flags;
        enum scsi_disposition rtn;
        struct Scsi_Host *host = scmd->device->host;
-       struct scsi_host_template *hostt = host->hostt;
+       const struct scsi_host_template *hostt = host->hostt;
 
        if (!hostt->eh_target_reset_handler)
                return FAILED;
@@ -941,7 +941,7 @@ static enum scsi_disposition scsi_try_target_reset(struct scsi_cmnd *scmd)
 static enum scsi_disposition scsi_try_bus_device_reset(struct scsi_cmnd *scmd)
 {
        enum scsi_disposition rtn;
-       struct scsi_host_template *hostt = scmd->device->host->hostt;
+       const struct scsi_host_template *hostt = scmd->device->host->hostt;
 
        if (!hostt->eh_device_reset_handler)
                return FAILED;
@@ -970,7 +970,7 @@ static enum scsi_disposition scsi_try_bus_device_reset(struct scsi_cmnd *scmd)
  *    link down on FibreChannel)
  */
 static enum scsi_disposition
-scsi_try_to_abort_cmd(struct scsi_host_template *hostt, struct scsi_cmnd *scmd)
+scsi_try_to_abort_cmd(const struct scsi_host_template *hostt, struct scsi_cmnd *scmd)
 {
        if (!hostt->eh_abort_handler)
                return FAILED;
index ee28f73af4d4ff24b5f27bc1a3e17c46be7f4369..603e8fcfcb8a0c0a80beeceedd5e3391abd25133 100644 (file)
@@ -296,7 +296,7 @@ store_host_reset(struct device *dev, struct device_attribute *attr,
                const char *buf, size_t count)
 {
        struct Scsi_Host *shost = class_to_shost(dev);
-       struct scsi_host_template *sht = shost->hostt;
+       const struct scsi_host_template *sht = shost->hostt;
        int ret = -EINVAL;
        int type;
 
@@ -1025,7 +1025,7 @@ sdev_store_queue_depth(struct device *dev, struct device_attribute *attr,
 {
        int depth, retval;
        struct scsi_device *sdev = to_scsi_device(dev);
-       struct scsi_host_template *sht = sdev->host->hostt;
+       const struct scsi_host_template *sht = sdev->host->hostt;
 
        if (!sht->change_queue_depth)
                return -EINVAL;
@@ -1606,7 +1606,7 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev)
 {
        unsigned long flags;
        struct Scsi_Host *shost = sdev->host;
-       struct scsi_host_template *hostt = shost->hostt;
+       const struct scsi_host_template *hostt = shost->hostt;
        struct scsi_target  *starget = sdev->sdev_target;
 
        device_initialize(&sdev->sdev_gendev);