From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH v3 06/12] eal: pci: vfio: add rd/wr func for pci bar space Date: Thu, 7 Jan 2016 10:39:43 -0800 Message-ID: <20160107103943.5c630221@xeon-e3> References: <1452184390-5994-1-git-send-email-sshukla@mvista.com> <1452184390-5994-7-git-send-email-sshukla@mvista.com> <20160107101925.293062ad@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" To: "Wiles, Keith" Return-path: Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by dpdk.org (Postfix) with ESMTP id 6FBA2C12E for ; Thu, 7 Jan 2016 19:39:36 +0100 (CET) Received: by mail-pa0-f45.google.com with SMTP id uo6so246609971pac.1 for ; Thu, 07 Jan 2016 10:39:36 -0800 (PST) In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, 7 Jan 2016 18:26:30 +0000 "Wiles, Keith" wrote: > On 1/7/16, 12:19 PM, "dev on behalf of Stephen Hemminger" wrote: >=20 > >On Thu, 7 Jan 2016 22:03:03 +0530 > >Santosh Shukla wrote: > > > >> =20 > >> +int rte_eal_pci_read_bar(const struct rte_pci_device *device __rte_un= used, > >> + void *buf __rte_unused, > >> + size_t len __rte_unused, > >> + off_t offset __rte_unused, > >> + int bar_idx __rte_unused) > >> +{ > >> +#ifdef VFIO_PRESENT > >> + const struct rte_intr_handle *intr_handle =3D &device->intr_handle; > >> + return pci_vfio_read_bar(intr_handle, buf, len, offset, bar_idx); > >> +#else > >> + return 0; /* UIO's not applicable */ > >> +#endif > >> +} > > > >It seems wrong to declare all the parameters as unused but then use them. > >Maybe there is a way to have a macro for USED(x) in the #else case >=20 > I would suggest we create a macro '#define RTE_UNUSED(x) ((void)x)=E2=80= =99, unless we have one and I missed it groping though the code. > > >=20 >=20 > Regards, > Keith >=20 >=20 >=20 >=20 Or just move the #ifdef outside the function and have two versions #ifdef VFIO_PRESENT int rte_eal_pci_read_bar(const struct rte_pci_device *device, void *buf, size_t len, off_t offset, int bar_idx) { const struct rte_intr_handle *intr_handle =3D &device->intr_handle; return pci_vfio_read_bar(intr_handle, buf, len, offset, bar_idx); } } #else int rte_eal_pci_read_bar(const struct rte_pci_device *device __rte_unused, void *buf __rte_unused, size_t len __rte_unused, off_t offset __rte_unused, int bar_idx __rte_unused) { return 0; /* UIO's not applicable */ } #endif