[PATCH] eal/common: fix inconsistent representation of PCI numbers
Stephen Hemminger
stephen at networkplumber.org
Tue Jul 2 00:00:36 CEST 2024
On Mon, 1 Jul 2024 23:01:17 +0300
Shani Peretz <shperetz at nvidia.com> wrote:
> --- a/drivers/bus/pci/pci_common.c
> +++ b/drivers/bus/pci/pci_common.c
> @@ -501,6 +501,15 @@ rte_pci_dump(FILE *f)
> pci_dump_one_device(f, dev);
> }
> }
> +static int
> +pci_cmp_name(const struct rte_device *dev1, const void *name2)
Blank line between functions please
> +{
> + const struct rte_pci_device *dev = RTE_DEV_TO_PCI_CONST(dev1);
> + char name2_addr[sizeof(struct rte_pci_addr)] = {0};
This should just be a rte_pci_addr type, not char.
And don't need to initialize it.
> + dev1->bus->parse(name2, (void *)&name2_addr);
If it was the correct type, cast would not be needed.
> +
> + return memcmp(&name2_addr, &(dev->addr), sizeof(struct rte_pci_addr));
Use existing rte_pci_addr_cmp()
> +}
More information about the dev
mailing list