From patchwork Wed Dec 27 04:34:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghava Aditya Renukunta X-Patchwork-Id: 10133437 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 D396B6037D for ; Wed, 27 Dec 2017 04:35:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCC112DA63 for ; Wed, 27 Dec 2017 04:35:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1B622DAA2; Wed, 27 Dec 2017 04:35:56 +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 4874F2DA63 for ; Wed, 27 Dec 2017 04:35:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751853AbdL0Efu (ORCPT ); Tue, 26 Dec 2017 23:35:50 -0500 Received: from mail-sn1nam01on0040.outbound.protection.outlook.com ([104.47.32.40]:19154 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751814AbdL0EfU (ORCPT ); Tue, 26 Dec 2017 23:35:20 -0500 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=EYpCJLlc1w4NX0GFVF8ztlsMzF4QxUX5b0iWcMqK83Y=; b=ScDC9uak6qXjHaIcpTdmD0QDe+hH8hzOvZ0kw0SMLAuXmG84O+a9HW68UJepu5Jdl5xCtEyIjiAM/4co7qwqM6YHnFNiC3yBiyi+eyxP/Iom/j5Ma6LSErqUko0f6JunZypspURqzhL9LrwUr9LvQf0oFybNkK43a0aBQPYsIHY= Received: from CY4PR02CA0009.namprd02.prod.outlook.com (10.169.188.19) by BLUPR02MB131.namprd02.prod.outlook.com (10.242.189.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.15; Wed, 27 Dec 2017 04:35:17 +0000 Received: from BL2FFO11FD049.protection.gbl (2a01:111:f400:7c09::162) by CY4PR02CA0009.outlook.office365.com (2603:10b6:903:18::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Wed, 27 Dec 2017 04:35:16 +0000 Authentication-Results: spf=pass (sender IP is 208.19.100.21) smtp.mailfrom=microsemi.com; wdc.com; dkim=none (message not signed) header.d=none;wdc.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 BL2FFO11FD049.mail.protection.outlook.com (10.173.161.211) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.345.12 via Frontend Transport; Wed, 27 Dec 2017 04:34:56 +0000 Received: from localhost (10.181.72.13) by avsrvexchhts1.microsemi.net (10.100.34.105) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 26 Dec 2017 20:35:00 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" , Bart Van Assche Subject: [PATCH v2 22/30] scsi: aacraid: Merge adapter setup with resolve luns Date: Tue, 26 Dec 2017 20:34:43 -0800 Message-ID: <20171227043451.27813-23-RaghavaAditya.Renukunta@microsemi.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171227043451.27813-1-RaghavaAditya.Renukunta@microsemi.com> References: <20171227043451.27813-1-RaghavaAditya.Renukunta@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)(376002)(39380400002)(346002)(39860400002)(396003)(2980300002)(438002)(189003)(199004)(77096006)(4326008)(106466001)(47776003)(48376002)(50466002)(53936002)(97736004)(69596002)(2906002)(76506005)(36756003)(106002)(59450400001)(76176011)(51416003)(50226002)(57986006)(305945005)(104016004)(478600001)(81156014)(81166006)(72206003)(8676002)(356003)(86362001)(68736007)(8936002)(110136005)(1076002)(316002)(5660300001)(16586007)(54906003)(2201001)(2950100002)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR02MB131; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD049; 1:p7OJzyfe2jd/a7fTOP25H+YHNwmMR2gWg+3F/OWORnBcnLS+/qXjAP9uBJgr6v2E2+603Tp0OZoEHGD3/I+zPudSIueMuGd39TWo91+LNOf6e+v5LxkOJEWTXSP0ulAz X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4acfe98f-b0cc-4e42-1639-08d54ce32f08 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:BLUPR02MB131; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB131; 3:h4EBDT53MZoSCBlh0k5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UIhofKmzWfD9N5oBHNgdUH64YHctBhjqsIhJ/OSYMcLF/4KKLjiNzVBrcjnuzmt2vQhwpJ3ku+GDrjT47+OlUV4P62vxvvE8lU11RCV7jnPgCMkUorTslB83LIfIhlcrvZjBpVQyb8ALCIr2P6EjqFopFMLDxCfsYK7S2yLcKC/OywYpbA0iIixHBx8sPEVepVmi4OPb54jU7j2Y/xGQNStgo9HLTrzIB27w1Wl+rmfQ6t45INV95I9Gr4Ma0ytZ4qM76eOvJQBwIKjG8gXh7wNnhZavFcuYq/CUZiL53v2/OoADtQ6izO5T7ccFCvYntmMRtYSsvqeq5fkgaYSJlmfcDdOagLT2X0m/THiSrHTAKv96uLPyuAf96IP5+nY28vDAt+kcJ6u4M0iFbNVYvLJF5kIj9zoaTUncg9mpTklBnl7HqfyI5FdFLCZFX/DCljyo6U8vGwSXYnVhhyVK89/YvavUCeOSY9a+CkdpzvU6OAkUQNpy4QitbBLsQXxILVsH/yoUkbIJVf285eWhk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93004095)(3231023)(944501075)(10201501046)(3002001)(6055026)(6041268)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:BLUPR02MB131; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BLUPR02MB131; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB131; 4:paQ0HjBXX1/zUcO4ItfY/795DN8eCNeSSUiNhRY3MIv5V0CjlOOUYc678Woqgt6H6JY0E4MGDaxsurbJujFKSLB5w5w6oCCaKZjHmPCteFqmIKKEP1kgrVTT1HaN/RTh4CzDfoq3xr+6cJCGW+qhpjsgRmRhNsbqteJMd2uHFvnCcgFrpt/iUjZJvXWhQhurKkzT3Nkd0QGBHH/G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2SO/tlDLi8ww=; 24:rcdItnzY/k0A164Cvks+hElnjNfYio5j+NOVJqmbPiFHLa0+tVeJ+3Ahs6UBO36sx6GrCKmCj4fXHJNXBN4N8P5Dr336Qj4UVYrjYhYCEBI=; 7:ofsLq82HPyCdwfBjJKxu/Dp4gc8hafWlnS/Mv/LrVFk2irmWV8SEkDFDZKbOf+V2stD7oUgnk0FVSNGAgC2eggk2F5Dtshm585T7Pzl6TBiY1NaM+8VQd2pSHZPMD4AwmyP1eLR0aw3pL6qVFR2rwg0O98vUZxSpJv4D1KPQJvCw3kTwjAojFSpQzZ0wXxvVcUq+B/SGQISLyc0Iew/gXTGIrgOEmJbgZPtXgKv9eQLnvMlfs4JzBWe850A1/fcW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2017 04:34:56.9707 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4acfe98f-b0cc-4e42-1639-08d54ce32f08 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: BLUPR02MB131 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 The device hotplug events are processed only after retrieving the updated lun information from the fw. Does not make sense to keep them separate. Merge both the hotplug handling and safw adapter setup code into single function. Signed-off-by: Raghava Aditya Renukunta --- Changes in V2: None drivers/scsi/aacraid/commsup.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 5b7a4f5..34155b1 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -1934,11 +1934,18 @@ static int aac_is_safw_device_exposed(struct aac_dev *dev, int bus, int target) return is_exposed; } -static void aac_resolve_luns(struct aac_dev *dev) +static int aac_update_safw_host_devices(struct aac_dev *dev, int rescan) { int i; - int bus, target; + int bus; + int target; int is_exposed = 0; + int rcode = 0; + + rcode = aac_setup_safw_adapter(dev, rescan); + if (unlikely(rcode < 0)) { + goto out; + } for (i = 0; i < AAC_BUS_TARGET_LOOP; i++) { @@ -1953,6 +1960,8 @@ static void aac_resolve_luns(struct aac_dev *dev) is_exposed) aac_remove_safw_device(dev, bus, target); } +out: + return rcode; } /** @@ -1988,9 +1997,7 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr) case SA_AIF_LDEV_CHANGE: case SA_AIF_BPCFG_CHANGE: - aac_setup_safw_adapter(dev, AAC_RESCAN); - - aac_resolve_luns(dev); + aac_update_safw_host_devices(dev, AAC_RESCAN); break; case SA_AIF_BPSTAT_CHANGE: