From patchwork Tue Sep 19 17:10:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viswas G X-Patchwork-Id: 9959695 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9C48060208 for ; Tue, 19 Sep 2017 17:10:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 846F328EA8 for ; Tue, 19 Sep 2017 17:10:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7963828EB6; Tue, 19 Sep 2017 17:10:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9DEC28EC7 for ; Tue, 19 Sep 2017 17:10:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751512AbdISRKo (ORCPT ); Tue, 19 Sep 2017 13:10:44 -0400 Received: from mail-sn1nam02on0082.outbound.protection.outlook.com ([104.47.36.82]:49888 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751394AbdISRKi (ORCPT ); Tue, 19 Sep 2017 13:10:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mscc365.onmicrosoft.com; s=selector1-microsemi-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=JEIwG9sKtdaGSn2mf+cy7q1UAyX8HMcfvCH5CS3tL94=; b=lKd8GZ08/5Ot7Vmt1Qs4bi4CaX/ymwdAMPRcqvs5gZgHq24taKEEn7gTnyxmM2DWeeHFfPGmKBJNpIy1R44Q4pi/Vc68QUhMK/kOJEbd/jYJGEovZaOUAiW8e6Xv4t/zBHdRu2+2tJAFOCVLImwVCTX9O/vHuYBQKi9XAiRNfLI= Received: from SN4PR0201CA0072.namprd02.prod.outlook.com (10.171.31.162) by CY4PR02MB2200.namprd02.prod.outlook.com (10.169.180.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Tue, 19 Sep 2017 17:10:36 +0000 Received: from BN1AFFO11FD044.protection.gbl (2a01:111:f400:7c10::109) by SN4PR0201CA0072.outlook.office365.com (2603:10b6:803:20::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11 via Frontend Transport; Tue, 19 Sep 2017 17:10:36 +0000 Authentication-Results: spf=pass (sender IP is 208.19.100.21) smtp.mailfrom=microsemi.com; oracle.com; dkim=none (message not signed) header.d=none;oracle.com; dmarc=bestguesspass action=none header.from=microsemi.com; Received-SPF: Pass (protection.outlook.com: domain of microsemi.com designates 208.19.100.21 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.100.21; helo=avsrvexchhts1.microsemi.net; Received: from avsrvexchhts1.microsemi.net (208.19.100.21) by BN1AFFO11FD044.mail.protection.outlook.com (10.58.52.191) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.35.14 via Frontend Transport; Tue, 19 Sep 2017 17:10:35 +0000 Received: from localhost (10.187.72.81) by avsrvexchhts1.microsemi.net (10.100.34.105) with Microsoft SMTP Server id 14.3.361.1; Tue, 19 Sep 2017 10:10:15 -0700 From: Viswas G To: CC: , , , , , Subject: [PATCH V3 5/9] pm80xx : cleanup in pm8001_abort_task function. Date: Tue, 19 Sep 2017 22:40:00 +0530 Message-ID: <20170919171004.10331-6-Viswas.G@microsemi.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170919171004.10331-1-Viswas.G@microsemi.com> References: <20170919171004.10331-1-Viswas.G@microsemi.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.100.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(39860400002)(2980300002)(438002)(199003)(189002)(2351001)(356003)(57986006)(47776003)(305945005)(36756003)(8676002)(81166006)(189998001)(81156014)(50226002)(106466001)(69596002)(16586007)(5660300001)(86362001)(97736004)(8936002)(76506005)(316002)(478600001)(2950100002)(48376002)(1076002)(54906002)(6916009)(68736007)(104016004)(2906002)(76176999)(77096006)(50466002)(50986999)(6666003)(53936002)(5003940100001)(4326008)(15760500002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR02MB2200; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD044; 1:4oaFtEq1DZfWIpmZWCos1XLuNPXr6z4nudJoxcS4sGKx19Z/YVdlv631px0o41rgZHlFtJWs6YbVrarCVK2b1PTi/e692u34yA7tieO4XeX5n5/f7X8K3HirIHtYv3JT X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8275d9b7-d344-47c4-6cc4-08d4ff815839 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(8251501002)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY4PR02MB2200; X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB2200; 3:/bt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u2zoNHCRfHnnDj81vrgZD8YnpXdS8ADINdsU6gt966ZPbO/CyBq8iiR9zfhlKkHYXi6mFTHOx0CcwCZoC7Mtj5Cd5QIV8Cs0EXlX/on1Re6t+yp5u14kZEFzUdSXTbAJXTUjiMrHMXiYUsxhwK0itNB7mflDePCadcVL4qBUaRMmQctWUVkCtBU2VtOpwTdqrjiZWaQIOKLBg++wCk7JDWFUE/CBNBb4fSNAEXTwR11DsGOCWXjBBvK3ShRYhivvHNBC59/PWRIsAxrFkiZLZtE8Cu9ZhTt/S8J0Kbkvv1mGGQKEHMvVZOf8kkYsn6by0GH4u3CskwIDI8WYJySzQRsaXTsmiLpqsxfobDaeUsMp/QMAJUvTYT6T+josgtpjB7UKFf3P3bwLpfktnrJnX9hPsxWrtIU3T6FBrAs5+BuhIRphD0LQnQ+N6S6CAJL+AkSj9yvQ4 X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93004095)(100000703101)(100105400095)(6055026)(6041248)(20161123558100)(20161123555025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR02MB2200; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR02MB2200; X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB2200; 4:iqWdxNOAV7Pv4SB+PwaTRq/7CYdIT92VE5zVJ8xsdO5Rl+mw6QqpURXHT1xcjilLC+MX9hpjsYTT5RO2gYCjU4xRAbXo7cbBFRi5NIsSZacIZsVAjmYAPI9NnTXgzWRuMNIzZarfDILDUfx0hRKyU7T4HIPsPpaGcMUKfWogGyRQGe+i87hrnBpG5vFRUsEwl81Xiq0fwZsaP2//QWdAOwG+xyY29pqA/EgL9GuDquDTBdgfqPIqdjCFvLwEYr3UvyOpOj+UremSryp+aWj+7NNwkREBxPXai8vjJmw7zYk= X-Forefront-PRVS: 04359FAD81 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR02MB2200; 23:cANupFPbgLQh4FguCgg1OA51wECwfyApGSE51Mx3h?= =?us-ascii?Q?W07S3ohNxx0evfydj/znIKDRbWlaCJ3nV3ht7f5eKTQBCgX1shYi8WlOBWCl?= =?us-ascii?Q?HemVJwkfMhZEu88WNasJc4k5FER1FGoNDgH4vgBtLpP+DeqXlKg7qPw+Chp4?= =?us-ascii?Q?kLO/71nPfJ9Ig7oUoT/q0A+IgcTUw3U1J7xrt5dYlbs5fckN7TTIzR9QTJPA?= =?us-ascii?Q?yYL8Bbp7d9v7e5BqZkCL6OkDyiRaLJ68FHYhZZpVltmSwVJbnrTjCBQFngVM?= =?us-ascii?Q?y9kWNlw8Q2O3NOes2OaKEbess0uxeDFR3d+oLXNO9K3IpUdValcx9N8Y9MTX?= =?us-ascii?Q?FIznsMQDUs3ScRVZXF2cc0uOer/UVdLacuHpcHC9zao1C3r2QlI/iyBFz+ov?= =?us-ascii?Q?iXr/W71OjmkaIeQhU3kc7LuCMvgs6rvumz/gN+we7exp642SWKS7bFJWlTMM?= =?us-ascii?Q?Q4/kEdnM6/SaOvCEK81RUI28b1dhT4JjE31PObiJvjDG2qETh0ojDivEh9Ei?= =?us-ascii?Q?MojGxkt5aB9wrcIe4Ng26eADfWhlGJjXsIYethOsPurrITrcEzkSuAqrID0c?= =?us-ascii?Q?p9kR+Aqob4bV+amRcUQpNVddbqzsLVveRk0tlnZgiAKpYxipdcwE8k6ya7y4?= =?us-ascii?Q?p+9LRBvzFNcqQi7pIlkXOMI5pEiC0qamJFlqMUs0weqsJPpVANBuKcOhiGeH?= =?us-asc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lTmBaQDMi2fqM/QeKH4tmkc2FyJkkRdDrDC6AnJW3z+fPp7ioqH2/vqOOaecsxbqwxiSbC/BbHAE=; 7:/PIr7Hi73Sd4L3c+kqi97u9rrJLY91wUjkV4rBYoMl8wzKsT17Yl5FV572yof6ObEbeyjnLBkdaGvA8xkBcvWRXvXAumQqU43FqnXPP9pfDab17IMYAmCtRaZ/h5KLUZepXqn1/TDKm2+Sggc466K8qnoIJcvJx/ZqLI7LGxSWNNUgFjOojVWIO4WZqksRMe3qYv/xuCaqTFF8EowKs0qdYy8hGECXvzwJl+wuaezH8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2017 17:10:35.7893 (UTC) X-MS-Exchange-CrossTenant-Id: f267a5c8-86d8-4cc9-af71-1fd2c67c8fad X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f267a5c8-86d8-4cc9-af71-1fd2c67c8fad; Ip=[208.19.100.21]; Helo=[avsrvexchhts1.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR02MB2200 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Deepak Ukey Signed-off-by: Viswas G Acked-by: Jack Wang --- drivers/scsi/pm8001/pm8001_sas.c | 49 +++++++++++----------------------------- 1 file changed, 13 insertions(+), 36 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index ce584c31d36e..e80b0542a67f 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -1159,40 +1159,35 @@ int pm8001_query_task(struct sas_task *task) int pm8001_abort_task(struct sas_task *task) { unsigned long flags; - u32 tag = 0xdeadbeef; + u32 tag; u32 device_id; struct domain_device *dev ; - struct pm8001_hba_info *pm8001_ha = NULL; + struct pm8001_hba_info *pm8001_ha; struct pm8001_ccb_info *ccb; struct scsi_lun lun; struct pm8001_device *pm8001_dev; struct pm8001_tmf_task tmf_task; int rc = TMF_RESP_FUNC_FAILED; if (unlikely(!task || !task->lldd_task || !task->dev)) - return rc; + return TMF_RESP_FUNC_FAILED; + dev = task->dev; + pm8001_dev = dev->lldd_dev; + pm8001_ha = pm8001_find_ha_by_dev(dev); + device_id = pm8001_dev->device_id; + rc = pm8001_find_tag(task, &tag); + if (rc == 0) { + pm8001_printk("no tag for task:%p\n", task); + return TMF_RESP_FUNC_FAILED; + } spin_lock_irqsave(&task->task_state_lock, flags); if (task->task_state_flags & SAS_TASK_STATE_DONE) { spin_unlock_irqrestore(&task->task_state_lock, flags); - rc = TMF_RESP_FUNC_COMPLETE; - goto out; + return TMF_RESP_FUNC_COMPLETE; } spin_unlock_irqrestore(&task->task_state_lock, flags); if (task->task_proto & SAS_PROTOCOL_SSP) { struct scsi_cmnd *cmnd = task->uldd_task; - dev = task->dev; - ccb = task->lldd_task; - pm8001_dev = dev->lldd_dev; - pm8001_ha = pm8001_find_ha_by_dev(dev); int_to_scsilun(cmnd->device->lun, &lun); - rc = pm8001_find_tag(task, &tag); - if (rc == 0) { - printk(KERN_INFO "No such tag in %s\n", __func__); - rc = TMF_RESP_FUNC_FAILED; - return rc; - } - device_id = pm8001_dev->device_id; - PM8001_EH_DBG(pm8001_ha, - pm8001_printk("abort io to deviceid= %d\n", device_id)); tmf_task.tmf = TMF_ABORT_TASK; tmf_task.tag_of_task_to_be_managed = tag; rc = pm8001_issue_ssp_tmf(dev, lun.scsi_lun, &tmf_task); @@ -1200,28 +1195,10 @@ int pm8001_abort_task(struct sas_task *task) pm8001_dev->sas_device, 0, tag); } else if (task->task_proto & SAS_PROTOCOL_SATA || task->task_proto & SAS_PROTOCOL_STP) { - dev = task->dev; - pm8001_dev = dev->lldd_dev; - pm8001_ha = pm8001_find_ha_by_dev(dev); - rc = pm8001_find_tag(task, &tag); - if (rc == 0) { - printk(KERN_INFO "No such tag in %s\n", __func__); - rc = TMF_RESP_FUNC_FAILED; - return rc; - } rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev, pm8001_dev->sas_device, 0, tag); } else if (task->task_proto & SAS_PROTOCOL_SMP) { /* SMP */ - dev = task->dev; - pm8001_dev = dev->lldd_dev; - pm8001_ha = pm8001_find_ha_by_dev(dev); - rc = pm8001_find_tag(task, &tag); - if (rc == 0) { - printk(KERN_INFO "No such tag in %s\n", __func__); - rc = TMF_RESP_FUNC_FAILED; - return rc; - } rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev, pm8001_dev->sas_device, 0, tag);