From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=zZ8fh7ANI2RJDkACI39688RI2FO+QyCKdiGQZQVAwdw=; b=ycOGDh20EgsIlAsUjh8E1iuDcU+DrdoMTlsOAVDSaVrjKAKUrt0J4DObxtTzCqLPMU uNR1ronaiIGX+ty3cNIoMB9tEz1R6i6MQFireNg5uoRns94DZ9kPoG2hJm/c16WdVB6G 4eotgFd9lyEf+cQjg8ks1gjRg94HX/6Utll/7zPHN41T49pvtigaa/R4rQIZ0QOe8RpG 4MzBhKL+mT4JtP/1mmu0ukMB+GRB1K771SKCpZnlQCeErG7u+eesfNbQPfcs949DbFZq hmNE69FVfWgCqsSl9oN96N0fgdC79G/SY5eCNkSI8PdDXRLoXRkGYVGs2iMVlIlGLTqy IYqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=zZ8fh7ANI2RJDkACI39688RI2FO+QyCKdiGQZQVAwdw=; b=HRt9K8S219/dpuj5VRvgn20LDhCp1Y6ge8H8EyHaAIsrhRlmrgpuNH3CkguzH9KM0/ lvu8ABh5e6ixCMxnX6DEa6yLPQD4NsaurgezLtt7g5G9UcIM+Gjy412sPa7FTj1BEu7+ Y1xHoNyWt74pmPG0sP8S+vX5nRZA3bKNSu01puPE+JmI6wSI9LnD3y9yFw5XJiYAipL3 UaVfIjS+YQnv+XV/GGa14t6fFlccQdhp23ntatv5TApZl5h06/zIS/cN+WmSxmR+Qih0 M63HORZ7BqTbmWLjvoAY3x8DJFX2hB4lwf+88PTepXBHifyDCC3+UqHUM4wqJyR/PM6j g6ug== X-Gm-Message-State: ALoCoQn5284X4m6d5a6RGGAxxjGmrxURdAXVKFB6RLHN4Sv0ZOJDBFSVvZkpGkiL7zu4GPqKI0RWdks+sxhCGDU8cECZOmNr7A== X-Received: by 10.67.5.2 with SMTP id ci2mr152993402pad.47.1452191975722; Thu, 07 Jan 2016 10:39:35 -0800 (PST) Received: from xeon-e3 (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id mj1sm160696119pab.34.2016.01.07.10.39.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jan 2016 10:39:35 -0800 (PST) Date: Thu, 7 Jan 2016 10:39:43 -0800 From: Stephen Hemminger To: "Wiles, Keith" Message-ID: <20160107103943.5c630221@xeon-e3> In-Reply-To: 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" Subject: Re: [dpdk-dev] [PATCH v3 06/12] eal: pci: vfio: add rd/wr func for pci bar space X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2016 18:39:36 -0000 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