From patchwork Fri Jun 30 16:10:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 106752 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp6116288obb; Fri, 30 Jun 2017 09:12:20 -0700 (PDT) X-Received: by 10.98.15.220 with SMTP id 89mr23435877pfp.203.1498839140046; Fri, 30 Jun 2017 09:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498839140; cv=none; d=google.com; s=arc-20160816; b=iHTx4dJHQQbN6e+7ikTfRLRNrSf1dYtt704kmQw+dpXUtKty0ZbxPhc5vYHO6BSlnQ /vt7/ETFq75MaMpZUddJM27MtfmJmQKR2Oldcm43nnnUpELo2VoAn2or805KfjNtbDFx COQKOLnW4zmymp/Lw31N7uSeAwhTJXMlhza858ha2leYCjINuAaJZ1oHfFVBqYVUZ06j aaecoFYWk5AVfPXzLPlagmqlOCbJdi6eRZRXR1vI0zB3SPMMpSNURAeO4A0aWuQWHGBV lDfQNkIL4sXaBksCVAUXlessd84FKGD8XUsyNeofaBaxVkbSvuDvnka7HVhtf1tJvx3r kbuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=qVrchzBLz6J9B07ONlKqxrBawACaPvSLg0VmGY+DDxA=; b=Nok0QbGvQCZG6+eo6PzX+4wsReNg8Mwvn2G+BxfyIlXMkhNFpU78CbQ/SkNq0QKLpT Mq4t9BmvKUEhRj+u2lUaippXyqfJkJd8WSZ6KObcHumXkuyFkgg/L3FqYQC0dJWDxiAL 0ZcGmGtgelfQNP7RScJH+WeCD4/3ZqiJDhbo8pYRFA8GKR5UvLAdk/aXVgB43ppV1fCm BbfLN3ceni2izspozOA5Hi8j/gK/AF0Y/NSZyuwYqhJM3Knur/sYAPp/iecRXqbeYnEp 2eXdi3UI9gudV8drEbWgwGXUqB8YIXqI0RTl0qJ2q4sRaDVpMXMHOxDGZWky45fekAEB paSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 72si6801212plc.44.2017.06.30.09.12.19; Fri, 30 Jun 2017 09:12:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751874AbdF3QL7 (ORCPT + 1 other); Fri, 30 Jun 2017 12:11:59 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:51485 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751946AbdF3QL6 (ORCPT ); Fri, 30 Jun 2017 12:11:58 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0M0Qqz-1dk1073d1B-00uapK; Fri, 30 Jun 2017 18:11:19 +0200 From: Arnd Bergmann To: qla2xxx-upstream@qlogic.com, "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Quinn Tran , Himanshu Madhani , Nicholas Bellinger , Darren Trapp , Anil Gurumurthy , Duane Grigsby , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] scsi: qla2xxx: avoid unused-function warning Date: Fri, 30 Jun 2017 18:10:40 +0200 Message-Id: <20170630161056.30630-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170630161056.30630-1-arnd@arndb.de> References: <20170630161056.30630-1-arnd@arndb.de> X-Provags-ID: V03:K0:YTg6gL97IyqG1/4V+UXYFY0OA8VkY9+yO9+UFq9cpROzgv6VWxI 70p7/0YuvdTaBC0AxDO22ndcvE7WSXzmzTSjFMnzzPTJovCL4SJyuAMI3/yT5c16n3YZ5sr BhuED4/zZFn+BGdQTHakLONAX8LulHT6S1A8JgkJJ7TVb/7PzWu4djLXqgvaRDqEwVuSeLW +JqIM0amYDAY9xdzpQWyw== X-UI-Out-Filterresults: notjunk:1; V01:K0:pnV8LIp9wJs=:3bK3bK2OQOTOBoTp1NsPCk j1t9WL4m6GcTFgbKJqVPdkKDbAN39pGjrZ/bSNHq2O8VA4uF9x17uSzrgpH5aPSEXYQAuhs+H MkQbSviTovcDZUbYiqXnwMDl5rHneLmkZAPDl4KNZd/MQ811Bfqcpt06hHCZ5yAKfr8upqVad UVjHcZOyHHvVqTCKDbaM86MrLI4w5QSBDuFVLgsZhHlMuYFCzrznqLFArbUvSp50Z0Q+XJFYa +IQhMyonebJndoR8Na7slFgbt6/CWKChpoTkc6H/DhH7w+4pU0z2MiWoVtSxzLkZDGH8/DnOj IDkLL+49VugYKtKhtbNcz/HMmlW7bAGmNnZcW+T9VyO0DIplQl+ExYTUq2WFBwxKlILFcixLY 9w6wF1EotsvHWF3lclraiHRHVgUJNLWrUBTwv9+gxozZWJm8SBdXlEpKvSUnwZJB9/Uz/6g+I BZThY83aY8d5+qV9ZF0Xq+kst4WwKp1iZZsd6DPaRgcHpsHHmoEBWYX/gsxyAfe7ImtE1vN2H RDHTtO4JxyFHWtjk1A8buIuStAzqJbqWtSeM57X5PE+Q02oVVgHlAkp6Oiql3YSQOuTONZFY3 l8WFEeIN6zDu0lU+TjToGMgMzHe96MxSw9ZgGHyHJz4sco9kzndASvnJYij0skPwYnH7Kv8zl 8SwVTWQhN5paM/c4UvFT4w3I4Vy2osdx1Q5PBA7Jq3juZYUra46fQqZwp9FImzBnhBT8= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When NVMe support is disabled, we get a couple of harmless warnings: drivers/scsi/qla2xxx/qla_nvme.c:667:13: error: 'qla_nvme_unregister_remote_port' defined but not used [-Werror=unused-function] drivers/scsi/qla2xxx/qla_nvme.c:634:13: error: 'qla_nvme_abort_all' defined but not used [-Werror=unused-function] drivers/scsi/qla2xxx/qla_nvme.c:604:12: error: 'qla_nvme_wait_on_rport_del' defined but not used [-Werror=unused-function] This replaces the preprocessor checks in the code with equivalent compiler conditionals, which lets gcc drop the unused functions without warning, and is nicer to read. Fixes: e84067d74301 ("scsi: qla2xxx: Add FC-NVMe F/W initialization and transport registration") Signed-off-by: Arnd Bergmann --- drivers/scsi/qla2xxx/Kconfig | 1 + drivers/scsi/qla2xxx/qla_nvme.c | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) -- 2.9.0 diff --git a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig index de952935b5d2..036cc3f217b1 100644 --- a/drivers/scsi/qla2xxx/Kconfig +++ b/drivers/scsi/qla2xxx/Kconfig @@ -2,6 +2,7 @@ config SCSI_QLA_FC tristate "QLogic QLA2XXX Fibre Channel Support" depends on PCI && SCSI depends on SCSI_FC_ATTRS + depends on NVME_FC || !NVME_FC select FW_LOADER select BTREE ---help--- diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index 14e25e32e622..9c18d754ac33 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -17,10 +17,12 @@ static void qla_nvme_unregister_remote_port(struct work_struct *); int qla_nvme_register_remote(scsi_qla_host_t *vha, fc_port_t *fcport) { -#if (IS_ENABLED(CONFIG_NVME_FC)) struct nvme_rport *rport; int ret; + if (!IS_ENABLED(CONFIG_NVME_FC)) + return 0; + if (fcport->nvme_flag & NVME_FLAG_REGISTERED) return 0; @@ -78,7 +80,6 @@ int qla_nvme_register_remote(scsi_qla_host_t *vha, fc_port_t *fcport) init_waitqueue_head(&fcport->nvme_waitQ); rport->fcport = fcport; list_add_tail(&rport->list, &vha->nvme_rport_list); -#endif return 0; } @@ -666,11 +667,13 @@ static void qla_nvme_abort_all(fc_port_t *fcport) static void qla_nvme_unregister_remote_port(struct work_struct *work) { -#if (IS_ENABLED(CONFIG_NVME_FC)) struct fc_port *fcport = container_of(work, struct fc_port, nvme_del_work); struct nvme_rport *rport, *trport; + if (!IS_ENABLED(CONFIG_NVME_FC)) + return; + list_for_each_entry_safe(rport, trport, &fcport->vha->nvme_rport_list, list) { if (rport->fcport == fcport) { @@ -680,16 +683,17 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work) fcport->nvme_remote_port); } } -#endif } void qla_nvme_delete(scsi_qla_host_t *vha) { -#if (IS_ENABLED(CONFIG_NVME_FC)) struct nvme_rport *rport, *trport; fc_port_t *fcport; int nv_ret; + if (!IS_ENABLED(CONFIG_NVME_FC)) + return; + list_for_each_entry_safe(rport, trport, &vha->nvme_rport_list, list) { fcport = rport->fcport; @@ -711,17 +715,18 @@ void qla_nvme_delete(scsi_qla_host_t *vha) ql_log(ql_log_info, vha, 0x2115, "Unregister of localport failed\n"); } -#endif } void qla_nvme_register_hba(scsi_qla_host_t *vha) { -#if (IS_ENABLED(CONFIG_NVME_FC)) struct nvme_fc_port_template *tmpl; struct qla_hw_data *ha; struct nvme_fc_port_info pinfo; int ret; + if (!IS_ENABLED(CONFIG_NVME_FC)) + return; + ha = vha->hw; tmpl = &qla_nvme_fc_transport; @@ -752,5 +757,4 @@ void qla_nvme_register_hba(scsi_qla_host_t *vha) atomic_set(&vha->nvme_ref_count, 1); vha->nvme_local_port->private = vha; init_waitqueue_head(&vha->nvme_waitQ); -#endif }