[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1654770559-101375-12-git-send-email-john.garry@huawei.com>
Date: Thu, 9 Jun 2022 18:29:12 +0800
From: John Garry <john.garry@...wei.com>
To: <axboe@...nel.dk>, <damien.lemoal@...nsource.wdc.com>,
<jejb@...ux.ibm.com>, <martin.petersen@...cle.com>,
<brking@...ibm.com>, <hare@...e.de>, <hch@....de>
CC: <linux-block@...r.kernel.org>, <linux-ide@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-scsi@...r.kernel.org>,
<chenxiang66@...ilicon.com>, John Garry <john.garry@...wei.com>
Subject: [PATCH RFC v2 11/18] scsi: libsas: Don't attempt to find scsi host rphy in slave alloc
It doesn't have one.
Signed-off-by: John Garry <john.garry@...wei.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(-)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 764e859d0106..0219ccac9062 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -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;
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 42279a6d6b06..532e734c1fb6 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -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;
--
2.26.2
Powered by blists - more mailing lists