From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v3 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write} Date: Sat, 30 Mar 2019 23:25:44 +0100 Message-ID: <2391415.SPZlMYUle4@xps> References: <20190313170657.16688-1-ncopa@alpinelinux.org> <20190313170657.16688-5-ncopa@alpinelinux.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: Natanael Copa , gaetan.rivet@6wind.com, ferruh.yigit@intel.com To: dev@dpdk.org Return-path: Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by dpdk.org (Postfix) with ESMTP id 0A02811A4 for ; Sat, 30 Mar 2019 23:25:48 +0100 (CET) In-Reply-To: <20190313170657.16688-5-ncopa@alpinelinux.org> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 13/03/2019 18:06, Natanael Copa: > define the macros so we can remove various #if defined(RTE_ARCH_X86) > > Ref: https://bugs.dpdk.org/show_bug.cgi?id=35#c6 > > Signed-off-by: Natanael Copa > --- > drivers/bus/pci/linux/pci_uio.c | 54 +++++++++++++++------------------ > 1 file changed, 24 insertions(+), 30 deletions(-) > > diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c > index e1dd8c875..b0470358d 100644 > --- a/drivers/bus/pci/linux/pci_uio.c > +++ b/drivers/bus/pci/linux/pci_uio.c > @@ -14,11 +14,18 @@ > > #if defined(RTE_ARCH_X86) > #include > + > +#define pci_uio_inl(reg) inl(reg) > +#define pci_uio_inw(reg) inw(reg) > +#define pci_uio_inb(reg) inb(reg) > + > #if defined(__GLIBC__) > + > #define pci_uio_outl_p outl_p > #define pci_uio_outw_p outw_p > #define pci_uio_outb_p outb_p > -#else > + > +#else /* defined(__GLIBC__) */ > static inline void > pci_uio_outl_p(unsigned int value, unsigned short int port) > { > @@ -39,8 +46,19 @@ pci_uio_outb_p(unsigned char value, unsigned short int port) > __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value), > "Nd" (port)); > } > -#endif > -#endif > +#endif /* defined(__GLIBC__) */ > + > +#else /* RTE_ARCH_X86 */ > + > +#define pci_uio_inl(reg) (*(volatile uint32_t *)(reg)) > +#define pci_uio_inw(reg) (*(volatile uint16_t *)(reg)) > +#define pci_uio_inb(reg) (*(volatile uint8_t *)(reg)) > + > +#define pci_uio_outl_p(value, reg) (*(volatile uint32_t *)(reg) = (value)) > +#define pci_uio_outw_p(value, reg) (*(volatile uint16_t *)(reg) = (value)) > +#define pci_uio_outb_p(value, reg) (*(volatile uint8_t *)(reg) = (value)) > + > +#endif /* RTE_ARCH_X86 */ I think I would prefer having the #ifdef inside the macros, instead of redefining the macros.