From patchwork Tue Feb 17 23:36:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viswas G X-Patchwork-Id: 9950969 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 0D57E6038F for ; Wed, 13 Sep 2017 10:42:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F30C828F7A for ; Wed, 13 Sep 2017 10:42:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7EDB28FBC; Wed, 13 Sep 2017 10:42:18 +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=-3.5 required=2.0 tests=BAYES_00, DATE_IN_PAST_96_XX, 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 570B428F7A for ; Wed, 13 Sep 2017 10:42:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752210AbdIMKmR (ORCPT ); Wed, 13 Sep 2017 06:42:17 -0400 Received: from mail-sn1nam01hn0214.outbound.protection.outlook.com ([104.47.32.214]:45408 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751705AbdIMKmP (ORCPT ); Wed, 13 Sep 2017 06:42:15 -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=9zl4VSbrMVMCn2IdMk4L0dW5BLzmGZYZNsOb8CwDu/4=; b=MX5hgOjQ9sW4vs48YFRAZLpANQtcVdksItAmQtE9IJVIndCN5h0Dwc+oZ3EoNRH6EZ9pYhi2qJPgRfxvspkNDpCZLxntBSnfBqMgRDqNT3h83EOuolBlSbi+6aUp+i9thGOkbwPhZJOREAdnnQ9OTPXpznTcb1vlGpCg+CyVrsI= Received: from CY4PR02CA0004.namprd02.prod.outlook.com (10.169.188.14) by CY1PR0201MB1498.namprd02.prod.outlook.com (10.163.139.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Wed, 13 Sep 2017 10:42:13 +0000 Received: from BN1AFFO11FD021.protection.gbl (2a01:111:f400:7c10::146) by CY4PR02CA0004.outlook.office365.com (2603:10b6:903:18::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.8 via Frontend Transport; Wed, 13 Sep 2017 10:42:12 +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 BN1AFFO11FD021.mail.protection.outlook.com (10.58.52.81) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.13.11 via Frontend Transport; Wed, 13 Sep 2017 10:42:12 +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; Wed, 13 Sep 2017 03:42:09 -0700 From: Viswas G To: CC: , , , , , Subject: [PATCH V2 5/9] pm80xx : cleanup in pm8001_abort_task function. Date: Wed, 18 Feb 2015 05:06:46 +0530 Message-ID: <20150217233650.9091-6-Viswas.G@microsemi.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20150217233650.9091-1-Viswas.G@microsemi.com> References: <20150217233650.9091-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:SPM; SFS:(10009020)(6009001)(366002)(346002)(376002)(39860400002)(2980300002)(438002)(189002)(199003)(57986006)(76176999)(50986999)(2906002)(47776003)(478600001)(77096006)(48376002)(2950100002)(6916009)(50466002)(6666003)(76506005)(110136004)(5003940100001)(189998001)(4326008)(54906002)(53936002)(106466001)(2351001)(104016004)(86362001)(81166006)(81156014)(50226002)(8936002)(69596002)(5660300001)(36756003)(8676002)(97736004)(305945005)(356003)(68736007)(316002)(1076002)(5530500006); DIR:OUT; SFP:1501; SCL:5; SRVR:CY1PR0201MB1498; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD021; 1:Pe+EFd9R7GimKwluPcnFfiL+m+ar34X3GSZe6EaPMqHHspZIsUh5Xav/wax9U8lxWdy5zMsYkGXsX+8OJAIpAU+hOmM+mmVZ163tKLXwJUFSHkbMeiF5BV++HLqZ8OM6 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2bd51f89-f0b8-41bc-f2f4-08d4fa9417c3 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:CY1PR0201MB1498; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1498; 3:3RBKVPXXgI5SrFX4D1KqxNMcS30QcRtSTQzYS/8LidYSysBjkmsbIv2snORmXhvU7na7l5u/5JLrUPs7IgGpKR49C5FPGiAJ0Xgxw2BhTvk4u6aBZLEG+8vxcDR2RSdcGwriciHqZNcSlBwA/e0sKi2ilG/NXOQwLHz2fknDY6sb3BM0h8Ci+0epAqRl+nDadfRjLKyztj2A3aVYcKkwoM2GnZp3Ctx1CWSn6LtYT4BCT0FflS/ZJZrnk4Oak+pZNR1gCUBphbTKmu8KraspzD3d56HB9jXco9OdIsje2rIDcSwuRiMZNPaPFAH3HKTkdtBck/GZtSl03Qs882DvXZ0W4zRbhwdQr+G00naVQK0=; 25:fYegBFHmg/By9sndry9djqU0JdbOHi+TCw7hU+lVAUoqZJ8ugIr1DhFTS0nD97iVrJzrpVDZH4oE821XYSkjUfSIDiOFe1l5yYBTzWvcE4kb/AaqlgB6P4m6rcQUobsr5ERHWZU1qzSmFg/rIRS9voNycFUptcR5/tBdq4QcqnKxpwHkkokWSJCe/Vx5lrZtoX/vvKUA5/iFDXGThreOR1kkwxsGj1Iy3gYnH67ReAVdhVCaKlM6uuOWiGjpZNhsRm1fv7JI15/r7KoTZoYcROxERdvk2l2v9IWP50uf0ab2x/W505svc9mQB6EcEeeqE46S9GAVAJIO6QmTgpY96Q== X-MS-TrafficTypeDiagnostic: CY1PR0201MB1498: X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1498; 31:V/F6xp09r8AK9xvLOJGgRREBCZnqMYP9NccubyNz3wMSLGBeCmjUGtlSYja/F62vCNTrf6vOiWntWIwiPvC/FQnOyUklQHqnwRybVdzh1aZ4gel1lIUiEvGwVRF1b/YLlixceeSz533soyrZyxnrvY6VI3zdNbD5THRWjTeuuAqxssn09WnB4zzurSFKBA6ke80FLbV8SnqGWoG2j4e/S5FAnt8Duhl/vfAibfMDGu0=; 20:hPBfW02J6b0zCWixvX1p/kSx+DO+i9y3Xa+umWEaWoOUfGn0b+4I6SQE8G3ieSP7NFNH4bv5qIa3AVAjc7bn5sXDjAXIOCJPG97o39KIJUGgkcwZZZNDz/DQh38Z8hPJl03EZo7o1XRHjiy1u1dP/dUvrZ+wAz+UDMzrzPvyop5YlmSD6yACfPacl8kZBqyg8ooONLs77PZ1ciuNETA8r80KIMRlL0XW5paPbm02YCi60yfwPtdIxPf/XmT8WxYfEcpyYPGmXdSM/9sTY1rjV7U3HNghvQWB8c6e9tZaBsnZIKJRUojLgZNQo4j71i3bj0A/wj1xdSaIM/i8IX6rypu3BBIJijfhPcsu6Q9DjFBZ28COlmIBffmr6962CqvZHti041m7WrWPKS8xShl2FP1agTj+NCtCPRlPu21aW/8Te21ZcCz5n1CXh4fpVf9D2cMX29k+lBMK68YrL333WIm5HepYMi75ia2x4l6PfDy54gsXg9Gtkn0Zor4BaP7l 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)(3002001)(93006095)(93004095)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(20161123558100)(20161123560025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR0201MB1498; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR0201MB1498; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1498; 4:eLQ7IZjRhVwzT6gD3ZfzIB0WbT2nBYA3fb2hEO2YeGcw8ifjTNXBz1fyc/OU2AhEEQ2gpj6pbl0m9OYYZJiPXvUvWOzapLmn7ptXeAjy0oXffKwKN+hTLIOXGVBKsnuxVC2tpl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yV6FOv9lAfGI8Q0LK1yH+Eq16X1jk/dJZ31ofA/Kpds97zAPzra2ID8VJ3qC9fm0lHe3cuYDT6hMKP6gqoMQ==; 24:ryDYcWiN/g8c5Qpc8qNHypFHyCH4gDESB10JO8Ak6sjRxd68V5csCzDshrPUBibW++WMnZP98Roo2QzvFXHo1w==; 7:hSQvtBrZ2rZ3JJ/CqfQqsomSGG2zqE3J8iuTA9i2ve3gYk4cyhm4x07MrFV+j3P1WyGxbkp+sSiaRuMTQ8ImxzoBPwEmbLule8BXL3SXmr6DNiFFdQdWZEVL1UhDgbrJ1HG4zdccMc8o/e9SnmLhIFAbjtmwQSKb+jWBZHgFmZWxQy6OX606br6A86UmIEGdal6RcYNfDxak7WWT3jpex1fLlcyYYC4X7cnN9Zy1RuE= SpamDiagnosticOutput: 1:22 X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2017 10:42:12.3628 (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: CY1PR0201MB1498 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);