Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1717253rwb; Thu, 29 Sep 2022 00:55:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7v01tqPzsdQ+t3q3dYKIQAwKHvmqbMXTJH/Wc6lz88YGBfGWQXDJE9FuyKV2b1U+wTNvTT X-Received: by 2002:a17:902:d490:b0:177:fc1d:6b0c with SMTP id c16-20020a170902d49000b00177fc1d6b0cmr2247746plg.28.1664438108668; Thu, 29 Sep 2022 00:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664438108; cv=none; d=google.com; s=arc-20160816; b=XwmGsHWNOS1/al4zk1/8RexZh4FvWsVAlQN8TK69eIjQsU3SVkGl7Gf4l8/TF+E3VK knoQ52KgYELObz0S+PcJT3X0j2S/xwcABfKMvQZLkl/AlZDZCdEhWN0lMnUZGvXRpT8q g+bjsrtUc7U0TQFTE5GTRuXRJl5zwGsZD9AutwCMgy+I+Q7SteNMK/1c4KtsyMYSLbJc uMWrGZ35igxv1Sg+dxGyMggSbJHF+tvdSl7GApjphtqmwFSPdR/vKvwSXvuqhv6pm09B Qhvjw42yDFky27jo+jPpr7DTwF8ZWLGdSTaStWEQ/AgUYHqfmXZ+hOSTyBo8Z7ky7dNr c65w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:subject:from:user-agent:mime-version:date:message-id; bh=JLA4wKWOyCX6eM/RAEyyckzZoD4r3Y5lQWkEnd6oXVU=; b=V4PSvnmrLhQ0QGSCvYqDptycxr0ETIjoFmeP5dIZhpq47Jz0CVPMAmqRe72ornvt91 fhTInWHwsGF2IGrHtvV66oO3BEqTFBKuw2Uo3dIU/SG8mrWbpA6mwrvFA08JNMx1zjzO xiXWlIJsuhbwypBUxp3pscXk6cyTAyXOhDVXIyhPxXgvQvUDje3zI/MCacuoyVcdhIYf AOFFeq8s8lnnIZ7wZFdnEO5PQsgfwnslhea3I7fSeAUlVMABH9Qr+V1IIXgzojBRZpwG IakES9sOW1K5pbtZFsVmaapKYbDIiSV8SYHkMAi0nnrwxl8hFC1j7H4790mxli0g4OfK TdPQ== 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 i17-20020a17090332d100b00178b95aa01fsi9402840plr.614.2022.09.29.00.54.57; Thu, 29 Sep 2022 00:55:08 -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 S235325AbiI2Hic (ORCPT + 99 others); Thu, 29 Sep 2022 03:38:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235262AbiI2Hi2 (ORCPT ); Thu, 29 Sep 2022 03:38:28 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9764B139439; Thu, 29 Sep 2022 00:38:27 -0700 (PDT) Received: from fraeml704-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MdQFk1lYHz6HJZW; Thu, 29 Sep 2022 15:38:18 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml704-chm.china.huawei.com (10.206.15.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Thu, 29 Sep 2022 09:38:25 +0200 Received: from [10.126.170.84] (10.126.170.84) 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; Thu, 29 Sep 2022 08:38:24 +0100 Message-ID: <328e6482-52b7-a9e0-5b43-ff1566ec1641@huawei.com> Date: Thu, 29 Sep 2022 08:38:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 From: John Garry Subject: Re: [PATCH 2/6] scsi: hisi_sas: Use sas_task_find_rq() To: Damien Le Moal , , , , CC: , , , , , , References: <1664368034-114991-1-git-send-email-john.garry@huawei.com> <1664368034-114991-3-git-send-email-john.garry@huawei.com> <4737cbca-6250-00b8-a2be-1d98e2b8d04a@opensource.wdc.com> In-Reply-To: <4737cbca-6250-00b8-a2be-1d98e2b8d04a@opensource.wdc.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.126.170.84] X-ClientProxiedBy: lhrpeml100002.china.huawei.com (7.191.160.241) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 On 29/09/2022 03:11, Damien Le Moal wrote: > On 9/28/22 21:27, John Garry wrote: >> Use sas_task_find_rq() to lookup the request per task for its driver tag. >> >> Signed-off-by: John Garry > > Looks good, modulo the question below. > > Reviewed-by: Damien Le Moal > Cheers >> --- >> 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; > > Do you really need the NULL initialization here ? Yes, as rq is only set in one case of the switch statement and checked outside the switch statement. Thanks, John