diff mbox series

[v2,plinth/topic-sas-5.8] {topost} scsi: hisi_sas: ignore adding device link for enclosure device

Message ID 1596591874-60814-1-git-send-email-chenxiang66@hisilicon.com (mailing list archive)
State Not Applicable
Headers show
Series [v2,plinth/topic-sas-5.8] {topost} scsi: hisi_sas: ignore adding device link for enclosure device | expand

Commit Message

chenxiang Aug. 5, 2020, 1:44 a.m. UTC
From: Xiang Chen <chenxiang66@hisilicon.com>

For enclosure device, it is not necessary to add device link as it is not
a real disk, so check scsi device's type to ignore adding device link for it.
As scsi device's type is initialized in function scsi_add_lun() which is
after function shost->hostt->slave_alloc(), so move adding device link and
the check to host->hostt->slave_configure() which is after the function
scsi_add_lun().

Fixes: d73be9b32942 ("{topost} scsi: hisi_sas: Add device link between SCSI devices and
hisi_hba")
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Comments

chenxiang Aug. 5, 2020, 1:53 a.m. UTC | #1
Please ignore the patch, mistake to send it here:-

在 2020/8/5 9:44, chenxiang 写道:
> From: Xiang Chen <chenxiang66@hisilicon.com>
>
> For enclosure device, it is not necessary to add device link as it is not
> a real disk, so check scsi device's type to ignore adding device link for it.
> As scsi device's type is initialized in function scsi_add_lun() which is
> after function shost->hostt->slave_alloc(), so move adding device link and
> the check to host->hostt->slave_configure() which is after the function
> scsi_add_lun().
>
> Fixes: d73be9b32942 ("{topost} scsi: hisi_sas: Add device link between SCSI devices and
> hisi_hba")
> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
> ---
>   drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> index 187a307..d056d5c 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> @@ -3076,11 +3076,21 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable)
>   	return 0;
>   }
>   
> -static int slave_alloc_v3_hw(struct scsi_device *sdev)
> +static int slave_configure_v3_hw(struct scsi_device *sdev)
>   {
>   	struct Scsi_Host *shost = dev_to_shost(&sdev->sdev_gendev);
> +	struct domain_device *ddev = sdev_to_domain_dev(sdev);
>   	struct hisi_hba *hisi_hba = shost_priv(shost);
>   	struct device *dev = hisi_hba->dev;
> +	int ret = sas_slave_configure(sdev);
> +
> +	if (ret)
> +		return ret;
> +	if (!dev_is_sata(ddev))
> +		sas_change_queue_depth(sdev, 64);
> +
> +	if (sdev->type == TYPE_ENCLOSURE)
> +		return 0;
>   
>   	if (!device_link_add(&sdev->sdev_gendev, dev,
>   			     DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE))
> @@ -3098,8 +3108,7 @@ static struct scsi_host_template sht_v3_hw = {
>   	.module			= THIS_MODULE,
>   	.queuecommand		= sas_queuecommand,
>   	.target_alloc		= sas_target_alloc,
> -	.slave_alloc		= slave_alloc_v3_hw,
> -	.slave_configure	= hisi_sas_slave_configure,
> +	.slave_configure	= slave_configure_v3_hw,
>   	.scan_finished		= hisi_sas_scan_finished,
>   	.scan_start		= hisi_sas_scan_start,
>   	.change_queue_depth	= sas_change_queue_depth,
diff mbox series

Patch

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index 187a307..d056d5c 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -3076,11 +3076,21 @@  static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable)
 	return 0;
 }
 
-static int slave_alloc_v3_hw(struct scsi_device *sdev)
+static int slave_configure_v3_hw(struct scsi_device *sdev)
 {
 	struct Scsi_Host *shost = dev_to_shost(&sdev->sdev_gendev);
+	struct domain_device *ddev = sdev_to_domain_dev(sdev);
 	struct hisi_hba *hisi_hba = shost_priv(shost);
 	struct device *dev = hisi_hba->dev;
+	int ret = sas_slave_configure(sdev);
+
+	if (ret)
+		return ret;
+	if (!dev_is_sata(ddev))
+		sas_change_queue_depth(sdev, 64);
+
+	if (sdev->type == TYPE_ENCLOSURE)
+		return 0;
 
 	if (!device_link_add(&sdev->sdev_gendev, dev,
 			     DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE))
@@ -3098,8 +3108,7 @@  static struct scsi_host_template sht_v3_hw = {
 	.module			= THIS_MODULE,
 	.queuecommand		= sas_queuecommand,
 	.target_alloc		= sas_target_alloc,
-	.slave_alloc		= slave_alloc_v3_hw,
-	.slave_configure	= hisi_sas_slave_configure,
+	.slave_configure	= slave_configure_v3_hw,
 	.scan_finished		= hisi_sas_scan_finished,
 	.scan_start		= hisi_sas_scan_start,
 	.change_queue_depth	= sas_change_queue_depth,