Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bcda771b authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Martin K. Petersen
Browse files

scsi: qla2xxx: avoid unused-function warning



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: e84067d7 ("scsi: qla2xxx: Add FC-NVMe F/W initialization and transport registration")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarHimanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 9f80efda
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -2,6 +2,7 @@ config SCSI_QLA_FC
	tristate "QLogic QLA2XXX Fibre Channel Support"
	tristate "QLogic QLA2XXX Fibre Channel Support"
	depends on PCI && SCSI
	depends on PCI && SCSI
	depends on SCSI_FC_ATTRS
	depends on SCSI_FC_ATTRS
	depends on NVME_FC || !NVME_FC
	select FW_LOADER
	select FW_LOADER
	select BTREE
	select BTREE
	---help---
	---help---
+12 −8
Original line number Original line Diff line number Diff line
@@ -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)
int qla_nvme_register_remote(scsi_qla_host_t *vha, fc_port_t *fcport)
{
{
#if (IS_ENABLED(CONFIG_NVME_FC))
	struct nvme_rport *rport;
	struct nvme_rport *rport;
	int ret;
	int ret;


	if (!IS_ENABLED(CONFIG_NVME_FC))
		return 0;

	if (fcport->nvme_flag & NVME_FLAG_REGISTERED)
	if (fcport->nvme_flag & NVME_FLAG_REGISTERED)
		return 0;
		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);
	init_waitqueue_head(&fcport->nvme_waitQ);
	rport->fcport = fcport;
	rport->fcport = fcport;
	list_add_tail(&rport->list, &vha->nvme_rport_list);
	list_add_tail(&rport->list, &vha->nvme_rport_list);
#endif
	return 0;
	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)
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,
	struct fc_port *fcport = container_of(work, struct fc_port,
	    nvme_del_work);
	    nvme_del_work);
	struct nvme_rport *rport, *trport;
	struct nvme_rport *rport, *trport;


	if (!IS_ENABLED(CONFIG_NVME_FC))
		return;

	list_for_each_entry_safe(rport, trport,
	list_for_each_entry_safe(rport, trport,
	    &fcport->vha->nvme_rport_list, list) {
	    &fcport->vha->nvme_rport_list, list) {
		if (rport->fcport == fcport) {
		if (rport->fcport == fcport) {
@@ -680,16 +683,17 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work)
			    fcport->nvme_remote_port);
			    fcport->nvme_remote_port);
		}
		}
	}
	}
#endif
}
}


void qla_nvme_delete(scsi_qla_host_t *vha)
void qla_nvme_delete(scsi_qla_host_t *vha)
{
{
#if (IS_ENABLED(CONFIG_NVME_FC))
	struct nvme_rport *rport, *trport;
	struct nvme_rport *rport, *trport;
	fc_port_t *fcport;
	fc_port_t *fcport;
	int nv_ret;
	int nv_ret;


	if (!IS_ENABLED(CONFIG_NVME_FC))
		return;

	list_for_each_entry_safe(rport, trport, &vha->nvme_rport_list, list) {
	list_for_each_entry_safe(rport, trport, &vha->nvme_rport_list, list) {
		fcport = rport->fcport;
		fcport = rport->fcport;


@@ -711,17 +715,18 @@ void qla_nvme_delete(scsi_qla_host_t *vha)
			ql_log(ql_log_info, vha, 0x2115,
			ql_log(ql_log_info, vha, 0x2115,
			    "Unregister of localport failed\n");
			    "Unregister of localport failed\n");
	}
	}
#endif
}
}


void qla_nvme_register_hba(scsi_qla_host_t *vha)
void qla_nvme_register_hba(scsi_qla_host_t *vha)
{
{
#if (IS_ENABLED(CONFIG_NVME_FC))
	struct nvme_fc_port_template *tmpl;
	struct nvme_fc_port_template *tmpl;
	struct qla_hw_data *ha;
	struct qla_hw_data *ha;
	struct nvme_fc_port_info pinfo;
	struct nvme_fc_port_info pinfo;
	int ret;
	int ret;


	if (!IS_ENABLED(CONFIG_NVME_FC))
		return;

	ha = vha->hw;
	ha = vha->hw;
	tmpl = &qla_nvme_fc_transport;
	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);
	atomic_set(&vha->nvme_ref_count, 1);
	vha->nvme_local_port->private = vha;
	vha->nvme_local_port->private = vha;
	init_waitqueue_head(&vha->nvme_waitQ);
	init_waitqueue_head(&vha->nvme_waitQ);
#endif
}
}