Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3372813rwb; Fri, 30 Sep 2022 02:35:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53K5egM+we8Bah/MbsiXmF49M83UG4FrTceu9K8tyvUNPiNRnb7izKCvrEbK2hyAYJVdzL X-Received: by 2002:a17:90b:3b44:b0:205:d22a:e94 with SMTP id ot4-20020a17090b3b4400b00205d22a0e94mr20730533pjb.15.1664530543438; Fri, 30 Sep 2022 02:35:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664530543; cv=none; d=google.com; s=arc-20160816; b=ksY8Nr7Pn+5pIl5vTMH8VZRpPdFnqWgL3CyAaQSlmRoI0ylqr2qgdIxXT3v19yEP0s RVm3iL1ZTbgtk0J0uyh3SPDLECi2JIneelEb0JLxed1XFTwcVbBWtUmByS9z5t0OcLJb UDJzKsyTx1+S1bBYpcz4tGrv6I6LBq+wY3BYpupP6kyKv76tM0+YETG2o8/d9J81zhYq 5TXP2dZs/ti53MxyyrcgakkK9rFR8Bj9PUBFWAFiQuhsIG1AlhYfsU15n0ZCJ28jG0r8 81oQyCerj4N8cjR90mWNCH4IlBOr4Jm+vvHbUUpPXuSUiDjo414erfncF1R/iXVrjDDl AS2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Ua7bANYSyCg+lNA9UIULMYEFDk6nJOFrI8N2eCMlvG8=; b=tcER3hEYpqZmjQWeCTV5itvQVyb4VlD4jtDn0WhMOa3OzrguD3V9SDPEBjgQc6j0bN SsjB4RZQpyXVVedIwUIc8nP1SMoZc0sQyr1zKnZ6TFtF7pgJVWqXhpknzzWpO/guFiPE nVQiPVAQAz1xqzLfrQJy0qOwWhwdNJw91u+zf4S2lnZG7iBB137HUTZKtD7uR2f/KTeh 96Gti1dipCDp9n2A2bVZiVI2VHTfys+e1rhgM81/cZYmgwrUXrMgX6Od+DNJxfCAysPJ LFH3BjAdcmEJfQ7wpK34MUijlf45CAfkSdGnhYDt+Y4vpEEU9WNX24aWLdBu4m2iT6EP eskw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a170902ef4600b00176b4a716e7si1976107plx.460.2022.09.30.02.35.31; Fri, 30 Sep 2022 02:35:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230057AbiI3JEN (ORCPT + 99 others); Fri, 30 Sep 2022 05:04:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231149AbiI3JDx (ORCPT ); Fri, 30 Sep 2022 05:03:53 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF3D5FEE40; Fri, 30 Sep 2022 02:03:52 -0700 (PDT) Received: from fraeml734-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Mf43R02p1z688sf; Fri, 30 Sep 2022 17:01:39 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml734-chm.china.huawei.com (10.206.15.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 11:03:50 +0200 Received: from localhost.localdomain (10.69.192.58) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 10:03:47 +0100 From: John Garry To: , , , CC: , , , , , , , , John Garry Subject: [PATCH v2 2/6] scsi: hisi_sas: Use sas_task_find_rq() Date: Fri, 30 Sep 2022 16:56:20 +0800 Message-ID: <1664528184-162714-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1664528184-162714-1-git-send-email-john.garry@huawei.com> References: <1664528184-162714-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use sas_task_find_rq() to lookup the request per task for its driver tag. Signed-off-by: John Garry Reviewed-by: Damien Le Moal --- drivers/scsi/hisi_sas/hisi_sas_main.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 4c37ae9eb6b6..1011dffed51f 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -177,13 +177,13 @@ static void hisi_sas_slot_index_set(struct hisi_hba *hisi_hba, int slot_idx) } static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba, - struct scsi_cmnd *scsi_cmnd) + struct request *rq) { int index; void *bitmap = hisi_hba->slot_index_tags; - if (scsi_cmnd) - return scsi_cmd_to_rq(scsi_cmnd)->tag; + if (rq) + return rq->tag; spin_lock(&hisi_hba->lock); index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count, @@ -461,11 +461,11 @@ static int hisi_sas_queue_command(struct sas_task *task, gfp_t gfp_flags) struct asd_sas_port *sas_port = device->port; struct hisi_sas_device *sas_dev = device->lldd_dev; bool internal_abort = sas_is_internal_abort(task); - struct scsi_cmnd *scmd = NULL; struct hisi_sas_dq *dq = NULL; struct hisi_sas_port *port; struct hisi_hba *hisi_hba; struct hisi_sas_slot *slot; + struct request *rq = NULL; struct device *dev; int rc; @@ -520,22 +520,12 @@ static int hisi_sas_queue_command(struct sas_task *task, gfp_t gfp_flags) return -ECOMM; } - if (task->uldd_task) { - struct ata_queued_cmd *qc; - - if (dev_is_sata(device)) { - qc = task->uldd_task; - scmd = qc->scsicmd; - } else { - scmd = task->uldd_task; - } - } - - if (scmd) { + rq = sas_task_find_rq(task); + if (rq) { unsigned int dq_index; u32 blk_tag; - blk_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd)); + blk_tag = blk_mq_unique_tag(rq); dq_index = blk_mq_unique_tag_to_hwq(blk_tag); dq = &hisi_hba->dq[dq_index]; } else { @@ -580,7 +570,7 @@ static int hisi_sas_queue_command(struct sas_task *task, gfp_t gfp_flags) if (!internal_abort && hisi_hba->hw->slot_index_alloc) rc = hisi_hba->hw->slot_index_alloc(hisi_hba, device); else - rc = hisi_sas_slot_index_alloc(hisi_hba, scmd); + rc = hisi_sas_slot_index_alloc(hisi_hba, rq); if (rc < 0) goto err_out_dif_dma_unmap; -- 2.35.3