SPDK: remove the duplicated code in ioat/nvme_impl.h

This patch is used to remove the duplicated code.
As we found the structure in "ifdef and else" are same.

Change-Id: I1717ce3dcc14134ac59c165d801e5e811b987be5
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
Ziye Yang 2016-02-16 10:57:57 +08:00 committed by Daniel Verkamp
parent 3d7bcab40a
commit accf229829
2 changed files with 7 additions and 16 deletions

View File

@ -76,6 +76,11 @@ ioat_zmalloc(const char *tag, size_t size, unsigned align, uint64_t *phys_addr)
#define ioat_pcicfg_read32(handle, var, offset) spdk_pci_device_cfg_read32(handle, var, offset)
#define ioat_pcicfg_write32(handle, var, offset) spdk_pci_device_cfg_write32(handle, var, offset)
struct ioat_pci_enum_ctx {
int (*user_enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_dev);
void *user_enum_ctx;
};
#ifdef USE_PCIACCESS
static inline bool
@ -134,11 +139,6 @@ ioat_pci_device_match_id(uint16_t vendor_id, uint16_t device_id)
return false;
}
struct ioat_pci_enum_ctx {
int (*user_enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_dev);
void *user_enum_ctx;
};
static int
ioat_pci_enum_cb(void *enum_ctx, struct spdk_pci_device *pci_dev)
{
@ -244,11 +244,6 @@ static struct rte_pci_id ioat_driver_id[] = {
{ .vendor_id = 0, /* sentinel */ },
};
struct ioat_pci_enum_ctx {
int (*user_enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_dev);
void *user_enum_ctx;
};
/*
* TODO: eliminate this global if possible (does rte_pci_driver have a context field for this?)
*

View File

@ -131,12 +131,13 @@ extern struct rte_mempool *request_mempool;
#define nvme_pcicfg_read32(handle, var, offset) spdk_pci_device_cfg_read32(handle, var, offset)
#define nvme_pcicfg_write32(handle, var, offset) spdk_pci_device_cfg_write32(handle, var, offset)
#ifdef USE_PCIACCESS
struct nvme_pci_enum_ctx {
int (*user_enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_dev);
void *user_enum_ctx;
};
#ifdef USE_PCIACCESS
static int
nvme_pci_enum_cb(void *enum_ctx, struct spdk_pci_device *pci_dev)
{
@ -203,11 +204,6 @@ static struct rte_pci_id nvme_pci_driver_id[] = {
{ .vendor_id = 0, /* sentinel */ },
};
struct nvme_pci_enum_ctx {
int (*user_enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_dev);
void *user_enum_ctx;
};
/*
* TODO: eliminate this global if possible (does rte_pci_driver have a context field for this?)
*