Message ID | 20190409190630.31975-11-vivkong@ca.ibm.com |
---|---|
State | New |
Delegated to: | Thomas Monjalon |
Headers | show |
Series |
|
Related | show |
Context | Check | Description |
---|---|---|
ci/checkpatch | warning | coding style issues |
ci/Intel-compilation | success | Compilation OK |
09/04/2019 21:06, Vivian Kong: > Signed-off-by: Vivian Kong <vivkong@ca.ibm.com> > --- > static inline int > eth_dev_pci_specific_init(struct rte_eth_dev *eth_dev, void *bus_device) { > - struct rte_pci_device *pci_dev = bus_device; > + struct rte_pci_device *pci_dev = (struct rte_pci_device *) bus_device; Why do we need such cast?
On Tue, 09 Apr 2019 22:14:08 +0200 Thomas Monjalon <thomas@monjalon.net> wrote: > 09/04/2019 21:06, Vivian Kong: > > Signed-off-by: Vivian Kong <vivkong@ca.ibm.com> > > --- > > static inline int > > eth_dev_pci_specific_init(struct rte_eth_dev *eth_dev, void *bus_device) { > > - struct rte_pci_device *pci_dev = bus_device; > > + struct rte_pci_device *pci_dev = (struct rte_pci_device *) bus_device; > > Why do we need such cast? > > I agree with Thomas, we try to avoid extra casts and there is even a script to find them.
Hmm...we weren't able to compile without the cast. I'll take a closer look. Thanks. Regards, Vivian Kong Linux on IBM Z Open Source Ecosystem IBM Canada Toronto Lab Thomas Monjalon <thomas@monjalon.net> wrote on 2019/04/09 04:14:08 PM: > From: Thomas Monjalon <thomas@monjalon.net> > To: vivkong@ca.ibm.com > Cc: dev@dpdk.org > Date: 2019/04/09 04:14 PM > Subject: Re: [dpdk-dev] [RFC 10/12] ethdev: add cast for bus_device > > 09/04/2019 21:06, Vivian Kong: > > Signed-off-by: Vivian Kong <vivkong@ca.ibm.com> > > --- > > static inline int > > eth_dev_pci_specific_init(struct rte_eth_dev *eth_dev, void *bus_device) { > > - struct rte_pci_device *pci_dev = bus_device; > > + struct rte_pci_device *pci_dev = (struct rte_pci_device *) bus_device; > > Why do we need such cast? > >
diff --git a/lib/librte_ethdev/rte_ethdev_pci.h b/lib/librte_ethdev/rte_ethdev_pci.h index 23257e986..80bd120b9 100644 --- a/lib/librte_ethdev/rte_ethdev_pci.h +++ b/lib/librte_ethdev/rte_ethdev_pci.h @@ -72,7 +72,7 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, static inline int eth_dev_pci_specific_init(struct rte_eth_dev *eth_dev, void *bus_device) { - struct rte_pci_device *pci_dev = bus_device; + struct rte_pci_device *pci_dev = (struct rte_pci_device *) bus_device; if (!pci_dev) return -ENODEV;
Signed-off-by: Vivian Kong <vivkong@ca.ibm.com> --- lib/librte_ethdev/rte_ethdev_pci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)