Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752582AbdF3QMA (ORCPT ); Fri, 30 Jun 2017 12:12:00 -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 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3685 Lines: 119 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(-) 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 } -- 2.9.0