diff options
author | John Garry <john.g.garry@oracle.com> | 2025-01-07 15:33:25 +0000 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2025-01-10 16:21:14 -0500 |
commit | 37d061e1ace17a376eda34b10dde28b144296534 (patch) | |
tree | c528f1afa515dc73fe9e0999229c97d85cb5b346 /drivers/scsi/scsi_debug.c | |
parent | 8bf10dfd7d0d8c0e6cdda176c461b3c5eba022ca (diff) |
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>
Diffstat (limited to 'drivers/scsi/scsi_debug.c')
-rw-r--r-- | drivers/scsi/scsi_debug.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 07aa83a9df9a..5ceaa4665e5d 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -8707,7 +8707,7 @@ static int sdebug_init_cmd_priv(struct Scsi_Host *shost, struct scsi_cmnd *cmd) return 0; } -static struct scsi_host_template sdebug_driver_template = { +static const struct scsi_host_template sdebug_driver_template = { .show_info = scsi_debug_show_info, .write_info = scsi_debug_write_info, .proc_name = sdebug_proc_name, @@ -8750,17 +8750,17 @@ static int sdebug_driver_probe(struct device *dev) sdbg_host = dev_to_sdebug_host(dev); - sdebug_driver_template.can_queue = sdebug_max_queue; - sdebug_driver_template.cmd_per_lun = sdebug_max_queue; - if (!sdebug_clustering) - sdebug_driver_template.dma_boundary = PAGE_SIZE - 1; - hpnt = scsi_host_alloc(&sdebug_driver_template, 0); if (NULL == hpnt) { pr_err("scsi_host_alloc failed\n"); error = -ENODEV; return error; } + hpnt->can_queue = sdebug_max_queue; + hpnt->cmd_per_lun = sdebug_max_queue; + if (!sdebug_clustering) + hpnt->dma_boundary = PAGE_SIZE - 1; + if (submit_queues > nr_cpu_ids) { pr_warn("%s: trim submit_queues (was %d) to nr_cpu_ids=%u\n", my_name, submit_queues, nr_cpu_ids); |