@@ -756,14 +756,22 @@ static int hisi_sas_init_device(struct domain_device *device)
int hisi_sas_slave_alloc(struct scsi_device *sdev)
{
- struct domain_device *ddev = sdev_to_domain_dev(sdev);
- struct hisi_sas_device *sas_dev = ddev->lldd_dev;
+ struct scsi_target *starget = sdev->sdev_target;
+ struct device *parent = starget->dev.parent;
+ struct hisi_sas_device *sas_dev;
+ struct domain_device *ddev;
int rc;
+ if (scsi_is_host_device(parent))
+ return 0;
+
rc = sas_slave_alloc(sdev);
if (rc)
return rc;
+ ddev = sdev_to_domain_dev(sdev);
+ sas_dev = ddev->lldd_dev;
+
rc = hisi_sas_init_device(ddev);
if (rc)
return rc;
@@ -847,8 +847,15 @@ struct domain_device *sas_find_dev_by_rphy(struct sas_rphy *rphy)
int sas_target_alloc(struct scsi_target *starget)
{
- struct sas_rphy *rphy = dev_to_rphy(starget->dev.parent);
- struct domain_device *found_dev = sas_find_dev_by_rphy(rphy);
+ struct device *parent = starget->dev.parent;
+ struct sas_rphy *rphy;
+ struct domain_device *found_dev;
+
+ if (scsi_is_host_device(parent))
+ return 0;
+
+ rphy = dev_to_rphy(parent);
+ found_dev = sas_find_dev_by_rphy(rphy);
if (!found_dev)
return -ENODEV;
@@ -1252,6 +1259,12 @@ EXPORT_SYMBOL_GPL(sas_task_abort);
int sas_slave_alloc(struct scsi_device *sdev)
{
+ struct scsi_target *starget = sdev->sdev_target;
+ struct device *parent = starget->dev.parent;
+
+ if (scsi_is_host_device(parent))
+ return 0;
+
if (dev_is_sata(sdev_to_domain_dev(sdev)) && sdev->lun)
return -ENXIO;
It doesn't have one. Signed-off-by: John Garry <john.garry@huawei.com> --- drivers/scsi/hisi_sas/hisi_sas_main.c | 12 ++++++++++-- drivers/scsi/libsas/sas_scsi_host.c | 17 +++++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-)