Skip to content

Commit

Permalink
scst: Unbreak the build for kernel versions <= 6.3
Browse files Browse the repository at this point in the history
The previous series of patches introduced the use of a const pointer to
scsi_host_template. However, scsi_host_alloc() uses a non-const pointer
prior to kernel version 6.4, causing the build to throw the following
error:

    passing argument 1 of ‘scsi_host_alloc’ discards ‘const’
    qualifier from pointer target type

Hence, cast away the constness to resolve the error.
  • Loading branch information
lnocturno committed May 2, 2023
1 parent 15229d0 commit 9d62deb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion qla2x00t-32gbit/qla_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -5084,7 +5084,7 @@ struct scsi_qla_host *qla2x00_create_host(const struct scsi_host_template *sht,
struct Scsi_Host *host;
struct scsi_qla_host *vha = NULL;

host = scsi_host_alloc(sht, sizeof(scsi_qla_host_t));
host = scsi_host_alloc((struct scsi_host_template *) sht, sizeof(scsi_qla_host_t));
if (!host) {
ql_log_pci(ql_log_fatal, ha->pdev, 0x0107,
"Failed to allocate host from the scsi layer, aborting.\n");
Expand Down
2 changes: 1 addition & 1 deletion qla2x00t/qla_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -3625,7 +3625,7 @@ struct scsi_qla_host *qla2x00_create_host(const struct scsi_host_template *sht,
struct Scsi_Host *host;
struct scsi_qla_host *vha = NULL;

host = scsi_host_alloc(sht, sizeof(scsi_qla_host_t));
host = scsi_host_alloc((struct scsi_host_template *) sht, sizeof(scsi_qla_host_t));
if (host == NULL) {
ql_log_pci(ql_log_fatal, ha->pdev, 0x0107,
"Failed to allocate host from the scsi layer, aborting.\n");
Expand Down
3 changes: 2 additions & 1 deletion scst_local/scst_local.c
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,8 @@ static int scst_local_driver_probe(struct device *dev)

TRACE_DBG("sess %p", sess);

hpnt = scsi_host_alloc(&scst_lcl_ini_driver_template, sizeof(*sess));
hpnt = scsi_host_alloc((struct scsi_host_template *) &scst_lcl_ini_driver_template,
sizeof(*sess));
if (hpnt == NULL) {
PRINT_ERROR("%s", "scsi_register() failed");
ret = -ENODEV;
Expand Down

0 comments on commit 9d62deb

Please sign in to comment.