On 2015/07/02 19:46, Bruce Richardson wrote: > On Tue, Jun 30, 2015 at 05:24:22PM +0900, Tetsuya Mukawa wrote: >> From: "Tetsuya.Mukawa" <mukawa at igel.co.jp> >> >> This patch adds a new function called pci_uio_alloc_resource(). >> The function hides how to prepare uio resource in linuxapp and bsdapp. >> With the function, pci_uio_map_resource() will be more abstracted. >> >> Signed-off-by: Tetsuya Mukawa <mukawa at igel.co.jp> >> --- >> lib/librte_eal/bsdapp/eal/eal_pci.c | 70 +++++++++++++++++++--------- >> lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 77 >> ++++++++++++++++++++++--------- >> 2 files changed, 104 insertions(+), 43 deletions(-) >> >> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c >> b/lib/librte_eal/bsdapp/eal/eal_pci.c >> index 06c564f..7d2f8b5 100644 >> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c >> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c >> @@ -189,28 +189,17 @@ pci_uio_map_secondary(struct rte_pci_device *dev) >> return 1; >> } >> >> -/* map the PCI resource of a PCI device in virtual memory */ >> static int >> -pci_uio_map_resource(struct rte_pci_device *dev) >> +pci_uio_alloc_resource(struct rte_pci_device *dev, >> + struct mapped_pci_resource **uio_res) > Rather than having to pass in a pointer to a pointer, why not change the > return type to be "struct mapped_pci_resource *"? The only return values > currently > are 0 and -1, so those could map to non-NULL and NULL respectively, for error > checking. > > /Bruce
It might be difficult to do like above, because pci_uio_alloc_resource() returns 0, -1 and 1 as return value so far. Original pci_uio_map_resource() returns negative return value as error, and positive value as driver not found. So I follow this specification while implementing the function. Tetsuya