Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp283996rwb; Tue, 4 Oct 2022 04:08:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5yzQT5N+shrbb2+J2CCUUSATdOIq8CTIFMGpcU00b8+RZ4GzS2rnO1zcCBCYPj4OR96I7s X-Received: by 2002:a63:1058:0:b0:44f:a1cb:7eec with SMTP id 24-20020a631058000000b0044fa1cb7eecmr8118634pgq.117.1664881709499; Tue, 04 Oct 2022 04:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664881709; cv=none; d=google.com; s=arc-20160816; b=XqQFJQlsevvekFZiugvJB6L/IMyBdUv24imnltERfaMujWVXQBaIc7Al4fir7+qYRJ vj/Z48GoOGxiIcWmbsI2g2ONZzXGBzS949+Y9SElUpqIPzvLKdgkhp/YhJWIQpA6M9QO pOvEwxRQA0W+fjy+mvUgSpNc6MF33BDQHb8iz+wDdVqMTiO3r8Dt4Z3oESueQ/Ptvu4Z C1TfoDkft8CadW3sk5fEkBNxWRQAn+nfWEYpFoVQOJETQwvSxgYH0hwT3LKEddlDfUnw wGR5R83cap8BIj+hUYMDDbmlvuOmqOO4LPOlh7aeQaM0Cc5V0QQETIiUZEc0AfkdVWRS EuLg== 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=Mt0ifK3x2ptrJkAFtZES0MD0kZlX1oIeIzEcRb4x4Ik=; b=TsaTbT3M/2T1UxyB7Pk9R/Cgy/bA/UNl2zXshSMRVc1mj6piG9aovymt87F9b1kyFB bI+E46egqrs8Z3iGhm29jkasVE61WkmgbNYCHj+X528ktioDseTK/KglMpYJijbrYmQB 2uiIVqCwH3wsv5bhBsf8lMf43R/yeC9Tc95mwZbQHGpNhczJuw8hK6UxMNgX3AnfmutY b+UexUcEN3xq4EkJd6FZ6ThUT3EECqL9J9FDxMIFlNuUvilpuzdcuBQGLCc9VNKaKjyD rySpLQwG0/fgTOLFM6U5q2F8hG5pPZkY1W+Hv592eN6IpbDBvB0VdC/eQKxE+yLGxW1p r6og== 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 v4-20020a632f04000000b0043c0b452d3esi13930262pgv.292.2022.10.04.04.08.16; Tue, 04 Oct 2022 04:08:29 -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 S229837AbiJDK5E (ORCPT + 99 others); Tue, 4 Oct 2022 06:57:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbiJDK4w (ORCPT ); Tue, 4 Oct 2022 06:56:52 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A97656025; Tue, 4 Oct 2022 03:56:50 -0700 (PDT) Received: from fraeml743-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MhZNs6LyYz687YW; Tue, 4 Oct 2022 18:55:25 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml743-chm.china.huawei.com (10.206.15.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 4 Oct 2022 12:56:48 +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; Tue, 4 Oct 2022 11:56:45 +0100 From: John Garry To: , , CC: , , , , , , , , John Garry Subject: [PATCH v3 2/7] scsi: hisi_sas: Use sas_task_find_rq() Date: Tue, 4 Oct 2022 19:27:08 +0800 Message-ID: <1664882833-39804-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1664882833-39804-1-git-send-email-john.garry@huawei.com> References: <1664882833-39804-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: dggems702-chm.china.huawei.com (10.3.19.179) 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 Reviewed-by: Hannes Reinecke --- 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.25.1