[PATCH v1] bus/pci: get PCI address from rte_device
Thomas Monjalon
thomas at monjalon.net
Tue May 30 15:47:37 CEST 2023
30/05/2023 13:42, eagostini at nvidia.com:
> This patch introduces a get function to retrieve a PCI address
> from an rte_device handler.
[...]
> +const struct rte_pci_addr *
> +rte_pci_get_addr(const struct rte_device *dev)
> +{
> + const struct rte_pci_device *pci_dev;
> +
> + if (!dev) {
Please compare pointer with == NULL
> + rte_errno = EINVAL;
> + return NULL;
> + }
Can we check the bus type here?
> +
> + pci_dev = RTE_DEV_TO_PCI_CONST(dev);
> +
> + return &pci_dev->addr;
> +}
[...]
> +/**
> + * Return PCI device address of an rte_device
You can replace rte_device with "generic device" and add a dot :)
> + *
> + * @param dev
> + * A pointer to a rte_device structure describing the device
> + * to use
Do it simpler: pointer to the generic device structure.
> + *
> + * @return
> + * PCI address of the device on success, NULL if no driver
> + * is found for the device.
Not exactly, it can return NULL if the device is not PCI.
> + */
> +const struct rte_pci_addr * rte_pci_get_addr(const struct rte_device *dev);
More information about the stable
mailing list