scsi: iscsi: Declare SCSI host template const
authorBart Van Assche <bvanassche@acm.org>
Wed, 22 Mar 2023 19:54:44 +0000 (12:54 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 24 Mar 2023 23:19:57 +0000 (19:19 -0400)
Make it explicit that the SCSI host template is not modified.

Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-50-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/infiniband/ulp/iser/iscsi_iser.c
drivers/scsi/be2iscsi/be_main.c
drivers/scsi/bnx2i/bnx2i_iscsi.c
drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
drivers/scsi/cxgbi/libcxgbi.c
drivers/scsi/cxgbi/libcxgbi.h
drivers/scsi/iscsi_tcp.c
drivers/scsi/libiscsi.c
drivers/scsi/qedi/qedi_gbl.h
drivers/scsi/qedi/qedi_iscsi.c
include/scsi/libiscsi.h

index 6b760376538396ddf88e5233c522bab504878b8e..bb9aaff92ca3b03f4e7443b583921dd0952a3b8e 100644 (file)
@@ -78,7 +78,7 @@ MODULE_DESCRIPTION("iSER (iSCSI Extensions for RDMA) Datamover");
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_AUTHOR("Alex Nezhinsky, Dan Bar Dov, Or Gerlitz");
 
-static struct scsi_host_template iscsi_iser_sht;
+static const struct scsi_host_template iscsi_iser_sht;
 static struct iscsi_transport iscsi_iser_transport;
 static struct scsi_transport_template *iscsi_iser_scsi_transport;
 static struct workqueue_struct *release_wq;
@@ -956,7 +956,7 @@ static umode_t iser_attr_is_visible(int param_type, int param)
        return 0;
 }
 
-static struct scsi_host_template iscsi_iser_sht = {
+static const struct scsi_host_template iscsi_iser_sht = {
        .module                 = THIS_MODULE,
        .name                   = "iSCSI Initiator over iSER",
        .queuecommand           = iscsi_queuecommand,
index 50a577ac3bb42fa06938fd3ae3845afa88866379..5d416507947bb353eb5b0480cabe53c7b7a27d34 100644 (file)
@@ -398,7 +398,7 @@ static const struct pci_device_id beiscsi_pci_id_table[] = {
 MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table);
 
 
-static struct scsi_host_template beiscsi_sht = {
+static const struct scsi_host_template beiscsi_sht = {
        .module = THIS_MODULE,
        .name = "Emulex 10Gbe open-iscsi Initiator Driver",
        .proc_name = DRV_NAME,
index a3c800e04a2e81bea64d6ba373d1a6b3281526da..9971f32a663c23d65eab7d4a995a275496d3e2ce 100644 (file)
@@ -22,7 +22,7 @@
 
 struct scsi_transport_template *bnx2i_scsi_xport_template;
 struct iscsi_transport bnx2i_iscsi_transport;
-static struct scsi_host_template bnx2i_host_template;
+static const struct scsi_host_template bnx2i_host_template;
 
 /*
  * Global endpoint resource info
@@ -2250,7 +2250,7 @@ static umode_t bnx2i_attr_is_visible(int param_type, int param)
  * 'Scsi_Host_Template' structure and 'iscsi_tranport' structure template
  * used while registering with the scsi host and iSCSI transport module.
  */
-static struct scsi_host_template bnx2i_host_template = {
+static const struct scsi_host_template bnx2i_host_template = {
        .module                 = THIS_MODULE,
        .name                   = "QLogic Offload iSCSI Initiator",
        .proc_name              = "bnx2i",
index ff9d4287937aa9a1b2c7807457bf6049017a1628..ec65302407070d2110121350ce722c8af95db8b3 100644 (file)
@@ -80,7 +80,7 @@ static struct cxgb3_client t3_client = {
        .event_handler = cxgb3i_dev_event_handler,
 };
 
-static struct scsi_host_template cxgb3i_host_template = {
+static const struct scsi_host_template cxgb3i_host_template = {
        .module         = THIS_MODULE,
        .name           = DRV_MODULE_NAME,
        .proc_name      = DRV_MODULE_NAME,
index af281e271f886041b397ea881e2ce7be00eff625..eb47c8c96d0e9239965c03b4a336582d49cf265b 100644 (file)
@@ -337,7 +337,7 @@ void cxgbi_hbas_remove(struct cxgbi_device *cdev)
 EXPORT_SYMBOL_GPL(cxgbi_hbas_remove);
 
 int cxgbi_hbas_add(struct cxgbi_device *cdev, u64 max_lun,
-               unsigned int max_conns, struct scsi_host_template *sht,
+               unsigned int max_conns, const struct scsi_host_template *sht,
                struct scsi_transport_template *stt)
 {
        struct cxgbi_hba *chba;
index d8fc7beafa205a390633d6e1c223f15cabfc59e8..d92cf1dccc2f91d7f1867c03333827e569c6b3c1 100644 (file)
@@ -591,7 +591,7 @@ struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *, int *);
 struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *,
                                                     int *);
 int cxgbi_hbas_add(struct cxgbi_device *, u64, unsigned int,
-                       struct scsi_host_template *,
+                       const struct scsi_host_template *,
                        struct scsi_transport_template *);
 void cxgbi_hbas_remove(struct cxgbi_device *);
 
index c76f82fb8b6361263b4be1f597d0a6048b4ec902..6df2f4041f12165514ba57b71b97a5bd1585f765 100644 (file)
@@ -47,7 +47,7 @@ MODULE_DESCRIPTION("iSCSI/TCP data-path");
 MODULE_LICENSE("GPL");
 
 static struct scsi_transport_template *iscsi_sw_tcp_scsi_transport;
-static struct scsi_host_template iscsi_sw_tcp_sht;
+static const struct scsi_host_template iscsi_sw_tcp_sht;
 static struct iscsi_transport iscsi_sw_tcp_transport;
 
 static unsigned int iscsi_max_lun = ~0;
@@ -1072,7 +1072,7 @@ static int iscsi_sw_tcp_slave_configure(struct scsi_device *sdev)
        return 0;
 }
 
-static struct scsi_host_template iscsi_sw_tcp_sht = {
+static const struct scsi_host_template iscsi_sw_tcp_sht = {
        .module                 = THIS_MODULE,
        .name                   = "iSCSI Initiator over TCP/IP",
        .queuecommand           = iscsi_queuecommand,
index 127f3d7f19dc69bde17335e10b2a191730a617a2..0fda8905eabd8278f578e54a8f502ab2996629ed 100644 (file)
@@ -2895,7 +2895,7 @@ EXPORT_SYMBOL_GPL(iscsi_host_add);
  * This should be called by partial offload and software iscsi drivers.
  * To access the driver specific memory use the iscsi_host_priv() macro.
  */
-struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,
+struct Scsi_Host *iscsi_host_alloc(const struct scsi_host_template *sht,
                                   int dd_data_size, bool xmit_can_sleep)
 {
        struct Scsi_Host *shost;
index 72942772b198f15245598dfb77176e40b239cfa4..0e316cc24b190e292a879be69e4cdbb4c2d403e9 100644 (file)
@@ -17,7 +17,7 @@ extern int qedi_do_not_recover;
 
 extern uint qedi_io_tracing;
 
-extern struct scsi_host_template qedi_host_template;
+extern const struct scsi_host_template qedi_host_template;
 extern struct iscsi_transport qedi_iscsi_transport;
 extern const struct qed_iscsi_ops *qedi_ops;
 extern const struct qedi_debugfs_ops qedi_debugfs_ops[];
index 31ec429104e2bfa427c3b16abfe37765dcdd5046..6ed8ef97642c819bae09aab05c190585ce76c3a3 100644 (file)
@@ -40,7 +40,7 @@ static int qedi_eh_host_reset(struct scsi_cmnd *cmd)
        return qedi_recover_all_conns(qedi);
 }
 
-struct scsi_host_template qedi_host_template = {
+const struct scsi_host_template qedi_host_template = {
        .module = THIS_MODULE,
        .name = "QLogic QEDI 25/40/100Gb iSCSI Initiator Driver",
        .proc_name = QEDI_MODULE_NAME,
index e39fb0736ade5b862c469bac899c7f916718a38c..7282555adfd57aceaca1761a802eba42dcdf38d5 100644 (file)
@@ -407,7 +407,7 @@ extern int iscsi_host_set_param(struct Scsi_Host *shost,
 extern int iscsi_host_get_param(struct Scsi_Host *shost,
                                enum iscsi_host_param param, char *buf);
 extern int iscsi_host_add(struct Scsi_Host *shost, struct device *pdev);
-extern struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,
+extern struct Scsi_Host *iscsi_host_alloc(const struct scsi_host_template *sht,
                                          int dd_data_size,
                                          bool xmit_can_sleep);
 extern void iscsi_host_remove(struct Scsi_Host *shost, bool is_shutdown);