@@ -298,6 +298,8 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
scsi_proc_host_add(shost);
scsi_autopm_put_host(shost);
+ if (shost->nr_reserved_cmds)
+ shost->sdev = scsi_get_host_dev(shost); // TODO: Add error handling
return error;
/*
@@ -360,6 +362,9 @@ static void scsi_host_dev_release(struct device *dev)
if (shost->shost_state != SHOST_CREATED)
put_device(parent);
+ if (shost->sdev)
+ scsi_free_host_dev(shost->sdev);
+
kfree(shost);
}
@@ -566,6 +566,7 @@ struct Scsi_Host {
wait_queue_head_t host_wait;
struct scsi_host_template *hostt;
struct scsi_transport_template *transportt;
+ struct scsi_device *sdev;
/* Area to keep a shared tag map */
struct blk_mq_tag_set tag_set;
When the shost supports reserved commands then allocate the SCSI host sdev. As noted later, we need to use this for libata internal commands. Signed-off-by: John Garry <john.garry@huawei.com> --- drivers/scsi/hosts.c | 5 +++++ include/scsi/scsi_host.h | 1 + 2 files changed, 6 insertions(+)