linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
	Benjamin Block <bblock@linux.ibm.com>,
	John Garry <john.g.garry@oracle.com>,
	Christoph Hellwig <hch@lst.de>, Ming Lei <ming.lei@redhat.com>,
	Hannes Reinecke <hare@suse.de>,
	Mike Christie <michael.christie@oracle.com>,
	Jonathan Corbet <corbet@lwn.net>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	Jens Axboe <axboe@kernel.dk>
Subject: [PATCH v3 03/80] scsi: core: Declare SCSI host template pointer members const
Date: Wed, 22 Mar 2023 12:53:58 -0700	[thread overview]
Message-ID: <20230322195515.1267197-4-bvanassche@acm.org> (raw)
In-Reply-To: <20230322195515.1267197-1-bvanassche@acm.org>

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>
---
 Documentation/scsi/scsi_mid_low_api.rst | 2 +-
 drivers/scsi/hosts.c                    | 4 ++--
 include/linux/raid_class.h              | 2 +-
 include/scsi/libfc.h                    | 2 +-
 include/scsi/scsi_host.h                | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Documentation/scsi/scsi_mid_low_api.rst b/Documentation/scsi/scsi_mid_low_api.rst
index a8c5bd15a440..6fa3a6279501 100644
--- a/Documentation/scsi/scsi_mid_low_api.rst
+++ b/Documentation/scsi/scsi_mid_low_api.rst
@@ -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)
 
 
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index f7f62e56afca..0ac3289f6b09 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -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;
diff --git a/include/linux/raid_class.h b/include/linux/raid_class.h
index 5cdfcb873a8f..6a9b177d5c41 100644
--- a/include/linux/raid_class.h
+++ b/include/linux/raid_class.h
@@ -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 *);
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 6e29e1719db1..eca6fd42d7f7 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -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;
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 587cc767bb67..0f29799efa02 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -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 *);

  parent reply	other threads:[~2023-03-22 19:55 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 19:53 [PATCH v3 00/80] Constify most SCSI host templates Bart Van Assche
2023-03-22 19:53 ` [PATCH v3 01/80] scsi: qla2xxx: Refer directly to the qla2xxx_driver_template Bart Van Assche
2023-03-22 19:53 ` [PATCH v3 02/80] scsi: core: Declare most SCSI host template pointers const Bart Van Assche
2023-03-22 19:53 ` Bart Van Assche [this message]
2023-03-22 19:53 ` [PATCH v3 04/80] ata: Declare SCSI host templates const Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 05/80] firewire: sbp2: Declare the SCSI host template const Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 06/80] RDMA/srp: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 07/80] scsi: message: fusion: Declare SCSI host template members const Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 08/80] scsi: zfcp: Declare SCSI host template const Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 09/80] scsi: 3w-9xxx: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 10/80] scsi: 3w-sas: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 11/80] scsi: 3w-xxxx: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 12/80] scsi: BusLogic: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 13/80] scsi: a100u2w: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 14/80] scsi: a2091: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 15/80] scsi: a3000: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 16/80] scsi: aacraid: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 17/80] scsi: advansys: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 18/80] scsi: aha152x: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 19/80] scsi: aha1542: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 20/80] scsi: aic94xx: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 21/80] scsi: arcmsr: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 22/80] scsi: acornscsi: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 23/80] scsi: arxescsi: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 24/80] scsi: aha1740: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 25/80] scsi: cumana: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 26/80] scsi: eesox: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 27/80] scsi: oak: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 28/80] scsi: powertec: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 29/80] scsi: atp870u: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 30/80] scsi: dc395x: " Bart Van Assche
2023-03-23  8:43   ` Oliver Neukum
2023-03-22 19:54 ` [PATCH v3 31/80] scsi: dmx3191d: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 32/80] scsi: elx: efct: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 33/80] scsi: esas2r: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 34/80] scsi: esp_scsi: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 35/80] scsi: fcoe: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 36/80] scsi: fnic: Declare " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 37/80] scsi: qedf: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 38/80] scsi: fdomain: Declare SCSI " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 39/80] scsi: NCR5380: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 40/80] scsi: gvp11: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 41/80] scsi: hisi_sas: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 42/80] scsi: hpsa: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 43/80] scsi: hptiop: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 44/80] scsi: ibmvfc: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 45/80] scsi: imm: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 46/80] scsi: initio: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 47/80] scsi: ipr: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 48/80] scsi: isci: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 49/80] scsi: iscsi: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 50/80] scsi: mac53c94: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 51/80] scsi: megaraid: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 52/80] scsi: mesh: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 53/80] scsi: mpi3mr: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 54/80] scsi: mpt3sas: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 55/80] scsi: mvme147: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 56/80] scsi: mvsas: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 57/80] scsi: mvumi: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 58/80] scsi: myrb: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 59/80] scsi: myrs: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 60/80] scsi: nsp32: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 61/80] scsi: pcmcia-sym53c500: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 62/80] scsi: pcmcia-pm8001: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 63/80] scsi: pmcraid: " Bart Van Assche
2023-03-22 19:54 ` [PATCH v3 64/80] scsi: ppa: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 65/80] scsi: ps3rom: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 66/80] scsi: qla1280: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 67/80] scsi: qla2xxx: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 68/80] scsi: qlogicpti: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 69/80] scsi: sgiwd93: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 70/80] scsi: smartpqi: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 71/80] scsi: snic: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 72/80] scsi: stex: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 73/80] scsi: sym53c8xx: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 74/80] scsi: virtio-scsi: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 75/80] scsi: wd719x: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 76/80] scsi: xen-scsifront: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 77/80] scsi: rts5208: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 78/80] scsi: target: tcm-loop: " Bart Van Assche
2023-03-22 19:55 ` [PATCH v3 79/80] scsi: ufs: " Bart Van Assche
2024-01-04  9:52   ` Peter Wang (王信友)
2024-01-08 17:48     ` Bart Van Assche
2024-01-09 13:04       ` Peter Wang (王信友)
2023-03-22 19:55 ` [PATCH v3 80/80] usb: uas: Declare two host templates and host template pointers const Bart Van Assche
2023-03-25  0:14 ` [PATCH v3 00/80] Constify most SCSI host templates Martin K. Petersen
2023-04-03  2:15 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230322195515.1267197-4-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=bblock@linux.ibm.com \
    --cc=corbet@lwn.net \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=john.g.garry@oracle.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.com \
    --cc=ming.lei@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).