Skip to content

Commit 37d061e

Browse files
johnpgarrymartinkpetersen
authored andcommitted
scsi: scsi_debug: Constify sdebug_driver_template
It's better to have sdebug_driver_template as const, so update the probe path to set the shost members directly after allocation and make that change. Signed-off-by: John Garry <john.g.garry@oracle.com> Link: https://lore.kernel.org/r/20250107153325.1689432-1-john.g.garry@oracle.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 8bf10df commit 37d061e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/scsi/scsi_debug.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8707,7 +8707,7 @@ static int sdebug_init_cmd_priv(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
87078707
return 0;
87088708
}
87098709

8710-
static struct scsi_host_template sdebug_driver_template = {
8710+
static const struct scsi_host_template sdebug_driver_template = {
87118711
.show_info = scsi_debug_show_info,
87128712
.write_info = scsi_debug_write_info,
87138713
.proc_name = sdebug_proc_name,
@@ -8750,17 +8750,17 @@ static int sdebug_driver_probe(struct device *dev)
87508750

87518751
sdbg_host = dev_to_sdebug_host(dev);
87528752

8753-
sdebug_driver_template.can_queue = sdebug_max_queue;
8754-
sdebug_driver_template.cmd_per_lun = sdebug_max_queue;
8755-
if (!sdebug_clustering)
8756-
sdebug_driver_template.dma_boundary = PAGE_SIZE - 1;
8757-
87588753
hpnt = scsi_host_alloc(&sdebug_driver_template, 0);
87598754
if (NULL == hpnt) {
87608755
pr_err("scsi_host_alloc failed\n");
87618756
error = -ENODEV;
87628757
return error;
87638758
}
8759+
hpnt->can_queue = sdebug_max_queue;
8760+
hpnt->cmd_per_lun = sdebug_max_queue;
8761+
if (!sdebug_clustering)
8762+
hpnt->dma_boundary = PAGE_SIZE - 1;
8763+
87648764
if (submit_queues > nr_cpu_ids) {
87658765
pr_warn("%s: trim submit_queues (was %d) to nr_cpu_ids=%u\n",
87668766
my_name, submit_queues, nr_cpu_ids);

0 commit comments

Comments
 (0)