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

Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
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-4-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Documentation/scsi/scsi_mid_low_api.rst
drivers/scsi/hosts.c
include/linux/raid_class.h
include/scsi/libfc.h
include/scsi/scsi_host.h

index a8c5bd15a4400bb692745f3c348fd57e9e32bbce..6fa3a62795016494280c4a49adac72cc4d4b6af4 100644 (file)
@@ -436,7 +436,7 @@ Details::
     *
     *      Defined in: drivers/scsi/hosts.c .
     **/
-    struct Scsi_Host * scsi_host_alloc(struct scsi_host_template * sht,
+    struct Scsi_Host * scsi_host_alloc(const struct scsi_host_template * sht,
                                    int privsize)
 
 
index f7f62e56afcae6db20711357ed93242562ddcfed..0ac3289f6b0964ca73510aa4c4abdd1104c0a7a1 100644 (file)
@@ -219,7 +219,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",
@@ -392,7 +392,7 @@ static struct device_type scsi_host_type = {
  * Return value:
  *     Pointer to a new Scsi_Host
  **/
-struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
+struct Scsi_Host *scsi_host_alloc(const struct scsi_host_template *sht, int privsize)
 {
        struct Scsi_Host *shost;
        int index;
index 5cdfcb873a8f0e8b57c265826a639d7264b60804..6a9b177d5c41499261815a2300b4620e7b01c27b 100644 (file)
@@ -11,7 +11,7 @@ struct raid_template {
 };
 
 struct raid_function_template {
-       void *cookie;
+       const void *cookie;
        int (*is_raid)(struct device *);
        void (*get_resync)(struct device *);
        void (*get_state)(struct device *);
index 6e29e1719db1a71fb37340392894d25b318f1b34..eca6fd42d7f73afcf74a83a112f9336a8b7c1683 100644 (file)
@@ -866,7 +866,7 @@ static inline void *lport_priv(const struct fc_lport *lport)
  * Returns: libfc lport
  */
 static inline struct fc_lport *
-libfc_host_alloc(struct scsi_host_template *sht, int priv_size)
+libfc_host_alloc(const struct scsi_host_template *sht, int priv_size)
 {
        struct fc_lport *lport;
        struct Scsi_Host *shost;
index 587cc767bb677f4cae8ce46f28d805ea2c573a6e..0f29799efa02197412dddbce5ae81d93d1da8bce 100644 (file)
@@ -554,7 +554,7 @@ struct Scsi_Host {
        struct completion     * eh_action; /* Wait for specific actions on the
                                              host. */
        wait_queue_head_t       host_wait;
-       struct scsi_host_template *hostt;
+       const struct scsi_host_template *hostt;
        struct scsi_transport_template *transportt;
 
        struct kref             tagset_refcnt;
@@ -747,7 +747,7 @@ static inline int scsi_host_in_recovery(struct Scsi_Host *shost)
 extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *);
 extern void scsi_flush_work(struct Scsi_Host *);
 
-extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);
+extern struct Scsi_Host *scsi_host_alloc(const struct scsi_host_template *, int);
 extern int __must_check scsi_add_host_with_dma(struct Scsi_Host *,
                                               struct device *,
                                               struct device *);