Commit ec0b5d2b authored by Ben Walker's avatar Ben Walker Committed by Daniel Verkamp
Browse files

nvme: Clean up redundant arguments in transport_ctrlr_construct



The other simplifications to probe_info and trid made the
trtype argument redundant.

Change-Id: Ie7bea4e2204e690dc4909eeacd065e0722b53272
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 32e838af
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -311,7 +311,7 @@ nvme_ctrlr_probe(const struct spdk_nvme_transport_id *trid, void *devhandle,
	spdk_nvme_ctrlr_opts_set_defaults(&opts);

	if (probe_cb(cb_ctx, trid, &opts)) {
		ctrlr = nvme_transport_ctrlr_construct(trid->trtype, &opts, trid, devhandle);
		ctrlr = nvme_transport_ctrlr_construct(trid, &opts, devhandle);
		if (ctrlr == NULL) {
			SPDK_ERRLOG("Failed to construct NVMe controller\n");
			return -1;
+2 −2
Original line number Diff line number Diff line
@@ -564,8 +564,8 @@ void nvme_qpair_print_completion(struct spdk_nvme_qpair *qpair, struct spdk_nvme

/* Transport specific functions */
#define DECLARE_TRANSPORT(name) \
	struct spdk_nvme_ctrlr *nvme_ ## name ## _ctrlr_construct(enum spdk_nvme_transport_type trtype, const struct spdk_nvme_ctrlr_opts *opts, \
		const struct spdk_nvme_transport_id *trid, void *devhandle); \
	struct spdk_nvme_ctrlr *nvme_ ## name ## _ctrlr_construct(const struct spdk_nvme_transport_id *trid, const struct spdk_nvme_ctrlr_opts *opts, \
		void *devhandle); \
	int nvme_ ## name ## _ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr); \
	int nvme_ ## name ## _ctrlr_scan(const struct spdk_nvme_transport_id *trid, void *cb_ctx, spdk_nvme_probe_cb probe_cb, spdk_nvme_remove_cb remove_cb); \
	int nvme_ ## name ## _ctrlr_attach(enum spdk_nvme_transport_type trtype, spdk_nvme_probe_cb probe_cb, void *cb_ctx, struct spdk_pci_addr *addr); \
+1 −2
Original line number Diff line number Diff line
@@ -582,9 +582,8 @@ nvme_pcie_ctrlr_attach(enum spdk_nvme_transport_type trtype,
	return spdk_pci_nvme_device_attach(pcie_nvme_enum_cb, &enum_ctx, pci_addr);
}

struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(enum spdk_nvme_transport_type trtype,
struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(const struct spdk_nvme_transport_id *trid,
		const struct spdk_nvme_ctrlr_opts *opts,
		const struct spdk_nvme_transport_id *trid,
		void *devhandle)
{
	struct spdk_pci_device *pci_dev = devhandle;
+4 −8
Original line number Diff line number Diff line
@@ -1070,9 +1070,7 @@ nvme_rdma_ctrlr_scan(const struct spdk_nvme_transport_id *discovery_trid,
	discovery_opts.keep_alive_timeout_ms = 0;

	memset(buffer, 0x0, 4096);
	discovery_ctrlr = nvme_rdma_ctrlr_construct(SPDK_NVME_TRANSPORT_RDMA, &discovery_opts,
			  discovery_trid,
			  NULL);
	discovery_ctrlr = nvme_rdma_ctrlr_construct(discovery_trid, &discovery_opts, NULL);
	if (discovery_ctrlr == NULL) {
		return -1;
	}
@@ -1156,10 +1154,8 @@ nvme_rdma_ctrlr_attach(enum spdk_nvme_transport_type trtype,
	return -1;
}

struct spdk_nvme_ctrlr *
	nvme_rdma_ctrlr_construct(enum spdk_nvme_transport_type trtype,
struct spdk_nvme_ctrlr *nvme_rdma_ctrlr_construct(const struct spdk_nvme_transport_id *trid,
		const struct spdk_nvme_ctrlr_opts *opts,
			  const struct spdk_nvme_transport_id *trid,
		void *devhandle)
{
	struct nvme_rdma_ctrlr *rctrlr;
+4 −6
Original line number Diff line number Diff line
@@ -81,13 +81,11 @@ spdk_nvme_transport_available(enum spdk_nvme_transport_type trtype)
	return false;
}

struct spdk_nvme_ctrlr *
	nvme_transport_ctrlr_construct(enum spdk_nvme_transport_type trtype,
struct spdk_nvme_ctrlr *nvme_transport_ctrlr_construct(const struct spdk_nvme_transport_id *trid,
		const struct spdk_nvme_ctrlr_opts *opts,
			       const struct spdk_nvme_transport_id *trid,
		void *devhandle)
{
	NVME_TRANSPORT_CALL(trtype, ctrlr_construct, (trtype, opts, trid, devhandle));
	NVME_TRANSPORT_CALL(trid->trtype, ctrlr_construct, (trid, opts, devhandle));
}

int
Loading