Commit f07e0ddf authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

pci: cleanup the detach code



Very minor cleanup before we start refactoring the code.

Change-Id: I00d768ec0c84f2a37c54b7575de695281c5ebb22
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/434411


Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: default avatarJim Harris <james.r.harris@intel.com>
parent 1b7c0f54
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ spdk_pci_device_attach(struct spdk_pci_enum_ctx *ctx,
		       spdk_pci_enum_cb enum_cb,
		       void *enum_ctx, struct spdk_pci_addr *pci_address)
{
	int rc;
#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 3)
	char bdf[32];

@@ -150,25 +151,20 @@ spdk_pci_device_attach(struct spdk_pci_enum_ctx *ctx,
	ctx->cb_arg = enum_ctx;

#if RTE_VERSION >= RTE_VERSION_NUM(18, 11, 0, 0)
	if (rte_eal_hotplug_add("pci", bdf, "") != 0) {
	rc = rte_eal_hotplug_add("pci", bdf, "");
#elif RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 3)
	if (rte_eal_dev_attach(bdf, "") != 0) {
	rc = rte_eal_dev_attach(bdf, "");
#elif RTE_VERSION >= RTE_VERSION_NUM(17, 05, 0, 4)
	if (rte_pci_probe_one(&addr) != 0) {
	rc = rte_pci_probe_one(&addr);
#else
	if (rte_eal_pci_probe_one(&addr) != 0) {
	rc = rte_eal_pci_probe_one(&addr);
#endif
		ctx->cb_arg = NULL;
		ctx->cb_fn = NULL;
		pthread_mutex_unlock(&g_pci_mutex);
		return -1;
	}

	ctx->cb_arg = NULL;
	ctx->cb_fn = NULL;
	pthread_mutex_unlock(&g_pci_mutex);

	return 0;
	return rc == 0 ? 0 : -1;
}

/* Note: You can call spdk_pci_enumerate from more than one thread